code
stringlengths 3
10M
| language
stringclasses 31
values |
|---|---|
//////////////////////////////////////////////////////////////////////////
// B_TransferItems
// ===============
// Überträgt das 'item' von 'other' zu 'self'. In 'amount' muß die
// Anzahl der zu übertragenden Items übergeben werden.
//////////////////////////////////////////////////////////////////////////
func void B_TransferItems (var int amount)
{
PrintDebugNpc (PD_ZS_CHECK, "...B_TransferItem");
var int transferItem;
transferItem = Hlp_GetInstanceID(item);
B_PunderInvItems (other, self, transferItem, amount);
if (item.munition == ItAm_Arrow)
{
CreateInvItems (self, ItAm_Arrow, 20);
};
if (item.munition == ItAm_Bolt)
{
CreateInvItems (self, ItAm_Bolt, 20);
};
};
//////////////////////////////////////////////////////////////////////////
// B_CheckItem
// ===========
// Überprüft den Inventoryslot 'slot' in der 'category' und ruft
// bei Bedarf B_TransferItem() auf.
// -> benötigt 'self' und 'other'
// -> initialisiert 'item' selbst
// -> return: - FALSE, wenn kein item genommen wurde
// - TRUE, wenn item genommen wurde
//////////////////////////////////////////////////////////////////////////
func int B_CheckItem (var int category, var int slot)
{
PrintDebugNpc (PD_ZS_CHECK, "B_CheckItem");
var string printText;
printText = IntToString (slot);
if (category == INV_WEAPON ) { printText = ConcatStrings("...found INV_WEAPON_", printText); }
else if (category == INV_ARMOR ) { printText = ConcatStrings("...found INV_ARMOR_", printText); }
else if (category == INV_RUNE ) { printText = ConcatStrings("...found INV_RUNE_", printText); }
//else if (category == INV_POTIONS) { printText = ConcatStrings("...found INV_POTIONS_", printText); }
else if (category == INV_FOOD ) { printText = ConcatStrings("...found INV_FOOD_", printText); }
else if (category == INV_DOC ) { printText = ConcatStrings("...found INV_DOC_", printText); }
else if (category == INV_MISC ) { printText = ConcatStrings("...found INV_MISC_", printText); }
else { printText = ConcatStrings("...found unknown category #",printText); };
var int count;
count = Npc_GetInvItemBySlot(other, category,slot); // initialisiert 'item' und gibt Anzahl zurück
PrintDebugNpc(PD_ZS_DETAIL, IntToString(count));
if (count > 0)
{
PrintDebugNpc(PD_ZS_CHECK, printText);
// JP: Wenn ein Nsc mich beim klauen erwischt hat und ich genug Silber habe wird, dieses transferiert
// und die Attitüde zurück auf neutral gesetzt
if self.aivar[AIV_THEFTWITTNESS]
&& (Npc_GetPermAttitude (self, other) == ATT_ANGRY)
&& B_HasPlayerSilverToSatisfy ()
&& Hlp_IsItem (item, ItMi_Silver)
{
PrintDebugNpc (PD_ZS_CHECK, "B_CheckItem ... genug Silber nach Diebstahl");
B_ExchangeMemoryAttitude ();
return TRUE;
};
if self.aivar[AIV_BEENATTACKED]
&& (Npc_GetPermAttitude (self, other) == ATT_ANGRY)
&& B_HasPlayerSilverToSatisfy ()
&& Hlp_IsItem (item, ItMi_Silver)
{
PrintDebugNpc (PD_ZS_CHECK, "B_CheckItem ... genug Silber nach Diebstahl");
B_ExchangeMemoryAttitude ();
return TRUE;
};
// CS NEU: Nimmt personalisierte Waffen
if (Npc_OwnedByNpc(item,self))
{
B_TransferItems(1);
return TRUE;
};
};
return FALSE;
};
//////////////////////////////////////////////////////////////////////////
// B_Plunder
// =========
// Durchsucht alle Inventoryslots, überprüft, welche Gegenstände er
// haben will, und nimmt sie sich. Durchsucht werden:
//
// alt:
// ----
// - 6 Slots Waffen
// - 2 Slots Rüstungen
// - ? Slots Runen & Scrolls
// - ? Slots Artefakte
// - 15 Slots Nahrung
// - 15 Slots Verschiedenes
//
// neu:
// ----
// - Dem Opfer wird die Hälfte des vorhandenen Erzes abgenommen.
//
// -> Gibt Anzahl der geplünderten Gegenstände zurück.
//////////////////////////////////////////////////////////////////////////
func int B_Plunder ()
{
PrintDebugNpc( PD_ZS_CHECK, "B_Plunder" );
var int amountPlundered;
amountPlundered = 0;
//-------- Durchsuchen der WEAPONS ---------
// Zurückgenommene Waffen werden nicht mitangegeben bei amountPlundered, da sich die SVMs dabei nur auf Erz beziehen.
// Z.Zt. ist INV_MAX_WEAPONS noch auf 6
B_CheckItem(INV_WEAPON, 0 );
B_CheckItem(INV_WEAPON, 1 );
B_CheckItem(INV_WEAPON, 2 );
B_CheckItem(INV_WEAPON, 3 );
B_CheckItem(INV_WEAPON, 4 );
B_CheckItem(INV_WEAPON, 5 );
B_CheckItem(INV_WEAPON, 6 );
//-------- Durchsuchen von MISC ---------
if( B_CheckItem(INV_MISC, 0 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 1 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 2 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 3 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 4 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 5 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 6 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 7 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 8 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 9 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 10 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 11 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 12 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 13 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 14 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 15 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 16 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 17 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 18 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 19 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 20 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 21 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 22 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 23 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 24 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 25 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 26 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 27 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 28 ) ) { amountPlundered = amountPlundered + 1; };
if( B_CheckItem(INV_MISC, 29 ) ) { amountPlundered = amountPlundered + 1; };
//-------- Anzahl geplünderter Items ausgeben ---------
PrintDebugInt(PD_ZS_CHECK, "...Anzahl geplünderter Items: ", amountPlundered);
//-------- Rückgabewert ---------
return amountPlundered;
};
|
D
|
module aura.operations.bridge;
import std.stdio;
import aura.model.all;
import aura.operation;
import aura.list;
class BridgeOperation : Operation
{
Face f1;
Face f2;
FaceList bridges;
this ( )
{
bridges = new FaceList;
}
void createBridge( Face f1, Face f2 )
{
for ( int a = 0; a < f1.verts.length; a++ )
{
int b = a+1;
if ( b == f1.verts.length ) b = 0; // wrap to start
bridges.append( f1.f_body.addFace( 4, f1.verts[a], f1.verts[b], f2.verts[a], f2.verts[b] ) );
}
}
bool prepare( Selection sel )
{
if ( !Operation.prepare( sel ) )
return false;
auto faces = sel.getFaces( );
// need two faces
if ( faces.length != 2 ) return false;
f1 = faces[0];
f2 = faces[1];
sel.resetSelection( );
createBridge( f1, f2 );
f1.f_body.removeFace( f1 );
f2.f_body.removeFace( f2 );
return false;
}
void update( )
{
}
void complete( )
{
}
void cleanup( )
{
Operation.cleanup( );
}
}
|
D
|
being of the nature of a notion or concept
|
D
|
a neutral middle vowel
|
D
|
import std.algorithm;
import std.math;
import std.mathspecial : erf;
import std.range : iota;
alias reduce!((a, b) => a + b) sumation;
alias reduce!((a, b) => a * b) product;
enum size_t S = 12;
//alias monomial!(1, S) x1; alias monomial!(2, S) x2; alias monomial!(3, S) x3; alias monomial!(4, S) x4;
alias monomial!(5, S) x5; alias monomial!(6, S) x6; alias monomial!(7, S) x7; alias monomial!(8, S) x8;
alias exponential!(.25, S) exp025; alias exponential!(0.5, S) exp050; alias exponential!(1.0, S) exp100; alias exponential!(2.0, S) exp200; alias exponential!(4.0, S) exp400;
//alias cosineProd!(.25, S) cosp025; alias cosineProd!(0.5, S) cosp050; alias cosineProd!(1.0, S) cosp100; alias cosineProd!(2.0, S) cosp200; alias cosineProd!(4.0, S) cosp400;
alias cosineOfSum!(.25, S) coss025; alias cosineOfSum!(0.5, S) coss050; alias cosineOfSum!(1.0, S) coss100; alias cosineOfSum!(2.0, S) coss200; alias cosineOfSum!(4.0, S) coss400;
alias gaussian!(.25, S) gauss025; alias gaussian!(0.5, S) gauss050; alias gaussian!(1.0, S) gauss100; alias gaussian!(2.0, S) gauss200; alias gaussian!(4.0, S) gauss400;
//alias characteristic!(1.0 / 2.0, S) char1o2; alias characteristic!(1.0 / 3.0, S) char1o3; alias characteristic!(.25, S) char1o4; alias characteristic!(.20, S) char1o5; alias characteristic!(1.0 / 6.0, S) char1o6;
//alias sharppp!(1.0 / 2.0, S) sppp1o2; alias sharppp!(1.0 / 3.0, S) sppp1o3; alias sharppp!(.25, S) sppp1o4; alias sharppp!(.20, S) sppp1o5; alias sharppp!(1.0 / 6.0, S) sppp1o6;
alias productPeak!(.25, S) pp025; alias productPeak!(0.5, S) pp050; alias productPeak!(1.0, S) pp100; alias productPeak!(2.0, S) pp200; alias productPeak!(4.0, S) pp400;
alias disconti!S disco;
alias continuous!S conti;
real monomial_int(in size_t u, in size_t s)
{
assert (s);
if (s == 1)
return 1.0 / (u + 1);
return (u + 1).iota().map!(i => monomial_int(u - i, s - 1) * u.combin(i) / (i + 1))().sumation();
}
unittest
{
import std.stdio;
foreach (u; 1..13)
foreach (s; 1..13)
"%d %d -> %.15e".writefln(u, s, u.monomial_int(s));
}
template monomial(size_t u, size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return xs.sumation() ^^ u;
}
enum I = monomial_int(u, s);
}
// a = (large weight; good function) 0.25, 0.5, 1.0, 2.0, 4.0 (small weight; bad function)
template exponential(real a, size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return (xs.sumation() * a).exp();
}
auto I()@property{return (expm1(a) / a) ^^ s;}
}
template cosineProd(real a, size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return xs.map!(x => (a * x).cos())().product();
}
auto I()@property{return (a.sin() / a) ^^ s;}
}
private real combin(size_t n, size_t r)
in
{
assert (r <= n);
}
body
{
if (r * 2 > n)
return n.combin(n - r);
if (r == 0)
return 1;
return r.iota().map!(i => (n - i) / (i + 1.0L)).product();
}
template cosineOfSum(real a, size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return (xs.sumation() * a).cos();
}
auto I()@property
{
return (s + 1).iota().map!(i => ((s & 3) * -PI_2 + a * i).cos() * (-1.0) ^^ (s - i) * combin(s, i))().sumation() / a ^^ s;
}
}
template gaussian(real a, size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return (xs.map!(x => -x * x).sumation() * a).exp();
}
auto I()@property{return (a.sqrt().erf() / (a.sqrt() * M_2_SQRTPI)) ^^ s;}
}
template continuous(size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return xs.map!(x => (3 * x).min((3 * x - 2).abs()))().product();
}
auto I()@property{return 0.5 ^^ s;}
}
template disconti(size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return xs.map!((real x) => (((1 <= 3 * x) && (3 * x < 2)) ? -1.0 : 1.0))().product();
}
auto I()@property{return (1.0/3.0) ^^ s;}
}
// a = 1/3 and binary rational
template characteristic(real a, size_t s)
{
real f(in real[] xs)
in
{
assert (xs.length == s);
}
body
{
return xs.map!(x => x < a ? -1 : 1).product();
}
auto I()@property{return (1 - 2 * a) ^^ s;}
}
// a = 1/3 and binary rational
template sharppp(real a, size_t s)
{
real f(in real[] xs)
{
return xs.map!(x => (x - a).abs()).product();
}
auto I()@property{return (0.5 + a * a - a) ^^ s;}
}
// genz' product peak with u = 0 and a
template productPeak(real a, size_t s)
{
real f(in real[] xs)
{
return 1 / xs.map!(x => a * x * x + 1).product();
}
auto I()@property{return (a.sqrt().atan() / a.sqrt()) ^^ s;}
}
|
D
|
/home/philip/LearnDemo/rust-lang-book/Chapter06/Enum6_3/Enum6_6/target/debug/deps/Enum6_6-25f9d6572a6700cc.rmeta: src/main.rs
/home/philip/LearnDemo/rust-lang-book/Chapter06/Enum6_3/Enum6_6/target/debug/deps/Enum6_6-25f9d6572a6700cc.d: src/main.rs
src/main.rs:
|
D
|
/home/alifya/Rocket-TodoApp/target/debug/build/rocket_codegen-c7624fb61dac6b5a/build_script_build-c7624fb61dac6b5a: /home/alifya/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket_codegen-0.4.4/build.rs
/home/alifya/Rocket-TodoApp/target/debug/build/rocket_codegen-c7624fb61dac6b5a/build_script_build-c7624fb61dac6b5a.d: /home/alifya/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket_codegen-0.4.4/build.rs
/home/alifya/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket_codegen-0.4.4/build.rs:
|
D
|
on the contrary
to some (great or small) extent
more readily or willingly
to a degree (not used with a negative
|
D
|
module android.java.android.app.Notification_DecoratedCustomViewStyle;
public import android.java.android.app.Notification_DecoratedCustomViewStyle_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!Notification_DecoratedCustomViewStyle;
import import2 = android.java.java.lang.Class;
import import1 = android.java.android.app.Notification;
|
D
|
a male sovereign
|
D
|
//var int Rethon_ItemsGiven_Chapter_1;
//var int Rethon_ItemsGiven_Chapter_2;
//var int Rethon_ItemsGiven_Chapter_3;
var int Rethon_ItemsGiven_Chapter_4;
var int Rethon_ItemsGiven_Chapter_5;
func void B_GiveTradeInv_Rethon(var C_Npc slf)
{
if((Kapitel >= 4) && (Rethon_ItemsGiven_Chapter_4 == FALSE))
{
CreateInvItems(slf,ItMw_Inquisitor,1);
CreateInvItems(slf,ItMw_Streitaxt2,1);
CreateInvItems(slf,ItMw_Kriegshammer2,1);
CreateInvItems(slf,ItMw_Orkschlaechter,1);
CreateInvItems(slf,ItMw_Folteraxt,1);
// CreateInvItems(slf,ItMw_Krummschwert,1);
// CreateInvItems(slf,ItMw_Barbarenstreitaxt,1);
// CreateInvItems(slf,ItMw_Berserkeraxt,1);
Rethon_ItemsGiven_Chapter_4 = TRUE;
};
if((Kapitel >= 5) && (Rethon_ItemsGiven_Chapter_5 == FALSE))
{
CreateInvItems(slf,ItMw_Barbarenstreitaxt,1);
// CreateInvItems(slf,ItMw_Berserkeraxt,1);
CreateInvItems(slf,ItMw_Warrioraxt,1);
Rethon_ItemsGiven_Chapter_5 = TRUE;
};
};
|
D
|
module kerisy.provider;
public import kerisy.provider.AuthServiceProvider;
public import kerisy.provider.BreadcrumbServiceProvider;
public import kerisy.provider.CacheServiceProvider;
public import kerisy.provider.ConfigServiceProvider;
// public import kerisy.provider.DatabaseServiceProvider;
// public import kerisy.provider.GrpcServiceProvider;
public import kerisy.provider.HttpServiceProvider;
public import kerisy.provider.QueueServiceProvider;
public import kerisy.provider.RedisServiceProvider;
public import kerisy.provider.ServiceProvider;
public import kerisy.provider.SessionServiceProvider;
public import kerisy.provider.TaskServiceProvider;
public import kerisy.provider.TranslationServiceProvider;
public import kerisy.provider.UserServiceProvider;
public import kerisy.provider.ViewServiceProvider;
public import kerisy.provider.listener;
|
D
|
/Users/macexpert/Downloads/CommuniSki/Build/Intermediates.noindex/CommuniSki.build/Debug-iphonesimulator/CommuniSki.build/Objects-normal/x86_64/SignUpVC.o : /Users/macexpert/Downloads/CommuniSki/CommuniSki/ProfileVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/LoginVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SignUpVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TabbarVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TermsandConditionsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SkiGroupsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SideMenuVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/IQKeyboardManagerSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/SideMenuSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenu.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/module.modulemap /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/macexpert/Downloads/CommuniSki/Build/Intermediates.noindex/CommuniSki.build/Debug-iphonesimulator/CommuniSki.build/Objects-normal/x86_64/SignUpVC~partial.swiftmodule : /Users/macexpert/Downloads/CommuniSki/CommuniSki/ProfileVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/LoginVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SignUpVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TabbarVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TermsandConditionsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SkiGroupsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SideMenuVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/IQKeyboardManagerSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/SideMenuSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenu.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/module.modulemap /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/macexpert/Downloads/CommuniSki/Build/Intermediates.noindex/CommuniSki.build/Debug-iphonesimulator/CommuniSki.build/Objects-normal/x86_64/SignUpVC~partial.swiftdoc : /Users/macexpert/Downloads/CommuniSki/CommuniSki/ProfileVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/LoginVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SignUpVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TabbarVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TermsandConditionsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SkiGroupsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SideMenuVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/IQKeyboardManagerSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/SideMenuSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenu.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/module.modulemap /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/macexpert/Downloads/CommuniSki/Build/Intermediates.noindex/CommuniSki.build/Debug-iphonesimulator/CommuniSki.build/Objects-normal/x86_64/SignUpVC~partial.swiftsourceinfo : /Users/macexpert/Downloads/CommuniSki/CommuniSki/ProfileVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/LoginVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SignUpVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TabbarVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/TermsandConditionsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SkiGroupsVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/SideMenuVC.swift /Users/macexpert/Downloads/CommuniSki/CommuniSki/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/IQKeyboardManagerSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/SideMenuSwift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-umbrella.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers/IQKeyboardManagerSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenuSwift-Swift.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Headers/SideMenu.h /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Modules/module.modulemap /Users/macexpert/Downloads/CommuniSki/Build/Products/Debug-iphonesimulator/SideMenuSwift/SideMenuSwift.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
/** uuids.d
Converted from 'uuids.h'.
Version: V7.0
Authors: Koji Kishita
*/
module c.windows.uuids;
import c.windows.guiddef;
alias GUID_NULL MEDIATYPE_NULL;
alias GUID_NULL MEDIASUBTYPE_NULL;
mixin DEFINE_GUID!("MEDIASUBTYPE_None", 0xe436eb8e, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIATYPE_Video", 0x73646976, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_Audio", 0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_Text", 0x73747874, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_Midi", 0x7364696D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_Stream", 0xe436eb83, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIATYPE_Interleaved", 0x73766169, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_File", 0x656c6966, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_ScriptCommand", 0x73636d64, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_AUXLine21Data", 0x670aea80, 0x3a82, 0x11d0, 0xb7, 0x9b, 0x0, 0xaa, 0x0, 0x37, 0x67, 0xa7);
mixin DEFINE_GUID!("MEDIATYPE_AUXTeletextPage", 0x11264acb, 0x37de, 0x4eba, 0x8c, 0x35, 0x7f, 0x4, 0xa1, 0xa6, 0x83, 0x32);
mixin DEFINE_GUID!("MEDIATYPE_CC_CONTAINER", 0xaeb312e9, 0x3357, 0x43ca, 0xb7, 0x1, 0x97, 0xec, 0x19, 0x8e, 0x2b, 0x62);
mixin DEFINE_GUID!("MEDIATYPE_DTVCCData", 0xfb77e152, 0x53b2, 0x499c, 0xb4, 0x6b, 0x50, 0x9f, 0xc3, 0x3e, 0xdf, 0xd7);
mixin DEFINE_GUID!("MEDIATYPE_MSTVCaption", 0xB88B8A89, 0xB049, 0x4C80, 0xAD, 0xCF, 0x58, 0x98, 0x98, 0x5E, 0x22, 0xC1);
mixin DEFINE_GUID!("MEDIATYPE_VBI", 0xf72a76e1, 0xeb0a, 0x11d0, 0xac, 0xe4, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("MEDIASUBTYPE_DVB_SUBTITLES", 0x34FFCBC3, 0xD5B3, 0x4171, 0x90, 0x02, 0xD4, 0xC6, 0x03, 0x01, 0x69, 0x7F);
mixin DEFINE_GUID!("MEDIASUBTYPE_ISDB_CAPTIONS", 0x059dd67d, 0x2e55, 0x4d41, 0x8d, 0x1b, 0x01, 0xf5, 0xe4, 0xf5, 0x06, 0x07);
mixin DEFINE_GUID!("MEDIASUBTYPE_ISDB_SUPERIMPOSE", 0x36dc6d28, 0xf1a6, 0x4216, 0x90, 0x48, 0x9c, 0xfc, 0xef, 0xeb, 0x5e, 0xba);
mixin DEFINE_GUID!("MEDIATYPE_Timecode", 0x482dee3, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIATYPE_LMRT", 0x74726c6d, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_URL_STREAM", 0x736c7275, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_CLPL", 0x4C504C43, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_YUYV", 0x56595559, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IYUV", 0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_YVU9", 0x39555659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Y411", 0x31313459, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Y41P", 0x50313459, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_YUY2", 0x32595559, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_YVYU", 0x55595659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_UYVY", 0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Y211", 0x31313259, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_CLJR", 0x524a4c43, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IF09", 0x39304649, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_CPLA", 0x414c5043, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_MJPG", 0x47504A4D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_TVMJ", 0x4A4D5654, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_WAKE", 0x454B4157, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_CFCC", 0x43434643, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IJPG", 0x47504A49, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Plum", 0x6D756C50, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_DVCS", 0x53435644, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_H264", 0x34363248, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_DVSD", 0x44535644, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_MDVF", 0x4656444D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB1", 0xe436eb78, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB4", 0xe436eb79, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB8", 0xe436eb7a, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB565", 0xe436eb7b, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB555", 0xe436eb7c, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB24", 0xe436eb7d, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB32", 0xe436eb7e, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB1555", 0x297c55af, 0xe209, 0x4cb3, 0xb7, 0x57, 0xc7, 0x6d, 0x6b, 0x9c, 0x88, 0xa8);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB4444", 0x6e6415e6, 0x5c24, 0x425f, 0x93, 0xcd, 0x80, 0x10, 0x2b, 0x3d, 0x1c, 0xca);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB32", 0x773c9ac0, 0x3274, 0x11d0, 0xb7, 0x24, 0x0, 0xaa, 0x0, 0x6c, 0x1a, 0x1 );
mixin DEFINE_GUID!("MEDIASUBTYPE_A2R10G10B10", 0x2f8bb76d, 0xb644, 0x4550, 0xac, 0xf3, 0xd3, 0x0c, 0xaa, 0x65, 0xd5, 0xc5);
mixin DEFINE_GUID!("MEDIASUBTYPE_A2B10G10R10", 0x576f7893, 0xbdf6, 0x48c4, 0x87, 0x5f, 0xae, 0x7b, 0x81, 0x83, 0x45, 0x67);
mixin DEFINE_GUID!("MEDIASUBTYPE_AYUV", 0x56555941, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_AI44", 0x34344941, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IA44", 0x34344149, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB32_D3D_DX7_RT", 0x32335237, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB16_D3D_DX7_RT", 0x36315237, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB32_D3D_DX7_RT", 0x38384137, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB4444_D3D_DX7_RT", 0x34344137, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB1555_D3D_DX7_RT", 0x35314137, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB32_D3D_DX9_RT", 0x32335239, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_RGB16_D3D_DX9_RT", 0x36315239, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB32_D3D_DX9_RT", 0x38384139, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB4444_D3D_DX9_RT", 0x34344139, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_ARGB1555_D3D_DX9_RT", 0x35314139, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
//#define MEDIASUBTYPE_HASALPHA(mt) ( ((mt).subtype == MEDIASUBTYPE_ARGB4444) || ((mt).subtype == MEDIASUBTYPE_ARGB32) || ((mt).subtype == MEDIASUBTYPE_AYUV) || ((mt).subtype == MEDIASUBTYPE_AI44) || ((mt).subtype == MEDIASUBTYPE_IA44) || ((mt).subtype == MEDIASUBTYPE_ARGB1555) || ((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX9_RT) );
//#define MEDIASUBTYPE_HASALPHA7(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT) );
//#define MEDIASUBTYPE_D3D_DX7_RT(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_RGB32_D3D_DX7_RT) || ((mt).subtype == MEDIASUBTYPE_RGB16_D3D_DX7_RT));
//#define MEDIASUBTYPE_HASALPHA9(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX9_RT) );
//#define MEDIASUBTYPE_D3D_DX9_RT(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_RGB32_D3D_DX9_RT) || ((mt).subtype == MEDIASUBTYPE_RGB16_D3D_DX9_RT));
mixin DEFINE_GUID!("MEDIASUBTYPE_YV12", 0x32315659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_NV12", 0x3231564E, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_NV11", 0x3131564E, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_P208", ('8' << 24) | ('0' << 16) | ('2' << 8) | 'P', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_P210", ('0' << 24) | ('1' << 16) | ('2' << 8) | 'P', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_P216", ('6' << 24) | ('1' << 26) | ('2' << 8) | 'P', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_P010", ('0' << 24) | ('1' << 16) | ('0' << 8) | 'P', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_P016", ('6' << 24) | ('1' << 16) | ('0' << 8) | 'P', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Y210", ('0' << 24) | ('1' << 16) | ('2' << 8) | 'Y', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Y216", ('6' << 24) | ('1' << 16) | ('2' << 8) | 'Y', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_P408", ('8' << 24) | ('0' << 16) | ('4' << 8) | 'P', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_NV24", 0x3432564E, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IMC1", 0x31434D49, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IMC2", 0x32434D49, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IMC3", 0x33434D49, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IMC4", 0x34434D49, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_S340", 0x30343353, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_S342", 0x32343353, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Overlay", 0xe436eb7f, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1Packet", 0xe436eb80, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1Payload", 0xe436eb81, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1AudioPayload", 0x00000050, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71);
mixin DEFINE_GUID!("MEDIATYPE_MPEG1SystemStream", 0xe436eb82, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1System", 0xe436eb84, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1VideoCD", 0xe436eb85, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1Video", 0xe436eb86, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_MPEG1Audio", 0xe436eb87, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_Avi", 0xe436eb88, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_Asf", 0x3db80f90, 0x9412, 0x11d1, 0xad, 0xed, 0x0, 0x0, 0xf8, 0x75, 0x4b, 0x99);
mixin DEFINE_GUID!("MEDIASUBTYPE_QTMovie", 0xe436eb89, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_QTRpza", 0x617a7072, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_QTSmc", 0x20636d73, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_QTRle", 0x20656c72, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_QTJpeg", 0x6765706a, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_PCMAudio_Obsolete", 0xe436eb8a, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_PCM", 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_WAVE", 0xe436eb8b, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_AU", 0xe436eb8c, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_AIFF", 0xe436eb8d, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("MEDIASUBTYPE_dvsd", 0x64737664, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_dvhd", 0x64687664, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_dvsl", 0x6c737664, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_dv25", 0x35327664, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_dv50", 0x30357664, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_dvh1", 0x31687664, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_Line21_BytePair", 0x6e8d4a22, 0x310c, 0x11d0, 0xb7, 0x9a, 0x0, 0xaa, 0x0, 0x37, 0x67, 0xa7);
mixin DEFINE_GUID!("MEDIASUBTYPE_Line21_GOPPacket", 0x6e8d4a23, 0x310c, 0x11d0, 0xb7, 0x9a, 0x0, 0xaa, 0x0, 0x37, 0x67, 0xa7);
mixin DEFINE_GUID!("MEDIASUBTYPE_Line21_VBIRawData", 0x6e8d4a24, 0x310c, 0x11d0, 0xb7, 0x9a, 0x0, 0xaa, 0x0, 0x37, 0x67, 0xa7);
mixin DEFINE_GUID!("MEDIASUBTYPE_708_608Data", 0xaf414bc, 0x4ed2, 0x445e, 0x98, 0x39, 0x8f, 0x9, 0x55, 0x68, 0xab, 0x3c);
mixin DEFINE_GUID!("MEDIASUBTYPE_DtvCcData", 0xF52ADDAA, 0x36F0, 0x43F5, 0x95, 0xEA, 0x6D, 0x86, 0x64, 0x84, 0x26, 0x2A);
mixin DEFINE_GUID!("MEDIASUBTYPE_CC_CONTAINER", 0x7ea626db, 0x54da, 0x437b, 0xbe, 0x9f, 0xf7, 0x30, 0x73, 0xad, 0xfa, 0x3c);
mixin DEFINE_GUID!("MEDIASUBTYPE_TELETEXT", 0xf72a76e3, 0xeb0a, 0x11d0, 0xac, 0xe4, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("MEDIASUBTYPE_VBI", 0x663da43c, 0x3e8, 0x4e9a, 0x9c, 0xd5, 0xbf, 0x11, 0xed, 0xd, 0xef, 0x76);
mixin DEFINE_GUID!("MEDIASUBTYPE_WSS", 0x2791D576, 0x8E7A, 0x466F, 0x9E, 0x90, 0x5D, 0x3F, 0x30, 0x83, 0x73, 0x8B);
mixin DEFINE_GUID!("MEDIASUBTYPE_XDS", 0x1ca73e3, 0xdce6, 0x4575, 0xaf, 0xe1, 0x2b, 0xf1, 0xc9, 0x2, 0xca, 0xf3);
mixin DEFINE_GUID!("MEDIASUBTYPE_VPS", 0xa1b3f620, 0x9792, 0x4d8d, 0x81, 0xa4, 0x86, 0xaf, 0x25, 0x77, 0x20, 0x90);
mixin DEFINE_GUID!("MEDIASUBTYPE_DRM_Audio", 0x00000009, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_IEEE_FLOAT", 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_DOLBY_AC3_SPDIF", 0x00000092, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_RAW_SPORT", 0x00000240, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_SPDIF_TAG_241h", 0x00000241, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
mixin DEFINE_GUID!("MEDIASUBTYPE_DssVideo", 0xa0af4f81, 0xe163, 0x11d0, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("MEDIASUBTYPE_DssAudio", 0xa0af4f82, 0xe163, 0x11d0, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("MEDIASUBTYPE_VPVideo", 0x5a9b6a40, 0x1a22, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("MEDIASUBTYPE_VPVBI", 0x5a9b6a41, 0x1a22, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("CLSID_CaptureGraphBuilder", 0xBF87B6E0, 0x8C27, 0x11d0, 0xB3, 0xF0, 0x0, 0xAA, 0x00, 0x37, 0x61, 0xC5);
mixin DEFINE_GUID!("CLSID_CaptureGraphBuilder2", 0xBF87B6E1, 0x8C27, 0x11d0, 0xB3, 0xF0, 0x0, 0xAA, 0x00, 0x37, 0x61, 0xC5);
mixin DEFINE_GUID!("CLSID_ProtoFilterGraph", 0xe436ebb0, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_SystemClock", 0xe436ebb1, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_FilterMapper", 0xe436ebb2, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_FilterGraph", 0xe436ebb3, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_FilterGraphNoThread", 0xe436ebb8, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_FilterGraphPrivateThread", 0xa3ecbc41, 0x581a, 0x4476, 0xb6, 0x93, 0xa6, 0x33, 0x40, 0x46, 0x2d, 0x8b);
mixin DEFINE_GUID!("CLSID_MPEG1Doc", 0xe4bbd160, 0x4269, 0x11ce, 0x83, 0x8d, 0x0, 0xaa, 0x0, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("CLSID_FileSource", 0x701722e0, 0x8ae3, 0x11ce, 0xa8, 0x5c, 0x00, 0xaa, 0x00, 0x2f, 0xea, 0xb5);
mixin DEFINE_GUID!("CLSID_MPEG1PacketPlayer", 0x26c25940, 0x4ca9, 0x11ce, 0xa8, 0x28, 0x0, 0xaa, 0x0, 0x2f, 0xea, 0xb5);
mixin DEFINE_GUID!("CLSID_MPEG1Splitter", 0x336475d0, 0x942a, 0x11ce, 0xa8, 0x70, 0x00, 0xaa, 0x00, 0x2f, 0xea, 0xb5);
mixin DEFINE_GUID!("CLSID_CMpegVideoCodec", 0xfeb50740, 0x7bef, 0x11ce, 0x9b, 0xd9, 0x0, 0x0, 0xe2, 0x2, 0x59, 0x9c);
mixin DEFINE_GUID!("CLSID_CMpegAudioCodec", 0x4a2286e0, 0x7bef, 0x11ce, 0x9b, 0xd9, 0x0, 0x0, 0xe2, 0x2, 0x59, 0x9c);
mixin DEFINE_GUID!("CLSID_TextRender", 0xe30629d3, 0x27e5, 0x11ce, 0x87, 0x5d, 0x0, 0x60, 0x8c, 0xb7, 0x80, 0x66);
mixin DEFINE_GUID!("CLSID_InfTee", 0xf8388a40, 0xd5bb, 0x11d0, 0xbe, 0x5a, 0x0, 0x80, 0xc7, 0x6, 0x56, 0x8e);
mixin DEFINE_GUID!("CLSID_AviSplitter", 0x1b544c20, 0xfd0b, 0x11ce, 0x8c, 0x63, 0x0, 0xaa, 0x00, 0x44, 0xb5, 0x1e);
mixin DEFINE_GUID!("CLSID_AviReader", 0x1b544c21, 0xfd0b, 0x11ce, 0x8c, 0x63, 0x0, 0xaa, 0x00, 0x44, 0xb5, 0x1e);
mixin DEFINE_GUID!("CLSID_VfwCapture", 0x1b544c22, 0xfd0b, 0x11ce, 0x8c, 0x63, 0x0, 0xaa, 0x00, 0x44, 0xb5, 0x1e);
mixin DEFINE_GUID!("CLSID_CaptureProperties", 0x1B544c22, 0xFD0B, 0x11ce, 0x8C, 0x63, 0x00, 0xAA, 0x00, 0x44, 0xB5, 0x1F);
mixin DEFINE_GUID!("CLSID_FGControl", 0xe436ebb4, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_MOVReader", 0x44584800, 0xf8ee, 0x11ce, 0xb2, 0xd4, 0x00, 0xdd, 0x1, 0x10, 0x1b, 0x85);
mixin DEFINE_GUID!("CLSID_QuickTimeParser", 0xd51bd5a0, 0x7548, 0x11cf, 0xa5, 0x20, 0x0, 0x80, 0xc7, 0x7e, 0xf5, 0x8a);
mixin DEFINE_GUID!("CLSID_QTDec", 0xfdfe9681, 0x74a3, 0x11d0, 0xaf, 0xa7, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_AVIDoc", 0xd3588ab0, 0x0781, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0xb, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_VideoRenderer", 0x70e102b0, 0x5556, 0x11ce, 0x97, 0xc0, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("CLSID_Colour", 0x1643e180, 0x90f5, 0x11ce, 0x97, 0xd5, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("CLSID_Dither", 0x1da08500, 0x9edc, 0x11cf, 0xbc, 0x10, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("CLSID_ModexRenderer", 0x7167665, 0x5011, 0x11cf, 0xbf, 0x33, 0x0, 0xaa, 0x0, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("CLSID_AudioRender", 0xe30629d1, 0x27e5, 0x11ce, 0x87, 0x5d, 0x0, 0x60, 0x8c, 0xb7, 0x80, 0x66);
mixin DEFINE_GUID!("CLSID_AudioProperties", 0x05589faf, 0xc356, 0x11ce, 0xbf, 0x01, 0x0, 0xaa, 0x0, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("CLSID_DSoundRender", 0x79376820, 0x07D0, 0x11CF, 0xA2, 0x4D, 0x0, 0x20, 0xAF, 0xD7, 0x97, 0x67);
mixin DEFINE_GUID!("CLSID_AudioRecord", 0xe30629d2, 0x27e5, 0x11ce, 0x87, 0x5d, 0x0, 0x60, 0x8c, 0xb7, 0x80, 0x66);
mixin DEFINE_GUID!("CLSID_AudioInputMixerProperties", 0x2ca8ca52, 0x3c3f, 0x11d2, 0xb7, 0x3d, 0x0, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d);
mixin DEFINE_GUID!("CLSID_AVIDec", 0xcf49d4e0, 0x1115, 0x11ce, 0xb0, 0x3a, 0x0, 0x20, 0xaf, 0xb, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_AVIDraw", 0xa888df60, 0x1e90, 0x11cf, 0xac, 0x98, 0x0, 0xaa, 0x0, 0x4c, 0xf, 0xa9);
mixin DEFINE_GUID!("CLSID_ACMWrapper", 0x6a08cf80, 0x0e18, 0x11cf, 0xa2, 0x4d, 0x0, 0x20, 0xaf, 0xd7, 0x97, 0x67);
mixin DEFINE_GUID!("CLSID_AsyncReader", 0xe436ebb5, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_URLReader", 0xe436ebb6, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_PersistMonikerPID", 0xe436ebb7, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
mixin DEFINE_GUID!("CLSID_AVICo", 0xd76e2820, 0x1563, 0x11cf, 0xac, 0x98, 0x0, 0xaa, 0x0, 0x4c, 0xf, 0xa9);
mixin DEFINE_GUID!("CLSID_FileWriter", 0x8596e5f0, 0xda5, 0x11d0, 0xbd, 0x21, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_AviDest", 0xe2510970, 0xf137, 0x11ce, 0x8b, 0x67, 0x0, 0xaa, 0x0, 0xa3, 0xf1, 0xa6);
mixin DEFINE_GUID!("CLSID_AviMuxProptyPage", 0xc647b5c0, 0x157c, 0x11d0, 0xbd, 0x23, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_AviMuxProptyPage1", 0xa9ae910, 0x85c0, 0x11d0, 0xbd, 0x42, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_AVIMIDIRender", 0x07b65360, 0xc445, 0x11ce, 0xaf, 0xde, 0x00, 0xaa, 0x00, 0x6c, 0x14, 0xf4);
mixin DEFINE_GUID!("CLSID_WMAsfReader", 0x187463a0, 0x5bb7, 0x11d3, 0xac, 0xbe, 0x0, 0x80, 0xc7, 0x5e, 0x24, 0x6e);
mixin DEFINE_GUID!("CLSID_WMAsfWriter", 0x7c23220e, 0x55bb, 0x11d3, 0x8b, 0x16, 0x0, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d);
mixin DEFINE_GUID!("CLSID_MPEG2Demultiplexer", 0xafb6c280, 0x2c41, 0x11d3, 0x8a, 0x60, 0x00, 0x00, 0xf8, 0x1e, 0x0e, 0x4a);
mixin DEFINE_GUID!("CLSID_MPEG2Demultiplexer_NoClock", 0x687d3367, 0x3644, 0x467a, 0xad, 0xfe, 0x6c, 0xd7, 0xa8, 0x5c, 0x4a, 0x2c);
mixin DEFINE_GUID!("CLSID_MMSPLITTER", 0x3ae86b20, 0x7be8, 0x11d1, 0xab, 0xe6, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75);
mixin DEFINE_GUID!("CLSID_StreamBufferSink", 0x2db47ae5, 0xcf39, 0x43c2, 0xb4, 0xd6, 0xc, 0xd8, 0xd9, 0x9, 0x46, 0xf4);
mixin DEFINE_GUID!("CLSID_SBE2Sink", 0xe2448508, 0x95da, 0x4205, 0x9a, 0x27, 0x7e, 0xc8, 0x1e, 0x72, 0x3b, 0x1a);
mixin DEFINE_GUID!("CLSID_StreamBufferSource", 0xc9f5fe02, 0xf851, 0x4eb5, 0x99, 0xee, 0xad, 0x60, 0x2a, 0xf1, 0xe6, 0x19);
mixin DEFINE_GUID!("CLSID_StreamBufferConfig", 0xfa8a68b2, 0xc864, 0x4ba2, 0xad, 0x53, 0xd3, 0x87, 0x6a, 0x87, 0x49, 0x4b);
mixin DEFINE_GUID!("CLSID_StreamBufferPropertyHandler", 0xe37a73f8, 0xfb01, 0x43dc, 0x91, 0x4e, 0xaa, 0xee, 0x76, 0x9, 0x5a, 0xb9);
mixin DEFINE_GUID!("CLSID_StreamBufferThumbnailHandler", 0x713790ee, 0x5ee1, 0x45ba, 0x80, 0x70, 0xa1, 0x33, 0x7d, 0x27, 0x62, 0xfa);
mixin DEFINE_GUID!("CLSID_Mpeg2VideoStreamAnalyzer", 0x6cfad761, 0x735d, 0x4aa5, 0x8a, 0xfc, 0xaf, 0x91, 0xa7, 0xd6, 0x1e, 0xba);
mixin DEFINE_GUID!("CLSID_StreamBufferRecordingAttributes", 0xccaa63ac, 0x1057, 0x4778, 0xae, 0x92, 0x12, 0x6, 0xab, 0x9a, 0xce, 0xe6);
mixin DEFINE_GUID!("CLSID_StreamBufferComposeRecording", 0xd682c4ba, 0xa90a, 0x42fe, 0xb9, 0xe1, 0x3, 0x10, 0x98, 0x49, 0xc4, 0x23);
mixin DEFINE_GUID!("CLSID_SBE2File", 0x93a094d7, 0x51e8, 0x485b, 0x90, 0x4a, 0x8d, 0x6b, 0x97, 0xdc, 0x6b, 0x39);
mixin DEFINE_GUID!("CLSID_DVVideoCodec", 0xb1b77c00, 0xc3e4, 0x11cf, 0xaf, 0x79, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_DVVideoEnc", 0x13aa3650, 0xbb6f, 0x11d0, 0xaf, 0xb9, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_DVSplitter", 0x4eb31670, 0x9fc6, 0x11cf, 0xaf, 0x6e, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_DVMux", 0x129d7e40, 0xc10d, 0x11d0, 0xaf, 0xb9, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_SeekingPassThru", 0x60af76c, 0x68dd, 0x11d0, 0x8f, 0xc1, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);
mixin DEFINE_GUID!("CLSID_Line21Decoder", 0x6e8d4a20, 0x310c, 0x11d0, 0xb7, 0x9a, 0x0, 0xaa, 0x0, 0x37, 0x67, 0xa7);
mixin DEFINE_GUID!("CLSID_Line21Decoder2", 0xe4206432, 0x01a1, 0x4bee, 0xb3, 0xe1, 0x37, 0x02, 0xc8, 0xed, 0xc5, 0x74);
mixin DEFINE_GUID!("CLSID_CCAFilter", 0x3d07a539, 0x35ca, 0x447c, 0x9b, 0x5, 0x8d, 0x85, 0xce, 0x92, 0x4f, 0x9e);
mixin DEFINE_GUID!("CLSID_OverlayMixer", 0xcd8743a1, 0x3736, 0x11d0, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("CLSID_VBISurfaces", 0x814b9800, 0x1c88, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("CLSID_WSTDecoder", 0x70bc06e0, 0x5666, 0x11d3, 0xa1, 0x84, 0x0, 0x10, 0x5a, 0xef, 0x9f, 0x33);
mixin DEFINE_GUID!("CLSID_MjpegDec", 0x301056d0, 0x6dff, 0x11d2, 0x9e, 0xeb, 0x0, 0x60, 0x8, 0x3, 0x9e, 0x37);
mixin DEFINE_GUID!("CLSID_MJPGEnc", 0xb80ab0a0, 0x7416, 0x11d2, 0x9e, 0xeb, 0x0, 0x60, 0x8, 0x3, 0x9e, 0x37);
mixin DEFINE_GUID!("CLSID_SystemDeviceEnum", 0x62BE5D10,0x60EB,0x11d0,0xBD,0x3B,0x00,0xA0,0xC9,0x11,0xCE,0x86);
mixin DEFINE_GUID!("CLSID_CDeviceMoniker", 0x4315D437,0x5B8C,0x11d0,0xBD,0x3B,0x00,0xA0,0xC9,0x11,0xCE,0x86);
mixin DEFINE_GUID!("CLSID_VideoInputDeviceCategory", 0x860BB310,0x5D01,0x11d0,0xBD,0x3B,0x00,0xA0,0xC9,0x11,0xCE,0x86);
mixin DEFINE_GUID!("CLSID_CVidCapClassManager", 0x860BB310,0x5D01,0x11d0,0xBD,0x3B,0x00,0xA0,0xC9,0x11,0xCE,0x86);
mixin DEFINE_GUID!("CLSID_LegacyAmFilterCategory", 0x083863F1,0x70DE,0x11d0,0xBD,0x40,0x00,0xA0,0xC9,0x11,0xCE,0x86);
mixin DEFINE_GUID!("CLSID_CQzFilterClassManager", 0x083863F1,0x70DE,0x11d0,0xBD,0x40,0x00,0xA0,0xC9,0x11,0xCE,0x86);
mixin DEFINE_GUID!("CLSID_VideoCompressorCategory", 0x33d9a760, 0x90c8, 0x11d0, 0xbd, 0x43, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_CIcmCoClassManager", 0x33d9a760, 0x90c8, 0x11d0, 0xbd, 0x43, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_AudioCompressorCategory", 0x33d9a761, 0x90c8, 0x11d0, 0xbd, 0x43, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_CAcmCoClassManager", 0x33d9a761, 0x90c8, 0x11d0, 0xbd, 0x43, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_AudioInputDeviceCategory", 0x33d9a762, 0x90c8, 0x11d0, 0xbd, 0x43, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_CWaveinClassManager", 0x33d9a762, 0x90c8, 0x11d0, 0xbd, 0x43, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_AudioRendererCategory", 0xe0f158e1, 0xcb04, 0x11d0, 0xbd, 0x4e, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_CWaveOutClassManager", 0xe0f158e1, 0xcb04, 0x11d0, 0xbd, 0x4e, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_MidiRendererCategory", 0x4EfE2452, 0x168A, 0x11d1, 0xBC, 0x76, 0x0, 0xc0, 0x4F, 0xB9, 0x45, 0x3B);
mixin DEFINE_GUID!("CLSID_CMidiOutClassManager", 0x4EfE2452, 0x168A, 0x11d1, 0xBC, 0x76, 0x0, 0xc0, 0x4F, 0xB9, 0x45, 0x3B);
mixin DEFINE_GUID!("CLSID_TransmitCategory", 0xcc7bfb41, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
mixin DEFINE_GUID!("CLSID_DeviceControlCategory", 0xcc7bfb46, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
mixin DEFINE_GUID!("CLSID_ActiveMovieCategories", 0xda4e3da0, 0xd07d, 0x11d0, 0xbd, 0x50, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_DVDHWDecodersCategory", 0x2721AE20, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00);
mixin DEFINE_GUID!("CLSID_MediaEncoderCategory", 0x7D22E920, 0x5CA9, 0x4787, 0x8C, 0x2B, 0xA6, 0x77, 0x9B, 0xD1, 0x17, 0x81);
mixin DEFINE_GUID!("CLSID_MediaMultiplexerCategory", 0x236C9559, 0xADCE, 0x4736, 0xBF, 0x72, 0xBA, 0xB3, 0x4E, 0x39, 0x21, 0x96);
mixin DEFINE_GUID!("CLSID_FilterMapper2", 0xcda42200, 0xbd88, 0x11d0, 0xbd, 0x4e, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_MemoryAllocator", 0x1e651cc0, 0xb199, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);
mixin DEFINE_GUID!("CLSID_MediaPropertyBag", 0xcdbd8d00, 0xc193, 0x11d0, 0xbd, 0x4e, 0x0, 0xa0, 0xc9, 0x11, 0xce, 0x86);
mixin DEFINE_GUID!("CLSID_DvdGraphBuilder", 0xFCC152B7, 0xF372, 0x11d0, 0x8E, 0x00, 0x00, 0xC0, 0x4F, 0xD7, 0xC0, 0x8B);
mixin DEFINE_GUID!("CLSID_DVDNavigator", 0x9b8c4620, 0x2c1a, 0x11d0, 0x84, 0x93, 0x0, 0xa0, 0x24, 0x38, 0xad, 0x48);
mixin DEFINE_GUID!("CLSID_DVDState", 0xf963c5cf, 0xa659, 0x4a93, 0x96, 0x38, 0xca, 0xf3, 0xcd, 0x27, 0x7d, 0x13);
mixin DEFINE_GUID!("CLSID_SmartTee", 0xcc58e280, 0x8aa1, 0x11d1, 0xb3, 0xf1, 0x0, 0xaa, 0x0, 0x37, 0x61, 0xc5);
mixin DEFINE_GUID!("CLSID_DtvCcFilter", 0xfb056ba0, 0x2502, 0x45b9, 0x8e, 0x86, 0x2b, 0x40, 0xde, 0x84, 0xad, 0x29);
mixin DEFINE_GUID!("CLSID_CaptionsFilter", 0x2F7EE4B6, 0x6FF5, 0x4EB4, 0xB2, 0x4A, 0x2B, 0xFC, 0x41, 0x11, 0x71, 0x71);
mixin DEFINE_GUID!("CLSID_SubtitlesFilter", 0x9f22cfea, 0xce07, 0x41ab, 0x8b, 0xa0, 0xc7, 0x36, 0x4a, 0xf9, 0x0a, 0xf9);
mixin DEFINE_GUID!("CLSID_DirectShowPluginControl", 0x8670c736, 0xf614, 0x427b, 0x8a, 0xda, 0xbb, 0xad, 0xc5, 0x87, 0x19, 0x4b);
mixin DEFINE_GUID!("FORMAT_None", 0x0F6417D6, 0xc318, 0x11d0, 0xa4, 0x3f, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96);
mixin DEFINE_GUID!("FORMAT_VideoInfo", 0x05589f80, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("FORMAT_VideoInfo2", 0xf72a76A0, 0xeb0a, 0x11d0, 0xac, 0xe4, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("FORMAT_WaveFormatEx", 0x05589f81, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("FORMAT_MPEGVideo", 0x05589f82, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("FORMAT_MPEGStreams", 0x05589f83, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("FORMAT_DvInfo", 0x05589f84, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("FORMAT_525WSS", 0xc7ecf04d, 0x4582, 0x4869, 0x9a, 0xbb, 0xbf, 0xb5, 0x23, 0xb6, 0x2e, 0xdf);
mixin DEFINE_GUID!("CLSID_DirectDrawProperties", 0x944d4c00, 0xdd52, 0x11ce, 0xbf, 0x0e, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("CLSID_PerformanceProperties", 0x59ce6880, 0xacf8, 0x11cf, 0xb5, 0x6e, 0x00, 0x80, 0xc7, 0xc4, 0xb6, 0x8a);
mixin DEFINE_GUID!("CLSID_QualityProperties", 0x418afb70, 0xf8b8, 0x11ce, 0xaa, 0xc6, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3);
mixin DEFINE_GUID!("IID_IBaseVideoMixer", 0x61ded640, 0xe912, 0x11ce, 0xa0, 0x99, 0x00, 0xaa, 0x00, 0x47, 0x9a, 0x58);
mixin DEFINE_GUID!("IID_IDirectDrawVideo", 0x36d39eb0, 0xdd75, 0x11ce, 0xbf, 0x0e, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("IID_IQualProp", 0x1bd0ecb0, 0xf8e2, 0x11ce, 0xaa, 0xc6, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3);
mixin DEFINE_GUID!("CLSID_VPObject", 0xce292861, 0xfc88, 0x11d0, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("IID_IVPObject", 0xce292862, 0xfc88, 0x11d0, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("IID_IVPControl", 0x25df12c1, 0x3de0, 0x11d1, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("CLSID_VPVBIObject", 0x814b9801, 0x1c88, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("IID_IVPVBIObject", 0x814b9802, 0x1c88, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("IID_IVPConfig", 0xbc29a660, 0x30e3, 0x11d0, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("IID_IVPNotify", 0xc76794a1, 0xd6c5, 0x11d0, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("IID_IVPNotify2", 0xebf47183, 0x8764, 0x11d1, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("IID_IVPVBIConfig", 0xec529b00, 0x1a1f, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("IID_IVPVBINotify", 0xec529b01, 0x1a1f, 0x11d1, 0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a);
mixin DEFINE_GUID!("IID_IMixerPinConfig", 0x593cdde1, 0x759, 0x11d1, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("IID_IMixerPinConfig2", 0xebf47182, 0x8764, 0x11d1, 0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b);
mixin DEFINE_GUID!("CLSID_DirectDraw", 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35);
mixin DEFINE_GUID!("CLSID_DirectDrawClipper", 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56);
mixin DEFINE_GUID!("IID_IDirectDraw", 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
mixin DEFINE_GUID!("IID_IDirectDraw2", 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56);
mixin DEFINE_GUID!("IID_IDirectDrawSurface", 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
mixin DEFINE_GUID!("IID_IDirectDrawSurface2", 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27);
mixin DEFINE_GUID!("IID_IDirectDrawSurface3", 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB);
mixin DEFINE_GUID!("IID_IDirectDrawSurface4", 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B);
mixin DEFINE_GUID!("IID_IDirectDrawSurface7", 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b);
mixin DEFINE_GUID!("IID_IDirectDrawPalette", 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
mixin DEFINE_GUID!("IID_IDirectDrawClipper", 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
mixin DEFINE_GUID!("IID_IDirectDrawColorControl", 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
mixin DEFINE_GUID!("IID_IDDVideoPortContainer", 0x6C142760,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
mixin DEFINE_GUID!("IID_IDirectDrawKernel", 0x8D56C120,0x6A08,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
mixin DEFINE_GUID!("IID_IDirectDrawSurfaceKernel", 0x60755DA0,0x6A40,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
mixin DEFINE_GUID!("CLSID_ModexProperties", 0x0618aa30, 0x6bc4, 0x11cf, 0xbf, 0x36, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("IID_IFullScreenVideo", 0xdd1d7110, 0x7836, 0x11cf, 0xbf, 0x47, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a);
mixin DEFINE_GUID!("IID_IFullScreenVideoEx", 0x53479470, 0xf1dd, 0x11cf, 0xbc, 0x42, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("CLSID_DVDecPropertiesPage", 0x101193c0, 0xbfe, 0x11d0, 0xaf, 0x91, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_DVEncPropertiesPage", 0x4150f050, 0xbb6f, 0x11d0, 0xaf, 0xb9, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("CLSID_DVMuxPropertyPage", 0x4db880e0, 0xc10d, 0x11d0, 0xaf, 0xb9, 0x0, 0xaa, 0x0, 0xb6, 0x7a, 0x42);
mixin DEFINE_GUID!("IID_IAMDirectSound", 0x546f4260, 0xd53e, 0x11cf, 0xb3, 0xf0, 0x0, 0xaa, 0x0, 0x37, 0x61, 0xc5);
mixin DEFINE_GUID!("IID_IMpegAudioDecoder", 0xb45dd570, 0x3c77, 0x11d1, 0xab, 0xe1, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75);
mixin DEFINE_GUID!("IID_IAMLine21Decoder", 0x6e8d4a21, 0x310c, 0x11d0, 0xb7, 0x9a, 0x0, 0xaa, 0x0, 0x37, 0x67, 0xa7);
mixin DEFINE_GUID!("IID_IAMWstDecoder", 0xc056de21, 0x75c2, 0x11d3, 0xa1, 0x84, 0x0, 0x10, 0x5a, 0xef, 0x9f, 0x33);
mixin DEFINE_GUID!("CLSID_WstDecoderPropertyPage", 0x4e27f80, 0x91e4, 0x11d3, 0xa1, 0x84, 0x0, 0x10, 0x5a, 0xef, 0x9f, 0x33);
mixin DEFINE_GUID!("FORMAT_AnalogVideo", 0x482dde0, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIATYPE_AnalogVideo", 0x482dde1, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_NTSC_M", 0x482dde2, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_B", 0x482dde5, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_D", 0x482dde6, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_G", 0x482dde7, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_H", 0x482dde8, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_I", 0x482dde9, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_M", 0x482ddea, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_N", 0x482ddeb, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_PAL_N_COMBO", 0x482ddec, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_B", 0x482ddf0, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_D", 0x482ddf1, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_G", 0x482ddf2, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_H", 0x482ddf3, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_K", 0x482ddf4, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_K1", 0x482ddf5, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIASUBTYPE_AnalogVideo_SECAM_L", 0x482ddf6, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("MEDIATYPE_AnalogAudio", 0x482dee1, 0x7817, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("FORMAT_CAPTIONED_H264VIDEO", 0xa4efc024, 0x873e, 0x4da3, 0x89, 0x8b, 0x47, 0x4d, 0xdb, 0xd7, 0x9f, 0xd0);
mixin DEFINE_GUID!("FORMAT_CC_CONTAINER", 0x50997a4a, 0xe508, 0x4054, 0xa2, 0xb2, 0x10, 0xff, 0xa, 0xc1, 0xa6, 0x9a);
mixin DEFINE_GUID!("CAPTION_FORMAT_ATSC", 0x3ed9cb31, 0xfd10, 0x4ade, 0xbc, 0xcc, 0xfb, 0x91, 0x5, 0xd2, 0xf3, 0xef);
mixin DEFINE_GUID!("CAPTION_FORMAT_DVB", 0x12230db4, 0xff2a, 0x447e, 0xbb, 0x88, 0x68, 0x41, 0xc4, 0x16, 0xd0, 0x68);
mixin DEFINE_GUID!("CAPTION_FORMAT_DIRECTV", 0xe9ca1ce7, 0x915e, 0x47be, 0x9b, 0xb9, 0xbf, 0x1d, 0x8a, 0x13, 0xa5, 0xec);
mixin DEFINE_GUID!("CAPTION_FORMAT_ECHOSTAR", 0xebb1a262, 0x1158, 0x4b99, 0xae, 0x80, 0x92, 0xac, 0x77, 0x69, 0x52, 0xc4);
mixin DEFINE_GUID!("FORMAT_CAPTIONED_MPEG2VIDEO", 0x7ab2ada2, 0x81b6, 0x4f14, 0xb3, 0xc8, 0xd0, 0xc4, 0x86, 0x39, 0x3b, 0x67);
mixin DEFINE_GUID!("TIME_FORMAT_NONE", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
mixin DEFINE_GUID!("TIME_FORMAT_FRAME", 0x7b785570, 0x8c82, 0x11cf, 0xbc, 0xc, 0x0, 0xaa, 0x0, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("TIME_FORMAT_BYTE", 0x7b785571, 0x8c82, 0x11cf, 0xbc, 0xc, 0x0, 0xaa, 0x0, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("TIME_FORMAT_SAMPLE", 0x7b785572, 0x8c82, 0x11cf, 0xbc, 0xc, 0x0, 0xaa, 0x0, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("TIME_FORMAT_FIELD", 0x7b785573, 0x8c82, 0x11cf, 0xbc, 0xc, 0x0, 0xaa, 0x0, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("TIME_FORMAT_MEDIA_TIME", 0x7b785574, 0x8c82, 0x11cf, 0xbc, 0xc, 0x0, 0xaa, 0x0, 0xac, 0x74, 0xf6);
mixin DEFINE_GUID!("AMPROPSETID_Pin", 0x9b00f101, 0x1567, 0x11d1, 0xb3, 0xf1, 0x0, 0xaa, 0x0, 0x37, 0x61, 0xc5);
mixin DEFINE_GUID!("PIN_CATEGORY_CAPTURE", 0xfb6c4281, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_PREVIEW", 0xfb6c4282, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_ANALOGVIDEOIN", 0xfb6c4283, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_VBI", 0xfb6c4284, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_VIDEOPORT", 0xfb6c4285, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_NABTS", 0xfb6c4286, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_EDS", 0xfb6c4287, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_TELETEXT", 0xfb6c4288, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_CC", 0xfb6c4289, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_STILL", 0xfb6c428a, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_TIMECODE", 0xfb6c428b, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("PIN_CATEGORY_VIDEOPORT_VBI", 0xfb6c428c, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba);
mixin DEFINE_GUID!("LOOK_UPSTREAM_ONLY", 0xac798be0, 0x98e3, 0x11d1, 0xb3, 0xf1, 0x0, 0xaa, 0x0, 0x37, 0x61, 0xc5);
mixin DEFINE_GUID!("LOOK_DOWNSTREAM_ONLY", 0xac798be1, 0x98e3, 0x11d1, 0xb3, 0xf1, 0x0, 0xaa, 0x0, 0x37, 0x61, 0xc5);
mixin DEFINE_GUID!("CLSID_TVTunerFilterPropertyPage", 0x266eee41, 0x6c63, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
mixin DEFINE_GUID!("CLSID_CrossbarFilterPropertyPage", 0x71f96461, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
mixin DEFINE_GUID!("CLSID_TVAudioFilterPropertyPage", 0x71f96463, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
mixin DEFINE_GUID!("CLSID_VideoProcAmpPropertyPage", 0x71f96464, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
mixin DEFINE_GUID!("CLSID_CameraControlPropertyPage", 0x71f96465, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
mixin DEFINE_GUID!("CLSID_AnalogVideoDecoderPropertyPage", 0x71f96466, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
mixin DEFINE_GUID!("CLSID_VideoStreamConfigPropertyPage", 0x71f96467, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
mixin DEFINE_GUID!("CLSID_AudioRendererAdvancedProperties", 0x37e92a92, 0xd9aa, 0x11d2, 0xbf, 0x84, 0x8e, 0xf2, 0xb1, 0x55, 0x5a, 0xed);
mixin DEFINE_GUID!("CLSID_VideoMixingRenderer", 0xB87BEB7B, 0x8D29, 0x423f, 0xAE, 0x4D, 0x65, 0x82, 0xC1, 0x01, 0x75, 0xAC);
mixin DEFINE_GUID!("CLSID_VideoRendererDefault", 0x6BC1CFFA, 0x8FC1, 0x4261, 0xAC, 0x22, 0xCF, 0xB4, 0xCC, 0x38, 0xDB, 0x50);
mixin DEFINE_GUID!("CLSID_AllocPresenter", 0x99d54f63, 0x1a69, 0x41ae, 0xaa, 0x4d, 0xc9, 0x76, 0xeb, 0x3f, 0x07, 0x13);
mixin DEFINE_GUID!("CLSID_AllocPresenterDDXclMode", 0x4444ac9e, 0x242e, 0x471b, 0xa3, 0xc7, 0x45, 0xdc, 0xd4, 0x63, 0x52, 0xbc);
mixin DEFINE_GUID!("CLSID_VideoPortManager", 0x6f26a6cd, 0x967b, 0x47fd, 0x87, 0x4a, 0x7a, 0xed, 0x2c, 0x9d, 0x25, 0xa2);
mixin DEFINE_GUID!("CLSID_VideoMixingRenderer9", 0x51b4abf3, 0x748f, 0x4e3b, 0xa2, 0x76, 0xc8, 0x28, 0x33, 0x0e, 0x92, 0x6a);
mixin DEFINE_GUID!("CLSID_EnhancedVideoRenderer", 0xfa10746c, 0x9b63, 0x4b6c, 0xbc, 0x49, 0xfc, 0x30, 0xe, 0xa5, 0xf2, 0x56);
mixin DEFINE_GUID!("CLSID_MFVideoMixer9", 0xE474E05A, 0xAB65, 0x4f6a, 0x82, 0x7C, 0x21, 0x8B, 0x1B, 0xAA, 0xF3, 0x1F);
mixin DEFINE_GUID!("CLSID_MFVideoPresenter9", 0x98455561, 0x5136, 0x4d28, 0xab, 0x8, 0x4c, 0xee, 0x40, 0xea, 0x27, 0x81);
mixin DEFINE_GUID!("CLSID_EVRTearlessWindowPresenter9", 0xa0a7a57b, 0x59b2, 0x4919, 0xa6, 0x94, 0xad, 0xd0, 0xa5, 0x26, 0xc3, 0x73);
mixin DEFINE_GUID!("CLSID_EVRPlaybackPipelineOptimizer", 0x62079164, 0x233b, 0x41f8, 0xa8, 0x0f, 0xf0, 0x17, 0x05, 0xf5, 0x14, 0xa8);
mixin DEFINE_GUID!("EVRConfig_ForceBob", 0xe447df01,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_AllowDropToBob", 0xe447df02,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_ForceThrottle", 0xe447df03,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_AllowDropToThrottle", 0xe447df04,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_ForceHalfInterlace", 0xe447df05,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_AllowDropToHalfInterlace",0xe447df06,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_ForceScaling", 0xe447df07,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_AllowScaling", 0xe447df08,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_ForceBatching", 0xe447df09,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("EVRConfig_AllowBatching", 0xe447df0a,0x10ca,0x4d17,0xb1, 0x7e, 0x6a, 0x84, 0x0f, 0x8a, 0x3a, 0x4c);
mixin DEFINE_GUID!("CLSID_NetworkProvider", 0xb2f3a67c, 0x29da, 0x4c78, 0x88, 0x31, 0x9, 0x1e, 0xd5, 0x9, 0xa4, 0x75);
mixin DEFINE_GUID!("CLSID_ATSCNetworkProvider", 0x0dad2fdd, 0x5fd7, 0x11d3, 0x8f, 0x50, 0x00, 0xc0, 0x4f, 0x79, 0x71, 0xe2);
mixin DEFINE_GUID!("CLSID_ATSCNetworkPropertyPage", 0xe3444d16, 0x5ac4, 0x4386, 0x88, 0xdf, 0x13, 0xfd, 0x23, 0x0e, 0x1d, 0xda);
mixin DEFINE_GUID!("CLSID_DVBSNetworkProvider", 0xfa4b375a, 0x45b4, 0x4d45, 0x84, 0x40, 0x26, 0x39, 0x57, 0xb1, 0x16, 0x23);
mixin DEFINE_GUID!("CLSID_DVBTNetworkProvider", 0x216c62df, 0x6d7f, 0x4e9a, 0x85, 0x71, 0x5, 0xf1, 0x4e, 0xdb, 0x76, 0x6a);
mixin DEFINE_GUID!("CLSID_DVBCNetworkProvider", 0xdc0c0fe7, 0x485, 0x4266, 0xb9, 0x3f, 0x68, 0xfb, 0xf8, 0xe, 0xd8, 0x34);
mixin DEFINE_GUID!("DSATTRIB_UDCRTag", 0xEB7836CA, 0x14FF, 0x4919, 0xbc, 0xe7, 0x3a, 0xf1, 0x23, 0x19, 0xe5, 0x0c);
mixin DEFINE_GUID!("DSATTRIB_PicSampleSeq", 0x2f5bae02, 0x7b8f, 0x4f60, 0x82, 0xd6, 0xe4, 0xea, 0x2f, 0x1f, 0x4c, 0x99);
mixin DEFINE_GUID!("DSATTRIB_OptionalVideoAttributes", 0x5A5F08CA, 0x55C2, 0x4033, 0x92, 0xAB, 0x55, 0xDB, 0x8F, 0x78, 0x12, 0x26);
mixin DEFINE_GUID!("DSATTRIB_CC_CONTAINER_INFO", 0xe7e050fb, 0xdd5d, 0x40dd, 0x99, 0x15, 0x35, 0xDC, 0xB8, 0x1B, 0xDC, 0x8a);
mixin DEFINE_GUID!("DSATTRIB_TRANSPORT_PROPERTIES", 0xb622f612, 0x47ad, 0x4671, 0xad, 0x6c, 0x5, 0xa9, 0x8e, 0x65, 0xde, 0x3a);
mixin DEFINE_GUID!("DSATTRIB_PBDATAG_ATTRIBUTE", 0xe0b56679, 0x12b9, 0x43cc, 0xb7, 0xdf, 0x57, 0x8c, 0xaa, 0x5a, 0x7b, 0x63);
mixin DEFINE_GUID!("DSATTRIB_CAPTURE_STREAMTIME", 0x0c1a5614, 0x30cd, 0x4f40, 0xbc, 0xbf, 0xd0, 0x3e, 0x52, 0x30, 0x62, 0x07);
mixin DEFINE_GUID!("DSATTRIB_DSHOW_STREAM_DESC", 0x5fb5673b, 0xa2a, 0x4565, 0x82, 0x7b, 0x68, 0x53, 0xfd, 0x75, 0xe6, 0x11);
mixin DEFINE_GUID!("DSATTRIB_SAMPLE_LIVE_STREAM_TIME", 0x892cd111, 0x72f3, 0x411d, 0x8b, 0x91, 0xa9, 0xe9, 0x12, 0x3a, 0xc2, 0x9a);
mixin DEFINE_GUID!("UUID_UdriTagTables", 0xe1b98d74, 0x9778, 0x4878, 0xb6, 0x64, 0xeb, 0x20, 0x20, 0x36, 0x4d, 0x88);
mixin DEFINE_GUID!("UUID_WMDRMTagTables", 0x5DCD1101, 0x9263, 0x45bb, 0xa4, 0xd5, 0xc4, 0x15, 0xab, 0x8c, 0x58, 0x9c);
mixin DEFINE_GUID!("CLSID_DShowTVEFilter", 0x05500280, 0xFAA5, 0x4DF9, 0x82, 0x46, 0xBF, 0xC2, 0x3A, 0xC5, 0xCE, 0xA8);
mixin DEFINE_GUID!("CLSID_TVEFilterTuneProperties", 0x05500281, 0xFAA5, 0x4DF9, 0x82, 0x46, 0xBF, 0xC2, 0x3A, 0xC5, 0xCE, 0xA8);
mixin DEFINE_GUID!("CLSID_TVEFilterCCProperties", 0x05500282, 0xFAA5, 0x4DF9, 0x82, 0x46, 0xBF, 0xC2, 0x3A, 0xC5, 0xCE, 0xA8);
mixin DEFINE_GUID!("CLSID_TVEFilterStatsProperties", 0x05500283, 0xFAA5, 0x4DF9, 0x82, 0x46, 0xBF, 0xC2, 0x3A, 0xC5, 0xCE, 0xA8);
mixin DEFINE_GUID!("CLSID_IVideoEncoderProxy", 0xb43c4eec, 0x8c32, 0x4791, 0x91, 0x2, 0x50, 0x8a, 0xda, 0x5e, 0xe8, 0xe7);
mixin DEFINE_GUID!("CLSID_ICodecAPIProxy", 0x7ff0997a, 0x1999, 0x4286, 0xa7, 0x3c, 0x62, 0x2b, 0x88, 0x14, 0xe7, 0xeb );
mixin DEFINE_GUID!("CLSID_IVideoEncoderCodecAPIProxy", 0xb05dabd9, 0x56e5, 0x4fdc, 0xaf, 0xa4, 0x8a, 0x47, 0xe9, 0x1f, 0x1c, 0x9c );
mixin DEFINE_GUID!("ENCAPIPARAM_BITRATE", 0x49cc4c43, 0xca83, 0x4ad4, 0xa9, 0xaf, 0xf3, 0x69, 0x6a, 0xf6, 0x66, 0xdf);
mixin DEFINE_GUID!("ENCAPIPARAM_PEAK_BITRATE", 0x703f16a9, 0x3d48, 0x44a1, 0xb0, 0x77, 0x1, 0x8d, 0xff, 0x91, 0x5d, 0x19);
mixin DEFINE_GUID!("ENCAPIPARAM_BITRATE_MODE", 0xee5fb25c, 0xc713, 0x40d1, 0x9d, 0x58, 0xc0, 0xd7, 0x24, 0x1e, 0x25, 0xf);
mixin DEFINE_GUID!("ENCAPIPARAM_SAP_MODE", 0xc0171db, 0xfefc, 0x4af7, 0x99, 0x91, 0xa5, 0x65, 0x7c, 0x19, 0x1c, 0xd1);
mixin DEFINE_GUID!("CODECAPI_CHANGELISTS", 0x62b12acf, 0xf6b0, 0x47d9, 0x94, 0x56, 0x96, 0xf2, 0x2c, 0x4e, 0x0b, 0x9d);
mixin DEFINE_GUID!("CODECAPI_VIDEO_ENCODER", 0x7112e8e1, 0x3d03, 0x47ef, 0x8e, 0x60, 0x03, 0xf1, 0xcf, 0x53, 0x73, 0x01);
mixin DEFINE_GUID!("CODECAPI_AUDIO_ENCODER", 0xb9d19a3e, 0xf897, 0x429c, 0xbc, 0x46, 0x81, 0x38, 0xb7, 0x27, 0x2b, 0x2d);
mixin DEFINE_GUID!("CODECAPI_SETALLDEFAULTS", 0x6c5e6a7c, 0xacf8, 0x4f55, 0xa9, 0x99, 0x1a, 0x62, 0x81, 0x09, 0x05, 0x1b);
mixin DEFINE_GUID!("CODECAPI_ALLSETTINGS", 0x6a577e92, 0x83e1, 0x4113, 0xad, 0xc2, 0x4f, 0xce, 0xc3, 0x2f, 0x83, 0xa1);
mixin DEFINE_GUID!("CODECAPI_SUPPORTSEVENTS", 0x0581af97, 0x7693, 0x4dbd, 0x9d, 0xca, 0x3f, 0x9e, 0xbd, 0x65, 0x85, 0xa1 );
mixin DEFINE_GUID!("CODECAPI_CURRENTCHANGELIST", 0x1cb14e83, 0x7d72, 0x4657, 0x83, 0xfd, 0x47, 0xa2, 0xc5, 0xb9, 0xd1, 0x3d );
mixin DEFINE_GUID!("CLSID_SBE2MediaTypeProfile", 0x1f26a602, 0x2b5c, 0x4b63, 0xb8, 0xe8, 0x9e, 0xa5, 0xc1, 0xa7, 0xdc, 0x2e );
mixin DEFINE_GUID!("CLSID_SBE2FileScan", 0x3e458037, 0xca6, 0x41aa, 0xa5, 0x94, 0x2a, 0xa6, 0xc0, 0x2d, 0x70, 0x9b) ;
mixin DEFINE_GUID!("CODECAPI_AVDecMmcssClass", 0xe0ad4828, 0xdf66, 0x4893, 0x9f, 0x33, 0x78, 0x8a, 0xa4, 0xec, 0x40, 0x82);
|
D
|
module d.semantic.caster;
import d.semantic.semantic;
import d.semantic.typepromotion;
import d.ir.expression;
import d.ir.symbol;
import d.ir.type;
import d.exception;
import d.location;
Expression buildImplicitCast(SemanticPass pass, Location location, Type to, Expression e) {
return build!false(pass, location, to, e);
}
Expression buildExplicitCast(SemanticPass pass, Location location, Type to, Expression e) {
return build!true(pass, location, to, e);
}
CastKind implicitCastFrom(SemanticPass pass, Type from, Type to) {
return ImplicitCaster(pass, to).castFrom(from);
}
CastKind explicitCastFrom(SemanticPass pass, Type from, Type to) {
return ExplicitCaster(pass, to).castFrom(from);
}
private:
// Conflict with Interface in object.di
alias Interface = d.ir.symbol.Interface;
Expression build(bool isExplicit)(SemanticPass pass, Location location, Type to, Expression e) in {
assert(e, "Expression must not be null");
} body {
// If the expression is polysemous, we try the several meaning and exclude the ones that make no sense.
if(auto asPolysemous = cast(PolysemousExpression) e) {
auto oldBuildErrorNode = pass.buildErrorNode;
scope(exit) pass.buildErrorNode = oldBuildErrorNode;
pass.buildErrorNode = true;
Expression casted;
foreach(candidate; asPolysemous.expressions) {
candidate = build!isExplicit(pass, location, to, candidate);
if (cast(ErrorExpression) candidate) {
continue;
}
if (casted) {
return pass.raiseCondition!Expression(location, "Ambiguous.");
}
casted = candidate;
}
if (casted) {
return casted;
}
return pass.raiseCondition!Expression(e.location, "No match found.");
}
auto kind = Caster!(isExplicit, delegate CastKind(c, t) {
alias T = typeof(t);
static if (is(T : Aggregate)) {
static struct AliasThisResult {
Expression expr;
CastKind level;
}
auto level = CastKind.Invalid;
enum InvalidResult = AliasThisResult(null, CastKind.Invalid);
import d.semantic.aliasthis;
import std.algorithm;
auto results = AliasThisResolver!((identified) {
alias T = typeof(identified);
static if (is(T : Expression)) {
auto oldE = e;
scope(exit) e = oldE;
e = identified;
auto cLevel = c.castFrom(identified.type, to);
if (cLevel == CastKind.Invalid || cLevel < level) {
return InvalidResult;
}
level = cLevel;
return AliasThisResult(identified, cLevel);
} else {
return InvalidResult;
}
})(pass).resolve(e, t).filter!(r => r.level == level);
if (level == CastKind.Invalid) {
return CastKind.Invalid;
}
Expression candidate;
foreach(r; results) {
if (candidate !is null) {
return CastKind.Invalid;
}
candidate = r.expr;
}
assert(candidate, "if no candidate are found, level should be Invalid");
e = candidate;
return level;
} else static if (is(T : BuiltinType)) {
auto to = c.to;
if (to.kind != TypeKind.Builtin || !canConvertToIntegral(to.builtin)) {
return CastKind.Invalid;
}
assert(getSize(to.builtin) < getSize(t));
import d.semantic.vrp;
return ValueRangePropagator(pass).canFit(e, to)
? CastKind.Trunc
: CastKind.Invalid;
} else {
return CastKind.Invalid;
}
})(pass, to).castFrom(e.type);
switch(kind) with(CastKind) {
case Exact:
return e;
default:
return new CastExpression(location, kind, to, e);
case Invalid:
return pass.raiseCondition!Expression(location, "Can't cast " ~ e.type.toString(pass.context) ~ " to " ~ to.toString(pass.context));
}
}
alias ExplicitCaster = Caster!true;
alias ImplicitCaster = Caster!false;
struct Caster(bool isExplicit, alias bailoutOverride = null) {
// XXX: Used only to get to super class, should probably go away.
private SemanticPass pass;
alias pass this;
Type to;
this(SemanticPass pass, Type to) {
this.pass = pass;
this.to = to;
}
enum hasBailoutOverride = !is(typeof(bailoutOverride) : typeof(null));
CastKind bailout(T)(T t) {
static if (hasBailoutOverride) {
return bailoutOverride(this, t);
} else {
return CastKind.Invalid;
}
}
CastKind bailoutDefault(T)(T t) {
return CastKind.Invalid;
}
CastKind castFrom(ParamType from, ParamType to) {
if(from.isRef != to.isRef) return CastKind.Invalid;
auto k = castFrom(from.getType(), to.getType());
if(from.isRef && k < CastKind.Qual) return CastKind.Invalid;
return k;
}
// FIXME: handle qualifiers.
CastKind castFrom(Type from) {
from = from.getCanonical();
to = to.getCanonical();
if (from == to) {
return CastKind.Exact;
}
return from.accept(this);
}
CastKind castFrom(Type from, Type to) {
this.to = to;
return castFrom(from);
}
CastKind visit(BuiltinType t) {
if (isExplicit && to.kind == TypeKind.Enum) {
to = to.denum.type.getCanonical().qualify(to.qualifier);
auto k = visit(t);
return (k == CastKind.Exact)
? CastKind.Bit
: k;
}
// Can cast typeof(null) to class, pointer and function.
if (t == BuiltinType.Null && to.hasPointerABI()) {
return CastKind.Bit;
}
// Can explicitely cast integral to pointer.
if (isExplicit && (to.kind == TypeKind.Pointer && canConvertToIntegral(t))) {
return CastKind.IntToPtr;
}
if (to.kind != TypeKind.Builtin) {
return CastKind.Invalid;
}
auto bt = to.builtin;
if (t == bt) {
return CastKind.Exact;
}
final switch(t) with(BuiltinType) {
case None :
case Void :
return CastKind.Invalid;
case Bool :
if (isIntegral(bt)) {
return CastKind.UPad;
}
return CastKind.Invalid;
case Char :
t = integralOfChar(t);
goto case Ubyte;
case Wchar :
t = integralOfChar(t);
goto case Ushort;
case Dchar :
t = integralOfChar(t);
goto case Uint;
case Byte, Ubyte, Short, Ushort, Int, Uint, Long, Ulong, Cent, Ucent :
if (isExplicit && bt == Bool) {
return CastKind.IntToBool;
}
if (!isIntegral(bt)) {
return CastKind.Invalid;
}
auto ut = unsigned(t);
bt = unsigned(bt);
if (ut == bt) {
return CastKind.Bit;
} else if (ut < bt) {
return isSigned(t)
? CastKind.SPad
: CastKind.UPad;
} else static if (isExplicit) {
return CastKind.Trunc;
} else {
return bailout(t);
}
case Float, Double, Real :
assert(0, "Floating point casts are not implemented");
case Null :
return CastKind.Invalid;
}
}
CastKind visitPointerOf(Type t) {
// You can explicitely cast pointer to class, function.
if (isExplicit && to.kind != TypeKind.Pointer && to.hasPointerABI()) {
return CastKind.Bit;
}
// It is also possible to cast to integral explicitely.
if (isExplicit && to.kind == TypeKind.Builtin) {
if (canConvertToIntegral(to.builtin)) {
return CastKind.PtrToInt;
}
}
if (to.kind != TypeKind.Pointer) {
return CastKind.Invalid;
}
auto e = to.element.getCanonical();
// Cast to void* is kind of special.
if (e.kind == TypeKind.Builtin && e.builtin == BuiltinType.Void) {
return (isExplicit || canConvert(t.qualifier, to.qualifier))
? CastKind.Bit
: CastKind.Invalid;
}
auto subCast = castFrom(t, e);
switch(subCast) with(CastKind) {
case Qual :
if (canConvert(t.qualifier, e.qualifier)) {
return Qual;
}
goto default;
case Exact :
return Qual;
static if (isExplicit) {
default :
return Bit;
} else {
case Bit :
if (canConvert(t.qualifier, e.qualifier)) {
return subCast;
}
return Invalid;
default :
return Invalid;
}
}
}
CastKind visitSliceOf(Type t) {
if (to.kind != TypeKind.Slice) {
return CastKind.Invalid;
}
auto e = to.element.getCanonical();
auto subCast = castFrom(t, e);
switch(subCast) with(CastKind) {
case Qual :
if (canConvert(t.qualifier, e.qualifier)) {
return Qual;
}
goto default;
case Exact :
return Qual;
static if (isExplicit) {
default :
return Bit;
} else {
case Bit :
if (canConvert(t.qualifier, e.qualifier)) {
return subCast;
}
return Invalid;
default :
return Invalid;
}
}
}
CastKind visitArrayOf(uint size, Type t) {
if (to.kind != TypeKind.Array) {
return CastKind.Invalid;
}
if (size != to.size) {
return CastKind.Invalid;
}
auto e = to.element.getCanonical();
auto subCast = castFrom(t, e);
switch(subCast) with(CastKind) {
case Qual :
if (canConvert(t.qualifier, e.qualifier)) {
return Qual;
}
goto default;
case Exact :
return Exact;
static if (isExplicit) {
default :
return Bit;
} else {
case Bit :
if (canConvert(t.qualifier, e.qualifier)) {
return subCast;
}
return Invalid;
default :
return Invalid;
}
}
}
CastKind visit(Struct s) {
if (to.kind == TypeKind.Struct) {
if (to.dstruct is s) {
return CastKind.Exact;
}
}
return bailout(s);
}
private auto castClass(Class from, Class to) {
if (from is to) {
return CastKind.Exact;
}
auto upcast = from;
// Stop at object.
while(upcast !is upcast.base) {
// Automagically promote to base type.
upcast = upcast.base;
if (upcast is to) {
return CastKind.Bit;
}
}
static if (isExplicit) {
auto downcast = to;
// Stop at object.
while(downcast !is downcast.base) {
// Automagically promote to base type.
downcast = downcast.base;
if (downcast is from) {
return CastKind.Down;
}
}
}
return CastKind.Invalid;
}
CastKind visit(Class c) {
if (to.kind == TypeKind.Class) {
scheduler.require(c, Step.Signed);
auto kind = castClass(c, to.dclass);
if (kind > CastKind.Invalid) {
return kind;
}
}
return bailout(c);
}
CastKind visit(Enum e) {
if (to.kind == TypeKind.Enum) {
if (e is to.denum) {
return CastKind.Exact;
}
}
// Automagically promote to base type.
return castFrom(e.type);
}
CastKind visit(TypeAlias a) {
return castFrom(a.type);
}
CastKind visit(Interface i) {
return CastKind.Invalid;
}
CastKind visit(Union u) {
return CastKind.Invalid;
}
CastKind visit(Function f) {
assert(0, "Cast to context type do not make any sense.");
}
CastKind visit(Type[] seq) {
assert(0, "Cast to sequence type do not make any sense.");
}
CastKind visit(FunctionType f) {
if (to.kind == TypeKind.Pointer && f.contexts.length == 0) {
auto e = to.element.getCanonical();
static if (isExplicit) {
return CastKind.Bit;
} else if (e.kind == TypeKind.Builtin && e.builtin == BuiltinType.Void) {
// FIXME: qualifier.
return CastKind.Bit;
} else {
return CastKind.Invalid;
}
}
if (to.kind != TypeKind.Function) {
return CastKind.Invalid;
}
auto tf = to.asFunctionType();
if (f.contexts.length != tf.contexts.length) {
return CastKind.Invalid;
}
enum onFail = isExplicit ? CastKind.Bit : CastKind.Invalid;
if (f.parameters.length != tf.parameters.length) return onFail;
if (f.isVariadic != tf.isVariadic) return onFail;
if (f.linkage != tf.linkage) return onFail;
auto k = castFrom(f.returnType, tf.returnType);
if(k < CastKind.Bit) return onFail;
import std.range;
foreach(fromc, toc; lockstep(f.contexts, tf.contexts)) {
// ref context decay to void*
if (fromc.isRef && !toc.isRef &&
toc.kind == TypeKind.Pointer) {
auto e = toc.getType().element;
if (e.kind == TypeKind.Builtin &&
e.builtin == BuiltinType.Void) {
k = CastKind.Bit;
continue;
}
}
// Contexts are covariant.
auto kc = castFrom(fromc, toc);
if(kc < CastKind.Bit) return onFail;
import std.algorithm;
k = min(k, kc);
}
foreach(fromp, top; lockstep(f.parameters, tf.parameters)) {
// Parameters are contrevariant.
auto kp = castFrom(top, fromp);
if(kp < CastKind.Bit) return onFail;
import std.algorithm;
k = min(k, kp);
}
return (k < CastKind.Exact) ? CastKind.Bit : CastKind.Exact;
}
CastKind visit(TypeTemplateParameter p) {
assert(0, "Not implemented.");
}
}
|
D
|
Eurasian plant with apple-scented foliage and white-rayed flowers and feathery leaves used medicinally
|
D
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
module vtkInteractorStyleJoystickCamera;
static import vtkd_im;
static import core.stdc.config;
static import std.conv;
static import std.string;
static import std.conv;
static import std.string;
static import vtkObjectBase;
static import vtkInteractorStyle;
class vtkInteractorStyleJoystickCamera : vtkInteractorStyle.vtkInteractorStyle {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(vtkd_im.vtkInteractorStyleJoystickCamera_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(vtkInteractorStyleJoystickCamera obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin vtkd_im.SwigOperatorDefinitions;
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
throw new object.Exception("C++ destructor does not have public access");
}
swigCPtr = null;
super.dispose();
}
}
}
public static vtkInteractorStyleJoystickCamera New() {
void* cPtr = vtkd_im.vtkInteractorStyleJoystickCamera_New();
vtkInteractorStyleJoystickCamera ret = (cPtr is null) ? null : new vtkInteractorStyleJoystickCamera(cPtr, false);
return ret;
}
public static int IsTypeOf(string type) {
auto ret = vtkd_im.vtkInteractorStyleJoystickCamera_IsTypeOf((type ? std.string.toStringz(type) : null));
return ret;
}
public static vtkInteractorStyleJoystickCamera SafeDownCast(vtkObjectBase.vtkObjectBase o) {
void* cPtr = vtkd_im.vtkInteractorStyleJoystickCamera_SafeDownCast(vtkObjectBase.vtkObjectBase.swigGetCPtr(o));
vtkInteractorStyleJoystickCamera ret = (cPtr is null) ? null : new vtkInteractorStyleJoystickCamera(cPtr, false);
return ret;
}
public vtkInteractorStyleJoystickCamera NewInstance() const {
void* cPtr = vtkd_im.vtkInteractorStyleJoystickCamera_NewInstance(cast(void*)swigCPtr);
vtkInteractorStyleJoystickCamera ret = (cPtr is null) ? null : new vtkInteractorStyleJoystickCamera(cPtr, false);
return ret;
}
alias vtkInteractorStyle.vtkInteractorStyle.NewInstance NewInstance;
}
|
D
|
import vibe.vibe;
void main()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "0.0.0.0"];
listenHTTP(settings, &index);
logInfo("Please open http://0.0.0.0:8080/ in your browser.");
runApplication();
}
void index(HTTPServerRequest req, HTTPServerResponse res)
{
res.render!("index.dt", req);
}
|
D
|
/**
Functions and structures for dealing with threads and concurrent access.
This module is modeled after std.concurrency, but provides a fiber-aware alternative
to it. All blocking operations will yield the calling fiber instead of blocking it.
Copyright: © 2013-2014 Sönke Ludwig
License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Authors: Sönke Ludwig
*/
module vibe.core.concurrency;
import core.time;
import std.traits;
import std.typecons;
import std.typetuple;
import std.variant;
import std.string;
import vibe.core.task;
import vibe.internal.newconcurrency;
import vibe.utils.memory : FreeListRef;
static if (newStdConcurrency) public import std.concurrency;
else public import std.concurrency : MessageMismatch, OwnerTerminated, LinkTerminated, PriorityMessageException, MailboxFull, OnCrowding;
private extern (C) pure nothrow void _d_monitorenter(Object h);
private extern (C) pure nothrow void _d_monitorexit(Object h);
/**
Locks the given shared object and returns a ScopedLock for accessing any unshared members.
Using this function will ensure that there are no data races. For this reason, the class
type T is required to contain no unshared or unisolated aliasing.
See_Also: core.concurrency.isWeaklyIsolated
*/
ScopedLock!T lock(T : const(Object))(shared(T) object)
pure nothrow @safe {
return ScopedLock!T(object);
}
/// ditto
void lock(T : const(Object))(shared(T) object, scope void delegate(scope T) accessor)
nothrow {
auto l = lock(object);
accessor(l.unsafeGet());
}
///
unittest {
import vibe.core.concurrency;
static class Item {
private double m_value;
this(double value) pure { m_value = value; }
@property double value() const pure { return m_value; }
}
static class Manager {
private {
string m_name;
Isolated!(Item) m_ownedItem;
Isolated!(shared(Item)[]) m_items;
}
pure this(string name)
{
m_name = name;
auto itm = makeIsolated!Item(3.5);
m_ownedItem = itm.move;
}
void addItem(shared(Item) item) pure { m_items ~= item; }
double getTotalValue()
const pure {
double sum = 0;
// lock() is required to access shared objects
foreach (itm; m_items.unsafeGet) {
auto l = itm.lock();
sum += l.value;
}
// owned objects can be accessed without locking
sum += m_ownedItem.value;
return sum;
}
}
void test()
{
import std.stdio;
auto man = cast(shared)new Manager("My manager");
{
auto l = man.lock();
l.addItem(new shared(Item)(1.5));
l.addItem(new shared(Item)(0.5));
}
writefln("Total value: %s", man.lock().getTotalValue());
}
}
/**
Proxy structure that keeps the monitor of the given object locked until it
goes out of scope.
Any unshared members of the object are safely accessible during this time. The usual
way to use it is by calling lock.
See_Also: lock
*/
struct ScopedLock(T)
{
static assert(is(T == class), "ScopedLock is only usable with classes.");
// static assert(isWeaklyIsolated!(FieldTypeTuple!T), T.stringof~" contains non-immutable, non-shared references. Accessing it in a multi-threaded environment is not safe.");
private Rebindable!T m_ref;
@disable this(this);
this(shared(T) obj)
pure nothrow @trusted
{
assert(obj !is null, "Attempting to lock null object.");
m_ref = cast(T)obj;
_d_monitorenter(getObject());
assert(getObject().__monitor !is null);
}
~this()
pure nothrow @trusted
{
assert(m_ref !is null);
assert(getObject().__monitor !is null);
_d_monitorexit(getObject());
}
/**
Returns an unshared reference to the locked object.
Note that using this function breaks type safety. Be sure to not escape the reference beyond
the life time of the lock.
*/
@property inout(T) unsafeGet() inout nothrow { return m_ref; }
inout(T) fallthrough() inout nothrow { return m_ref; }
alias fallthrough this;
//pragma(msg, "In ScopedLock!("~T.stringof~")");
//pragma(msg, isolatedRefMethods!T());
// mixin(isolatedAggregateMethodsString!T());
private Object getObject()
pure nothrow {
static if( is(Rebindable!T == struct) ) return cast(Unqual!T)m_ref.get();
else return cast(Unqual!T)m_ref;
}
}
/**
Creates a new isolated object.
Isolated objects contain no mutable aliasing outside of their own reference tree. They can thus
be safely converted to immutable and they can be safely passed between threads.
The function returns an instance of Isolated that will allow proxied access to the members of
the object, as well as providing means to convert the object to immutable or to an ordinary
mutable object.
*/
pure Isolated!T makeIsolated(T, ARGS...)(ARGS args)
{
static if (is(T == class)) return Isolated!T(new T(args));
else static if (is(T == struct)) return T(args);
else static if (isPointer!T && is(PointerTarget!T == struct)) {
alias TB = PointerTarget!T;
return Isolated!T(new TB(args));
} else static assert(false, "makeIsolated works only for class and (pointer to) struct types.");
}
///
unittest {
import vibe.core.concurrency;
import vibe.core.core;
static class Item {
double value;
string name;
}
static void modifyItem(Isolated!Item itm)
{
itm.value = 1.3;
// TODO: send back to initiating thread
}
void test()
{
immutable(Item)[] items;
// create immutable item procedurally
auto itm = makeIsolated!Item();
itm.value = 2.4;
itm.name = "Test";
items ~= itm.freeze();
// send isolated item to other thread
auto itm2 = makeIsolated!Item();
runWorkerTask(&modifyItem, itm2.move());
// ...
}
}
unittest {
static class C { this(int x) pure {} }
static struct S { this(int x) pure {} }
alias CI = typeof(makeIsolated!C(0));
alias SI = typeof(makeIsolated!S(0));
alias SPI = typeof(makeIsolated!(S*)(0));
static assert(isStronglyIsolated!CI);
static assert(is(CI == IsolatedRef!C));
static assert(isStronglyIsolated!SI);
static assert(is(SI == S));
static assert(isStronglyIsolated!SPI);
static assert(is(SPI == IsolatedRef!S));
}
/**
Creates a new isolated array.
*/
pure Isolated!(T[]) makeIsolatedArray(T)(size_t size)
{
Isolated!(T[]) ret;
ret.length = size;
return ret.move();
}
///
unittest {
import vibe.core.concurrency;
import vibe.core.core;
static void compute(Tid tid, Isolated!(double[]) array, size_t start_index)
{
foreach( i; 0 .. array.length )
array[i] = (start_index + i) * 0.5;
send(tid, array.move());
}
void test()
{
import std.stdio;
// compute contents of an array using multiple threads
auto arr = makeIsolatedArray!double(256);
// partition the array (no copying takes place)
size_t[] indices = [64, 128, 192, 256];
Isolated!(double[])[] subarrays = arr.splice(indices);
// start processing in threads
Tid[] tids;
foreach (i, idx; indices)
tids ~= runWorkerTaskH(&compute, thisTid, subarrays[i].move(), idx);
// collect results
auto resultarrays = new Isolated!(double[])[tids.length];
foreach( i, tid; tids )
resultarrays[i] = receiveOnly!(Isolated!(double[])).move();
// BUG: the arrays must be sorted here, but since there is no way to tell
// from where something was received, this is difficult here.
// merge results (no copying takes place again)
foreach( i; 1 .. resultarrays.length )
resultarrays[0].merge(resultarrays[i]);
// convert the final result to immutable
auto result = resultarrays[0].freeze();
writefln("Result: %s", result);
}
}
/**
Unsafe facility to assume that an existing reference is unique.
*/
Isolated!T assumeIsolated(T)(T object)
{
return Isolated!T(object);
}
/**
Encapsulates the given type in a way that guarantees memory isolation.
See_Also: makeIsolated, makeIsolatedArray
*/
template Isolated(T)
{
static if( isWeaklyIsolated!T ){
alias Isolated = T;
} else static if( is(T == class) ){
alias Isolated = IsolatedRef!T;
} else static if( isPointer!T ){
alias Isolated = IsolatedRef!(PointerTarget!T);
} else static if( isDynamicArray!T ){
alias Isolated = IsolatedArray!(typeof(T.init[0]));
} else static if( isAssociativeArray!T ){
alias Isolated = IsolatedAssociativeArray!(KeyType!T, ValueType!T);
} else static assert(false, T.stringof~": Unsupported type for Isolated!T - must be class, pointer, array or associative array.");
}
// unit tests fails with DMD 2.064 due to some cyclic import regression
unittest
{
static class CE {}
static struct SE {}
static assert(is(Isolated!CE == IsolatedRef!CE));
static assert(is(Isolated!(SE*) == IsolatedRef!SE));
static assert(is(Isolated!(SE[]) == IsolatedArray!SE));
version(EnablePhobosFails){
// AAs don't work because they are impure
static assert(is(Isolated!(SE[string]) == IsolatedAssociativeArray!(string, SE)));
}
}
/// private
private struct IsolatedRef(T)
{
pure:
static assert(isWeaklyIsolated!(FieldTypeTuple!T), T.stringof ~ " contains non-immutable/non-shared references. Isolation cannot be guaranteed.");
enum __isWeakIsolatedType = true;
static if( isStronglyIsolated!(FieldTypeTuple!T) )
enum __isIsolatedType = true;
alias BaseType = T;
static if( is(T == class) ){
alias Tref = T;
alias Tiref = immutable(T);
} else {
alias Tref = T*;
alias Tiref = immutable(T)*;
}
private Tref m_ref;
//mixin isolatedAggregateMethods!T;
//pragma(msg, isolatedAggregateMethodsString!T());
mixin(isolatedAggregateMethodsString!T());
@disable this(this);
private this(Tref obj)
{
m_ref = obj;
}
this(ref IsolatedRef src)
{
m_ref = src.m_ref;
src.m_ref = null;
}
void opAssign(ref IsolatedRef src)
{
m_ref = src.m_ref;
src.m_ref = null;
}
/**
Returns the raw reference.
Note that using this function breaks type safety. Be sure to not escape the reference.
*/
inout(Tref) unsafeGet() inout { return m_ref; }
/**
Move the contained reference to a new IsolatedRef.
Since IsolatedRef is not copyable, using this function may be necessary when
passing a reference to a function or when returning it. The reference in
this instance will be set to null after the call returns.
*/
IsolatedRef move() { auto r = m_ref; m_ref = null; return IsolatedRef(r); }
/// ditto
void move(ref IsolatedRef target) { target.m_ref = m_ref; m_ref = null; }
/**
Convert the isolated reference to a normal mutable reference.
The reference in this instance will be set to null after the call returns.
*/
Tref extract()
{
auto ret = m_ref;
m_ref = null;
return ret;
}
/**
Converts the isolated reference to immutable.
The reference in this instance will be set to null after the call has returned.
Note that this method is only available for strongly isolated references,
which means references that do not contain shared aliasing.
*/
Tiref freeze()()
{
static assert(isStronglyIsolated!(FieldTypeTuple!T), "freeze() can only be called on strongly isolated values, but "~T.stringof~" contains shared references.");
auto ret = m_ref;
m_ref = null;
return cast(immutable)ret;
}
/**
Performs an up- or down-cast of the reference and moves it to a new IsolatedRef instance.
The reference in this instance will be set to null after the call has returned.
*/
U opCast(U)()
if (isInstanceOf!(IsolatedRef, U) && (is(U.BaseType : BaseType) || is(BaseType : U.BaseType)))
{
auto r = U(cast(U.BaseType)m_ref);
m_ref = null;
return r;
}
/**
Determines if the contained reference is non-null.
This method allows Isolated references to be used in boolean expressions without having to
extract the reference.
*/
U opCast(U)() const if(is(U == bool)) { return m_ref !is null; }
}
/// private
private struct IsolatedArray(T)
{
static assert(isWeaklyIsolated!T, T.stringof ~ " contains non-immutable references. Isolation cannot be guaranteed.");
enum __isWeakIsolatedType = true;
static if( isStronglyIsolated!T )
enum __isIsolatedType = true;
alias BaseType = T[];
private T[] m_array;
mixin isolatedArrayMethods!T;
@disable this(this);
/**
Returns the raw reference.
Note that using this function breaks type safety. Be sure to not escape the reference.
*/
inout(T[]) unsafeGet() inout { return m_array; }
IsolatedArray!T move() pure { auto r = m_array; m_array = null; return IsolatedArray(r); }
void move(ref IsolatedArray target) pure { target.m_array = m_array; m_array = null; }
T[] extract()
pure {
auto arr = m_array;
m_array = null;
return arr;
}
immutable(T)[] freeze()() pure
{
static assert(isStronglyIsolated!T, "Freeze can only be called on strongly isolated values, but "~T.stringof~" contains shared references.");
auto arr = m_array;
m_array = null;
return cast(immutable)arr;
}
/**
Splits the array into individual slices at the given incides.
The indices must be in ascending order. Any items that are larger than
the last given index will remain in this IsolatedArray.
*/
IsolatedArray!T[] splice(in size_t[] indices...) pure
in {
//import std.algorithm : isSorted;
assert(indices.length > 0, "At least one splice index must be given.");
//assert(isSorted(indices), "Indices must be in ascending order.");
assert(indices[$-1] <= m_array.length, "Splice index out of bounds.");
}
do {
auto ret = new IsolatedArray!T[indices.length];
size_t lidx = 0;
foreach( i, sidx; indices ){
ret[i].m_array = m_array[lidx .. sidx];
lidx = sidx;
}
m_array = m_array[lidx .. $];
return ret;
}
void merge(ref IsolatedArray!T array) pure
in {
assert(array.m_array.ptr == m_array.ptr+m_array.length || array.m_array.ptr+array.length == m_array.ptr,
"Argument to merge() must be a neighbouring array partition.");
}
do {
if( array.m_array.ptr == m_array.ptr + m_array.length ){
m_array = m_array.ptr[0 .. m_array.length + array.length];
} else {
m_array = array.m_array.ptr[0 .. m_array.length + array.length];
}
array.m_array.length = 0;
}
}
/// private
private struct IsolatedAssociativeArray(K, V)
{
pure:
static assert(isWeaklyIsolated!K, "Key type has aliasing. Memory isolation cannot be guaranteed.");
static assert(isWeaklyIsolated!V, "Value type has aliasing. Memory isolation cannot be guaranteed.");
enum __isWeakIsolatedType = true;
static if( isStronglyIsolated!K && isStronglyIsolated!V )
enum __isIsolatedType = true;
alias BaseType = V[K];
private {
V[K] m_aa;
}
mixin isolatedAssociativeArrayMethods!(K, V);
/**
Returns the raw reference.
Note that using this function breaks type safety. Be sure to not escape the reference.
*/
inout(V[K]) unsafeGet() inout { return m_aa; }
IsolatedAssociativeArray move() { auto r = m_aa; m_aa = null; return IsolatedAssociativeArray(r); }
void move(ref IsolatedAssociativeArray target) { target.m_aa = m_aa; m_aa = null; }
V[K] extract()
{
auto arr = m_aa;
m_aa = null;
return arr;
}
static if( is(typeof(IsolatedAssociativeArray.__isIsolatedType)) ){
immutable(V)[K] freeze()
{
auto arr = m_aa;
m_aa = null;
return cast(immutable(V)[K])(arr);
}
immutable(V[K]) freeze2()
{
auto arr = m_aa;
m_aa = null;
return cast(immutable(V[K]))(arr);
}
}
}
/** Encapsulates a reference in a way that disallows escaping it or any contained references.
*/
template ScopedRef(T)
{
static if( isAggregateType!T ) alias ScopedRef = ScopedRefAggregate!T;
else static if( isAssociativeArray!T ) alias ScopedRef = ScopedRefAssociativeArray!T;
else static if( isArray!T ) alias ScopedRef = ScopedRefArray!T;
else static if( isBasicType!T ) alias ScopedRef = ScopedRefBasic!T;
else static assert(false, "Unsupported type for ScopedRef: "~T.stringof);
}
/// private
private struct ScopedRefBasic(T)
{
private T* m_ref;
@disable this(this);
this(ref T tref) pure { m_ref = &tref; }
//void opAssign(T value) { *m_ref = value; }
ref T unsafeGet() pure { return *m_ref; }
alias unsafeGet this;
}
/// private
private struct ScopedRefAggregate(T)
{
private T* m_ref;
@disable this(this);
this(ref T tref) pure { m_ref = &tref; }
//void opAssign(T value) { *m_ref = value; }
ref T unsafeGet() pure { return *m_ref; }
static if( is(T == shared) ){
auto lock() pure { return .lock(unsafeGet()); }
} else {
mixin(isolatedAggregateMethodsString!T());
//mixin isolatedAggregateMethods!T;
}
}
/// private
private struct ScopedRefArray(T)
{
alias V = typeof(T.init[0]) ;
private T* m_ref;
private @property ref T m_array() pure { return *m_ref; }
private @property ref const(T) m_array() const pure { return *m_ref; }
mixin isolatedArrayMethods!(V, !is(T == const) && !is(T == immutable));
@disable this(this);
this(ref T tref) pure { m_ref = &tref; }
//void opAssign(T value) { *m_ref = value; }
ref T unsafeGet() pure { return *m_ref; }
}
/// private
private struct ScopedRefAssociativeArray(K, V)
{
alias K = KeyType!T;
alias V = ValueType!T;
private T* m_ref;
private @property ref T m_array() pure { return *m_ref; }
private @property ref const(T) m_array() const pure { return *m_ref; }
mixin isolatedAssociativeArrayMethods!(K, V);
@disable this(this);
this(ref T tref) pure { m_ref = &tref; }
//void opAssign(T value) { *m_ref = value; }
ref T unsafeGet() pure { return *m_ref; }
}
/******************************************************************************/
/* COMMON MIXINS FOR NON-REF-ESCAPING WRAPPER STRUCTS */
/******************************************************************************/
/// private
/*private mixin template(T) isolatedAggregateMethods
{
mixin(isolatedAggregateMethodsString!T());
}*/
/// private
private string isolatedAggregateMethodsString(T)()
{
import vibe.internal.meta.traits;
string ret = generateModuleImports!T();
//pragma(msg, "Type '"~T.stringof~"'");
foreach( mname; __traits(allMembers, T) ){
static if (isPublicMember!(T, mname)) {
static if (isRWPlainField!(T, mname)) {
alias mtype = typeof(__traits(getMember, T, mname)) ;
auto mtypename = fullyQualifiedName!mtype;
//pragma(msg, " field " ~ mname ~ " : " ~ mtype.stringof);
ret ~= "@property ScopedRef!(const("~mtypename~")) "~mname~"() const pure { return ScopedRef!(const("~mtypename~"))(m_ref."~mname~"); }\n";
ret ~= "@property ScopedRef!("~mtypename~") "~mname~"() pure { return ScopedRef!("~mtypename~")(m_ref."~mname~"); }\n";
static if( !is(mtype == const) && !is(mtype == immutable) ){
static if( isWeaklyIsolated!mtype ){
ret ~= "@property void "~mname~"("~mtypename~" value) pure { m_ref."~mname~" = value; }\n";
} else {
ret ~= "@property void "~mname~"(AT)(AT value) pure { static assert(isWeaklyIsolated!AT); m_ref."~mname~" = value.unsafeGet(); }\n";
}
}
} else {
foreach( method; __traits(getOverloads, T, mname) ){
alias ftype = FunctionTypeOf!method;
// only pure functions are allowed (or they could escape references to global variables)
// don't allow non-isolated references to be escaped
if( functionAttributes!ftype & FunctionAttribute.pure_ &&
isWeaklyIsolated!(ReturnType!ftype) )
{
static if( __traits(isStaticFunction, method) ){
//pragma(msg, " static method " ~ mname ~ " : " ~ ftype.stringof);
ret ~= "static "~fullyQualifiedName!(ReturnType!ftype)~" "~mname~"(";
foreach( i, P; ParameterTypeTuple!ftype ){
if( i > 0 ) ret ~= ", ";
ret ~= fullyQualifiedName!P ~ " p"~i.stringof;
}
ret ~= "){ return "~fullyQualifiedName!T~"."~mname~"(";
foreach( i, P; ParameterTypeTuple!ftype ){
if( i > 0 ) ret ~= ", ";
ret ~= "p"~i.stringof;
}
ret ~= "); }\n";
} else if (mname != "__ctor") {
//pragma(msg, " normal method " ~ mname ~ " : " ~ ftype.stringof);
if( is(ftype == const) ) ret ~= "const ";
if( is(ftype == shared) ) ret ~= "shared ";
if( is(ftype == immutable) ) ret ~= "immutable ";
if( functionAttributes!ftype & FunctionAttribute.pure_ ) ret ~= "pure ";
if( functionAttributes!ftype & FunctionAttribute.property ) ret ~= "@property ";
ret ~= fullyQualifiedName!(ReturnType!ftype)~" "~mname~"(";
foreach( i, P; ParameterTypeTuple!ftype ){
if( i > 0 ) ret ~= ", ";
ret ~= fullyQualifiedName!P ~ " p"~i.stringof;
}
ret ~= "){ return m_ref."~mname~"(";
foreach( i, P; ParameterTypeTuple!ftype ){
if( i > 0 ) ret ~= ", ";
ret ~= "p"~i.stringof;
}
ret ~= "); }\n";
}
}
}
}
} //else pragma(msg, " non-public field " ~ mname);
}
return ret;
}
/// private
private mixin template isolatedArrayMethods(T, bool mutableRef = true)
{
@property size_t length() const pure { return m_array.length; }
@property bool empty() const pure { return m_array.length == 0; }
static if( mutableRef ){
@property void length(size_t value) pure { m_array.length = value; }
void opOpAssign(string op)(T item) pure if (op == "~")
{
static if( isCopyable!T ) m_array ~= item;
else {
m_array.length++;
m_array[$-1] = item;
}
}
void opOpAssign(string op)(IsolatedArray!T array) pure if (op == "~")
{
static if( isCopyable!T ) m_array ~= array.m_array;
else {
size_t start = m_array.length;
m_array.length += array.length;
foreach( i, ref itm; array.m_array )
m_array[start+i] = itm;
}
}
}
ScopedRef!(const(T)) opIndex(size_t idx) const pure { return ScopedRef!(const(T))(m_array[idx]); }
ScopedRef!T opIndex(size_t idx) pure { return ScopedRef!T(m_array[idx]); }
static if( !is(T == const) && !is(T == immutable) )
void opIndexAssign(T value, size_t idx) pure { m_array[idx] = value; }
int opApply(int delegate(ref size_t, ref ScopedRef!T) del)
pure {
foreach( idx, ref v; m_array ){
auto noref = ScopedRef!T(v);
if( auto ret = (cast(int delegate(ref size_t, ref ScopedRef!T) pure)del)(idx, noref) )
return ret;
}
return 0;
}
int opApply(int delegate(ref size_t, ref ScopedRef!(const(T))) del)
const pure {
foreach( idx, ref v; m_array ){
auto noref = ScopedRef!(const(T))(v);
if( auto ret = (cast(int delegate(ref size_t, ref ScopedRef!(const(T))) pure)del)(idx, noref) )
return ret;
}
return 0;
}
int opApply(int delegate(ref ScopedRef!T) del)
pure {
foreach( v; m_array ){
auto noref = ScopedRef!T(v);
if( auto ret = (cast(int delegate(ref ScopedRef!T) pure)del)(noref) )
return ret;
}
return 0;
}
int opApply(int delegate(ref ScopedRef!(const(T))) del)
const pure {
foreach( v; m_array ){
auto noref = ScopedRef!(const(T))(v);
if( auto ret = (cast(int delegate(ref ScopedRef!(const(T))) pure)del)(noref) )
return ret;
}
return 0;
}
}
/// private
private mixin template isolatedAssociativeArrayMethods(K, V, bool mutableRef = true)
{
@property size_t length() const pure { return m_aa.length; }
@property bool empty() const pure { return m_aa.length == 0; }
static if( !is(V == const) && !is(V == immutable) )
void opIndexAssign(V value, K key) pure { m_aa[key] = value; }
inout(V) opIndex(K key) inout pure { return m_aa[key]; }
int opApply(int delegate(ref ScopedRef!K, ref ScopedRef!V) del)
pure {
foreach( ref k, ref v; m_aa )
if( auto ret = (cast(int delegate(ref ScopedRef!K, ref ScopedRef!V) pure)del)(k, v) )
return ret;
return 0;
}
int opApply(int delegate(ref ScopedRef!V) del)
pure {
foreach( ref v; m_aa )
if( auto ret = (cast(int delegate(ref ScopedRef!V) pure)del)(v) )
return ret;
return 0;
}
int opApply(int delegate(ref ScopedRef!(const(K)), ref ScopedRef!(const(V))) del)
const pure {
foreach( ref k, ref v; m_aa )
if( auto ret = (cast(int delegate(ref ScopedRef!(const(K)), ref ScopedRef!(const(V))) pure)del)(k, v) )
return ret;
return 0;
}
int opApply(int delegate(ref ScopedRef!(const(V))) del)
const pure {
foreach( v; m_aa )
if( auto ret = (cast(int delegate(ref ScopedRef!(const(V))) pure)del)(v) )
return ret;
return 0;
}
}
/******************************************************************************/
/* UTILITY FUNCTIONALITY */
/******************************************************************************/
// private
private @property string generateModuleImports(T)()
{
bool[string] visited;
//pragma(msg, "generateModuleImports "~T.stringof);
return generateModuleImportsImpl!T(visited);
}
private @property string generateModuleImportsImpl(T, TYPES...)(ref bool[string] visited)
{
string ret;
//pragma(msg, T);
//pragma(msg, TYPES);
static if( !haveTypeAlready!(T, TYPES) ){
void addModule(string mod){
if( mod !in visited ){
ret ~= "static import "~mod~";\n";
visited[mod] = true;
}
}
static if( isAggregateType!T && !is(typeof(T.__isWeakIsolatedType)) ){ // hack to avoid a recursive template instantiation when Isolated!T is passed to moduleName
addModule(moduleName!T);
foreach( member; __traits(allMembers, T) ){
//static if( isPublicMember!(T, member) ){
static if( !is(typeof(__traits(getMember, T, member))) ){
// ignore sub types
} else static if( !is(FunctionTypeOf!(__traits(getMember, T, member)) == function) ){
alias mtype = typeof(__traits(getMember, T, member)) ;
ret ~= generateModuleImportsImpl!(mtype, T, TYPES)(visited);
} else static if( is(T == class) || is(T == interface) ){
foreach( overload; MemberFunctionsTuple!(T, member) ){
ret ~= generateModuleImportsImpl!(ReturnType!overload, T, TYPES)(visited);
foreach( P; ParameterTypeTuple!overload )
ret ~= generateModuleImportsImpl!(P, T, TYPES)(visited);
}
} // TODO: handle structs!
//}
}
}
else static if( isPointer!T ) ret ~= generateModuleImportsImpl!(PointerTarget!T, T, TYPES)(visited);
else static if( isArray!T ) ret ~= generateModuleImportsImpl!(typeof(T.init[0]), T, TYPES)(visited);
else static if( isAssociativeArray!T ) ret ~= generateModuleImportsImpl!(KeyType!T, T, TYPES)(visited) ~ generateModuleImportsImpl!(ValueType!T, T, TYPES)(visited);
}
return ret;
}
template haveTypeAlready(T, TYPES...)
{
static if( TYPES.length == 0 ) enum haveTypeAlready = false;
else static if( is(T == TYPES[0]) ) enum haveTypeAlready = true;
else alias haveTypeAlready = haveTypeAlready!(T, TYPES[1 ..$]);
}
/******************************************************************************/
/* Additional traits useful for handling isolated data */
/******************************************************************************/
/**
Determines if the given list of types has any non-immutable aliasing outside of their object tree.
The types in particular may only contain plain data, pointers or arrays to immutable data, or references
encapsulated in stdx.typecons.Isolated.
*/
template isStronglyIsolated(T...)
{
static if (T.length == 0) enum bool isStronglyIsolated = true;
else static if (T.length > 1) enum bool isStronglyIsolated = isStronglyIsolated!(T[0 .. $/2]) && isStronglyIsolated!(T[$/2 .. $]);
else {
static if (is(T[0] == immutable)) enum bool isStronglyIsolated = true;
else static if(isInstanceOf!(Rebindable, T[0])) enum bool isStronglyIsolated = isStronglyIsolated!(typeof(T[0].get()));
else static if (is(typeof(T[0].__isIsolatedType))) enum bool isStronglyIsolated = true;
else static if (is(T[0] == class)) enum bool isStronglyIsolated = false;
else static if (is(T[0] == interface)) enum bool isStronglyIsolated = false; // can't know if the implementation is isolated
else static if (is(T[0] == delegate)) enum bool isStronglyIsolated = false; // can't know to what a delegate points
else static if (isDynamicArray!(T[0])) enum bool isStronglyIsolated = is(typeof(T[0].init[0]) == immutable);
else static if (isAssociativeArray!(T[0])) enum bool isStronglyIsolated = false; // TODO: be less strict here
else static if (isSomeFunction!(T[0])) enum bool isStronglyIsolated = true; // functions are immutable
else static if (isPointer!(T[0])) enum bool isStronglyIsolated = is(typeof(*T[0].init) == immutable);
else static if (isAggregateType!(T[0])) enum bool isStronglyIsolated = isStronglyIsolated!(FieldTypeTuple!(T[0]));
else enum bool isStronglyIsolated = true;
}
}
/**
Determines if the given list of types has any non-immutable and unshared aliasing outside of their object tree.
The types in particular may only contain plain data, pointers or arrays to immutable or shared data, or references
encapsulated in stdx.typecons.Isolated. Values that do not have unshared and unisolated aliasing are safe to be passed
between threads.
*/
template isWeaklyIsolated(T...)
{
static if (T.length == 0) enum bool isWeaklyIsolated = true;
else static if (T.length > 1) enum bool isWeaklyIsolated = isWeaklyIsolated!(T[0 .. $/2]) && isWeaklyIsolated!(T[$/2 .. $]);
else {
static if(is(T[0] == immutable)) enum bool isWeaklyIsolated = true;
else static if (is(T[0] == shared)) enum bool isWeaklyIsolated = true;
else static if (isInstanceOf!(Rebindable, T[0])) enum bool isWeaklyIsolated = isWeaklyIsolated!(typeof(T[0].get()));
else static if (is(T[0] : Throwable)) enum bool isWeaklyIsolated = true; // WARNING: this is unsafe, but needed for send/receive!
else static if (is(typeof(T[0].__isIsolatedType))) enum bool isWeaklyIsolated = true;
else static if (is(typeof(T[0].__isWeakIsolatedType))) enum bool isWeaklyIsolated = true;
else static if (is(T[0] == class)) enum bool isWeaklyIsolated = false;
else static if (is(T[0] == interface)) enum bool isWeaklyIsolated = false; // can't know if the implementation is isolated
else static if (is(T[0] == delegate)) enum bool isWeaklyIsolated = T[0].stringof.endsWith(" shared"); // can't know to what a delegate points - FIXME: use something better than a string comparison
else static if (isDynamicArray!(T[0])) enum bool isWeaklyIsolated = is(typeof(T[0].init[0]) == immutable);
else static if (isAssociativeArray!(T[0])) enum bool isWeaklyIsolated = false; // TODO: be less strict here
else static if (isSomeFunction!(T[0])) enum bool isWeaklyIsolated = true; // functions are immutable
else static if (isPointer!(T[0])) enum bool isWeaklyIsolated = is(typeof(*T[0].init) == immutable) || is(typeof(*T[0].init) == shared);
else static if (isAggregateType!(T[0])) enum bool isWeaklyIsolated = isWeaklyIsolated!(FieldTypeTuple!(T[0]));
else enum bool isWeaklyIsolated = true;
}
}
unittest {
static class A { int x; string y; }
static struct B {
string a; // strongly isolated
Isolated!A b; // strongly isolated
version(EnablePhobosFails)
Isolated!(Isolated!A[]) c; // strongly isolated
version(EnablePhobosFails)
Isolated!(Isolated!A[string]) c; // AA implementation does not like this
version(EnablePhobosFails)
Isolated!(int[string]) d; // strongly isolated
}
static struct C {
string a; // strongly isolated
shared(A) b; // weakly isolated
Isolated!A c; // strongly isolated
shared(A*) d; // weakly isolated
shared(A[]) e; // weakly isolated
shared(A[string]) f; // weakly isolated
}
static struct D { A a; } // not isolated
static struct E { void delegate() a; } // not isolated
static struct F { void function() a; } // strongly isolated (functions are immutable)
static struct G { void test(); } // strongly isolated
static struct H { A[] a; } // not isolated
static interface I {}
static assert(!isStronglyIsolated!A);
static assert(isStronglyIsolated!(FieldTypeTuple!A));
static assert(isStronglyIsolated!B);
static assert(!isStronglyIsolated!C);
static assert(!isStronglyIsolated!D);
static assert(!isStronglyIsolated!E);
static assert(isStronglyIsolated!F);
static assert(isStronglyIsolated!G);
static assert(!isStronglyIsolated!H);
static assert(!isStronglyIsolated!I);
static assert(!isWeaklyIsolated!A);
static assert(isWeaklyIsolated!(FieldTypeTuple!A));
static assert(isWeaklyIsolated!B);
static assert(isWeaklyIsolated!C);
static assert(!isWeaklyIsolated!D);
static assert(!isWeaklyIsolated!E);
static assert(isWeaklyIsolated!F);
static assert(isWeaklyIsolated!G);
static assert(!isWeaklyIsolated!H);
static assert(!isWeaklyIsolated!I);
}
template isCopyable(T)
{
static if( __traits(compiles, {foreach( t; [T.init]){}}) ) enum isCopyable = true;
else enum isCopyable = false;
}
/******************************************************************************/
/* Future (promise) suppport */
/******************************************************************************/
/**
Represents a values that will be computed asynchronously.
This type uses $(D alias this) to enable transparent access to the result
value.
*/
struct Future(T) {
private {
FreeListRef!(shared(T)) m_result;
Task m_task;
}
/// Checks if the values was fully computed.
@property bool ready() const { return !m_task.running; }
/** Returns the computed value.
This function waits for the computation to finish, if necessary, and
then returns the final value. In case of an uncaught exception
happening during the computation, the exception will be thrown
instead.
*/
ref T getResult()
{
if (!ready) m_task.join();
assert(ready, "Task still running after join()!?");
return *cast(T*)m_result.get(); // casting away shared is safe, because this is a unique reference
}
alias getResult this;
private void init()
{
m_result = FreeListRef!(shared(T))();
}
}
/**
Starts an asynchronous computation and returns a future for the result value.
If the supplied callable and arguments are all weakly isolated,
$(D vibe.core.core.runWorkerTask) will be used to perform the computation.
Otherwise, $(D vibe.core.core.runTask) will be used.
Params:
callable: A callable value, can be either a function, a delegate, or a
user defined type that defines an $(D opCall).
args: Arguments to pass to the callable.
Returns:
Returns a $(D Future) object that can be used to access the result.
See_also: $(D isWeaklyIsolated)
*/
Future!(ReturnType!CALLABLE) async(CALLABLE, ARGS...)(CALLABLE callable, ARGS args)
if (is(typeof(callable(args)) == ReturnType!CALLABLE))
{
import vibe.core.core;
alias RET = ReturnType!CALLABLE;
Future!RET ret;
ret.init();
static void compute(FreeListRef!(shared(RET)) dst, CALLABLE callable, ARGS args) {
*dst = cast(shared(RET))callable(args);
}
static if (isWeaklyIsolated!CALLABLE && isWeaklyIsolated!ARGS) {
ret.m_task = runWorkerTaskH(&compute, ret.m_result, callable, args);
} else {
ret.m_task = runTask(&compute, ret.m_result, callable, args);
}
return ret;
}
///
unittest {
import vibe.core.core;
import vibe.core.log;
void test()
{
static if (__VERSION__ >= 2065) {
auto val = async({
logInfo("Starting to compute value in worker task.");
sleep(500.msecs); // simulate some lengthy computation
logInfo("Finished computing value in worker task.");
return 32;
});
logInfo("Starting computation in main task");
sleep(200.msecs); // simulate some lengthy computation
logInfo("Finished computation in main task. Waiting for async value.");
logInfo("Result: %s", val.getResult());
}
}
}
/******************************************************************************/
/******************************************************************************/
/* std.concurrency compatible interface for message passing */
/******************************************************************************/
/******************************************************************************/
static if (newStdConcurrency) {
void send(ARGS...)(Task task, ARGS args) { std.concurrency.send(task.tidInfo.ident, args); }
void prioritySend(ARGS...)(Task task, ARGS args) { std.concurrency.prioritySend(task.tidInfo.ident, args); }
package class VibedScheduler : Scheduler {
import core.sync.mutex;
import vibe.core.core;
import vibe.core.sync;
override void start(void delegate() op) { op(); }
override void spawn(void delegate() op) { runTask(op); }
override void yield() {}
override @property ref ThreadInfo thisInfo() { return Task.getThis().tidInfo; }
override TaskCondition newCondition(Mutex m) { return new TaskCondition(m); }
}
} else {
alias Tid = Task;
/// Returns the Tid of the caller (same as Task.getThis())
@property Tid thisTid() { return Task.getThis(); }
void send(ARGS...)(Tid tid, ARGS args)
{
assert (tid != Task(), "Invalid task handle");
static assert(args.length > 0, "Need to send at least one value.");
foreach(A; ARGS){
static assert(isWeaklyIsolated!A, "Only objects with no unshared or unisolated aliasing may be sent, not "~A.stringof~".");
}
tid.messageQueue.send(Variant(IsolatedValueProxyTuple!ARGS(args)));
}
void prioritySend(ARGS...)(Tid tid, ARGS args)
{
assert (tid != Task(), "Invalid task handle");
static assert(args.length > 0, "Need to send at least one value.");
foreach(A; ARGS){
static assert(isWeaklyIsolated!A, "Only objects with no unshared or unisolated aliasing may be sent, not "~A.stringof~".");
}
tid.messageQueue.prioritySend(Variant(IsolatedValueProxyTuple!ARGS(args)));
}
// TODO: handle special exception types
void receive(OPS...)(OPS ops)
{
auto tid = Task.getThis();
tid.messageQueue.receive(opsFilter(ops), opsHandler(ops));
}
auto receiveOnly(ARGS...)()
{
import std.algorithm : move;
ARGS ret;
receive(
(ARGS val) { move(val, ret); },
(LinkTerminated e) { throw e; },
(OwnerTerminated e) { throw e; },
(Variant val) { throw new MessageMismatch(format("Unexpected message type %s, expected %s.", val.type, ARGS.stringof)); }
);
static if(ARGS.length == 1) return ret[0].move();
else return tuple(ret);
}
bool receiveTimeout(OPS...)(Duration timeout, OPS ops)
{
auto tid = Task.getThis();
return tid.messageQueue.receiveTimeout!OPS(timeout, opsFilter(ops), opsHandler(ops));
}
void setMaxMailboxSize(Tid tid, size_t messages, OnCrowding on_crowding)
{
final switch(on_crowding){
case OnCrowding.block: setMaxMailboxSize(tid, messages, null); break;
case OnCrowding.throwException: setMaxMailboxSize(tid, messages, &onCrowdingThrow); break;
case OnCrowding.ignore: setMaxMailboxSize(tid, messages, &onCrowdingDrop); break;
}
}
void setMaxMailboxSize(Tid tid, size_t messages, bool function(Tid) on_crowding)
{
tid.messageQueue.setMaxSize(messages, on_crowding);
}
unittest {
static class CLS {}
static assert(is(typeof(send(Tid.init, makeIsolated!CLS()))));
static assert(is(typeof(send(Tid.init, 1))));
static assert(is(typeof(send(Tid.init, 1, "str", makeIsolated!CLS()))));
static assert(!is(typeof(send(Tid.init, new CLS))));
static assert(is(typeof(receive((Isolated!CLS){}))));
static assert(is(typeof(receive((int){}))));
static assert(is(typeof(receive!(void delegate(int, string, Isolated!CLS))((int, string, Isolated!CLS){}))));
static assert(!is(typeof(receive((CLS){}))));
}
private bool onCrowdingThrow(Task tid){
import std.concurrency : Tid;
throw new MailboxFull(Tid());
}
private bool onCrowdingDrop(Task tid){
return false;
}
private struct IsolatedValueProxyTuple(T...)
{
staticMap!(IsolatedValueProxy, T) fields;
this(ref T values)
{
foreach (i, Ti; T) {
static if (isInstanceOf!(IsolatedSendProxy, IsolatedValueProxy!Ti)) {
fields[i] = IsolatedValueProxy!Ti(values[i].unsafeGet());
} else fields[i] = values[i];
}
}
}
private template IsolatedValueProxy(T)
{
static if (isInstanceOf!(IsolatedRef, T) || isInstanceOf!(IsolatedArray, T) || isInstanceOf!(IsolatedAssociativeArray, T)) {
alias IsolatedValueProxy = IsolatedSendProxy!(T.BaseType);
} else {
alias IsolatedValueProxy = T;
}
}
/+unittest {
static class Test {}
void test() {
Task.getThis().send(new immutable Test, makeIsolated!Test());
}
}+/
private struct IsolatedSendProxy(T) { alias BaseType = T; T value; }
private bool callBool(F, T...)(F fnc, T args)
{
static string caller(string prefix)
{
import std.conv;
string ret = prefix ~ "fnc(";
foreach (i, Ti; T) {
static if (i > 0) ret ~= ", ";
static if (isInstanceOf!(IsolatedSendProxy, Ti)) ret ~= "assumeIsolated(args["~to!string(i)~"].value)";
else ret ~= "args["~to!string(i)~"]";
}
ret ~= ");";
return ret;
}
static assert(is(ReturnType!F == bool) || is(ReturnType!F == void),
"Message handlers must return either bool or void.");
static if (is(ReturnType!F == bool)) mixin(caller("return "));
else {
mixin(caller(""));
return true;
}
}
private bool delegate(Variant) opsFilter(OPS...)(OPS ops)
{
return (Variant msg) {
if (msg.convertsTo!Throwable) return true;
foreach (i, OP; OPS)
if (matchesHandler!OP(msg))
return true;
return false;
};
}
private void delegate(Variant) opsHandler(OPS...)(OPS ops)
{
return (Variant msg) {
foreach (i, OP; OPS) {
alias PTypes = ParameterTypeTuple!OP;
if (matchesHandler!OP(msg)) {
static if (PTypes.length == 1 && is(PTypes[0] == Variant)) {
if (callBool(ops[i], msg)) return; // WARNING: proxied isolated values will go through verbatim!
} else {
auto msgt = msg.get!(IsolatedValueProxyTuple!PTypes);
if (callBool(ops[i], msgt.fields)) return;
}
}
}
if (msg.convertsTo!Throwable)
throw msg.get!Throwable();
};
}
private bool matchesHandler(F)(Variant msg)
{
alias PARAMS = ParameterTypeTuple!F;
if (PARAMS.length == 1 && is(PARAMS[0] == Variant)) return true;
else return msg.convertsTo!(IsolatedValueProxyTuple!PARAMS);
}
}
|
D
|
instance Mil_306_Tuerwache(Npc_Default)
{
name[0] = "Judge's House Guard";
guild = GIL_MIL;
id = 306;
voice = 7;
flags = 0;
npcType = NPCTYPE_AMBIENT;
B_SetAttributesToChapter(self,3);
fight_tactic = FAI_HUMAN_STRONG;
EquipItem(self,ItMw_1h_Mil_Sword);
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_Fighter",Face_L_ToughBald01,BodyTex_L,ItAr_MIL_M);
Mdl_SetModelFatness(self,1);
Mdl_ApplyOverlayMds(self,"Humans_Militia.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,60);
daily_routine = Rtn_Start_306;
};
func void Rtn_Start_306()
{
TA_Stand_Guarding(8,0,18,45,"NW_CITY_JUDGE_GUARD_01");
TA_Stand_Guarding(18,45,22,0,"NW_CITY_UPTOWN_JUDGE_01");
TA_Stand_Guarding(22,0,8,0,"NW_CITY_JUDGE_GUARD_01");
};
|
D
|
module lib;
// test EH
void throwException()
{
throw new Exception(null);
}
Exception collectException(void delegate() dg)
{
try
dg();
catch (Exception e)
return e;
return null;
}
// test GC
__gshared Object root;
void alloc() { root = new Object(); }
void access() { assert(root.toString() !is null); } // vtbl call will fail if finalized
void free() { root = null; }
Object tls_root;
void tls_alloc() { tls_root = new Object(); }
void tls_access() { assert(tls_root.toString() !is null); } // vtbl call will fail if finalized
void tls_free() { tls_root = null; }
void stack(alias func)()
{
// allocate some extra stack space to not keep references to GC memory on the scanned stack
ubyte[1024] buf = void;
func();
}
void testGC()
{
import core.memory;
stack!alloc();
stack!tls_alloc();
stack!access();
stack!tls_access();
GC.collect();
stack!tls_access();
stack!access();
stack!tls_free();
stack!free();
}
// test Init
import core.atomic : atomicOp;
shared uint shared_static_ctor, shared_static_dtor, static_ctor, static_dtor;
shared static this() { if (atomicOp!"+="(shared_static_ctor, 1) != 1) assert(0); }
shared static ~this() { if (atomicOp!"+="(shared_static_dtor, 1) != 1) assert(0); }
static this() { atomicOp!"+="(static_ctor, 1); }
static ~this() { atomicOp!"+="(static_dtor, 1); }
extern(C) int runTests()
{
try
runTestsImpl();
catch (Throwable)
return 0;
return 1;
}
void runTestsImpl()
{
import core.thread;
bool passed;
try
throwException();
catch (Exception e)
passed = true;
assert(passed);
assert(collectException({throwException();}) !is null);
testGC();
assert(shared_static_ctor == 1);
assert(static_ctor == 1);
static void run()
{
assert(static_ctor == 2);
assert(shared_static_ctor == 1);
testGC();
}
auto thr = new Thread(&run);
thr.start();
thr.join();
assert(static_dtor == 1);
passed = false;
foreach (m; ModuleInfo)
if (m.name == "lib") passed = true;
assert(passed);
}
// Provide a way to initialize D from C programs that are D agnostic.
import core.runtime : rt_init, rt_term;
extern(C) int lib_init()
{
return rt_init();
}
extern(C) int lib_term()
{
return rt_term();
}
shared size_t* _finalizeCounter;
class MyFinalizer
{
~this()
{
import core.atomic;
atomicOp!"+="(*_finalizeCounter, 1);
}
}
class MyFinalizerBig : MyFinalizer
{
ubyte[4096] _big = void;
}
extern(C) void setFinalizeCounter(shared(size_t)* p)
{
_finalizeCounter = p;
}
|
D
|
/**
Mirror _bytesobject.h
Note _bytesobject.h did not exist before python 2.6; however
for python 2, it simply provides aliases to contents of stringobject.h,
so we provide them anyways to make it easier to write portable extension
modules.
*/
module deimos.python.bytesobject;
import deimos.python.pyport;
import deimos.python.object;
import deimos.python.stringobject;
import core.stdc.stdarg;
version(Python_3_0_Or_Later) {
/**
* subclass of PyVarObject.
*
* Invariants:
* ob_sval contains space for 'ob_size+1' elements.
* ob_sval[ob_size] == 0.
* ob_shash is the hash of the string or -1 if not computed yet.
*
*/
extern(C):
struct PyBytesObject{
mixin PyObject_VAR_HEAD;
/// _
Py_hash_t ob_shash;
char[1] _ob_sval;
/// _
@property char* ob_sval()() {
return _ob_sval.ptr;
}
}
///
mixin(PyAPI_DATA!"PyTypeObject PyBytes_Type");
///
mixin(PyAPI_DATA!"PyTypeObject PyBytesIter_Type");
// D translation of C macro:
///
int PyBytes_Check()(PyObject* op) {
return PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS);
}
///
int PyBytes_CheckExact()(PyObject* op) {
return Py_TYPE(op) is &PyBytes_Type;
}
///
PyObject* PyBytes_FromStringAndSize(const(char)*, Py_ssize_t);
///
PyObject* PyBytes_FromString(const(char)*);
///
PyObject* PyBytes_FromObject(PyObject*);
///
PyObject* PyBytes_FromFormatV(const(char)*, va_list);
///
PyObject* PyBytes_FromFormat(const(char)*, ...);
///
Py_ssize_t PyBytes_Size(PyObject*);
///
const(char)* PyBytes_AsString(PyObject*);
///
PyObject* PyBytes_Repr(PyObject*, int);
///
void PyBytes_Concat(PyObject**, PyObject*);
///
void PyBytes_ConcatAndDel(PyObject**, PyObject*);
///
int _PyBytes_Resize(PyObject**, Py_ssize_t);
///
PyObject* _PyBytes_FormatLong(PyObject*, int, int,
int, char**, int*);
///
PyObject* PyBytes_DecodeEscape(const(char)*, Py_ssize_t,
const(char)*, Py_ssize_t,
const(char)*);
// D translation of C macro:
///
const(char)* PyBytes_AS_STRING()(PyObject* op) {
assert(PyBytes_Check(op));
return (cast(PyBytesObject*) op).ob_sval;
}
///
auto PyBytes_GET_SIZE()(PyObject* op) {
assert(PyBytes_Check(op));
return Py_SIZE(op);
}
///
PyObject* _PyBytes_Join(PyObject* sep, PyObject* x);
/**
Params:
obj = string or Unicode object
s = pointer to buffer variable
len = pointer to length variable or NULL (only possible for 0-terminated
strings)
*/
int PyBytes_AsStringAndSize(
PyObject* obj,
char** s,
Py_ssize_t* len
);
///
Py_ssize_t _PyBytes_InsertThousandsGroupingLocale(
char* buffer,
Py_ssize_t n_buffer,
char* digits,
Py_ssize_t n_digits,
Py_ssize_t min_width);
/** Using explicit passed-in values, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
Py_ssize_t _PyBytes_InsertThousandsGrouping(
char* buffer,
Py_ssize_t n_buffer,
char* digits,
Py_ssize_t n_digits,
Py_ssize_t min_width,
const(char)* grouping,
const char* thousands_sep);
///
enum F_LJUST = (1<<0);
///
enum F_SIGN = (1<<1);
///
enum F_BLANK = (1<<2);
///
enum F_ALT = (1<<3);
///
enum F_ZERO = (1<<4);
}else {
///
alias PyStringObject PyBytesObject;
///
alias PyString_Type PyBytes_Type;
///
alias PyString_Check PyBytes_Check;
///
alias PyString_CheckExact PyBytes_CheckExact;
///
alias PyString_CHECK_INTERNED PyBytes_CHECK_INTERNED;
///
alias PyString_AS_STRING PyBytes_AS_STRING;
///
alias PyString_GET_SIZE PyBytes_GET_SIZE;
version(Python_2_6_Or_Later) {
/// Availability: >= 2.6
alias Py_TPFLAGS_STRING_SUBCLASS Py_TPFLAGS_BYTES_SUBCLASS;
}
///
alias PyString_FromStringAndSize PyBytes_FromStringAndSize;
///
alias PyString_FromString PyBytes_FromString;
///
alias PyString_FromFormatV PyBytes_FromFormatV;
///
alias PyString_FromFormat PyBytes_FromFormat;
///
alias PyString_Size PyBytes_Size;
///
alias PyString_AsString PyBytes_AsString;
///
alias PyString_Repr PyBytes_Repr;
///
alias PyString_Concat PyBytes_Concat;
///
alias PyString_ConcatAndDel PyBytes_ConcatAndDel;
///
alias _PyString_Resize _PyBytes_Resize;
///
alias _PyString_Eq _PyBytes_Eq;
///
alias PyString_Format PyBytes_Format;
///
alias _PyString_FormatLong _PyBytes_FormatLong;
///
alias PyString_DecodeEscape PyBytes_DecodeEscape;
///
alias _PyString_Join _PyBytes_Join;
version(Python_2_7_Or_Later) {
// went away in python 2.7
}else {
/// Availability: <= 2.6
alias PyString_Decode PyBytes_Decode;
/// Availability: <= 2.6
alias PyString_Encode PyBytes_Encode;
/// Availability: <= 2.6
alias PyString_AsEncodedObject PyBytes_AsEncodedObject;
/// Availability: <= 2.6
alias PyString_AsDecodedObject PyBytes_AsDecodedObject;
/*
alias PyString_AsEncodedString PyBytes_AsEncodedString;
alias PyString_AsDecodedString PyBytes_AsDecodedString;
*/
}
///
alias PyString_AsStringAndSize PyBytes_AsStringAndSize;
version(Python_2_6_Or_Later) {
/// Availability: >= 2.6
alias _PyString_InsertThousandsGrouping _PyBytes_InsertThousandsGrouping;
}
}
|
D
|
module android.java.android.provider.Telephony_CarrierId;
public import android.java.android.provider.Telephony_CarrierId_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!Telephony_CarrierId;
import import1 = android.java.java.lang.Class;
import import0 = android.java.android.net.Uri;
|
D
|
import std.stdio, std.algorithm, std.conv, std.range;
void main(string[] args) {
auto in1 = File(args[1]);
auto in2 = File(args[2]);
auto out1 = File(args[3],"w");
auto z1 = zip(in1.byLine, in2.byLine);
foreach (ll; z1) {
auto veto = to!int(ll[1]);
auto vals = (ll[0]).split.map!(to!double).array;
out1.writefln("%15.8f %15.8f %10.6f %10.6f %3d",vals[0],vals[1],vals[2],vals[3],1-veto);
}
}
|
D
|
module mach.io.log;
private:
import mach.traits : hash;
import mach.io.stdio : stdio;
import mach.io.file.path : Path;
public:
/// Immediately writes a line to stdout together with a file name and line
/// number. Intended to help debug misbehaving code.
void log(
size_t line = __LINE__, string file = __FILE__
)(){
log!(line, file)("log");
}
/// ditto
void log(
size_t line = __LINE__, string file = __FILE__, Args...
)(
auto ref Args args
){
stdio.writeln(args, " in ", Path(file).basename, "(", line, ")");
stdio.flushout();
}
/// Immediately writes a line to stdout together with a file path, function
/// identifier, and line number. Intended to help debug misbehaving code.
void logv(
size_t line = __LINE__, string file = __FILE__, string func = __FUNCTION__
)(){
log!(line, file, func)("log");
}
/// ditto
void logv(
size_t line = __LINE__, string file = __FILE__, string func = __FUNCTION__, Args...
)(
auto ref Args args
){
stdio.writeln(args, " in ", func, " at ", file, "(", line, ")");
stdio.flushout();
}
/// As the log function, but will output only once even if the same statement
/// is evaluated multiple times. (Per thread. Probably.)
void logonce(
size_t line = __LINE__, string file = __FILE__, string func = __FUNCTION__
)(){
logonce!(line, file, func)("log");
}
/// ditto
void logonce(
size_t line = __LINE__, string file = __FILE__, string func = __FUNCTION__, Args...
)(
auto ref Args args
){
struct logged{
size_t line; string file;
ulong toHash() nothrow @trusted{
return this.line ^ this.file.hash;
}
}
static size_t[logged] logrecord;
auto thislogged = logged(line, file);
if(thislogged !in logrecord){
log!(line, file, func)(args);
logrecord[thislogged] = 1;
}
}
unittest{
// TODO: How to verify output programmatically?
//log;
//log("test");
//log("test", "test");
//foreach(_; 0 .. 10){
// logonce;
// logonce("test");
//}
}
|
D
|
// Copyright Juan Manuel Cabo 2012.
// Copyright Mario Kröplin 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module dunit.framework;
import dunit.assertion;
import dunit.attributes;
import dunit.color;
import core.time;
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;
public import std.typetuple;
struct TestClass
{
string[] tests;
string[string] ignoredTests;
Object function() create;
void function(Object o) beforeClass;
void function(Object o) before;
void function(Object o, string testName) test;
void function(Object o) after;
void function(Object o) afterClass;
}
string[] testClassOrder;
TestClass[string] testClasses;
struct TestSelection
{
string className;
string[] testNames;
}
mixin template Main()
{
int main (string[] args)
{
import std.stdio;
int rval;
try {
rval = dunit_main(args);
} catch (Throwable t) {
writeln(t);
}
readln;
return rval;
}
}
public int dunit_main(string[] args)
{
import std.getopt;
import std.path;
import std.regex;
string[] filters = null;
bool help = false;
bool list = false;
string report = null;
bool verbose = false;
try
{
getopt(args,
"filter|f", &filters,
"help|h", &help,
"list|l", &list,
"report", &report,
"verbose|v", &verbose);
}
catch (Exception exception)
{
stderr.writeln("error: ", exception.msg);
return 1;
}
if (help)
{
writefln("Usage: %s [options]", args.empty ? "testrunner" : baseName(args[0]));
writeln("Run the functions with @Test attribute of all classes that mix in UnitTest.");
writeln();
writeln("Options:");
writeln(" -f, --filter REGEX Select test functions matching the regular expression");
writeln(" Multiple selections are processed in sequence");
writeln(" -h, --help Display usage information, then exit");
writeln(" -l, --list Display the test functions, then exit");
writeln(" --report FILE Write JUnit-style XML test report");
writeln(" -v, --verbose Display more information as the tests are run");
return 0;
}
TestSelection[] testSelections = null;
if (filters is null)
{
foreach (className; testClassOrder)
{
string[] testNames = testClasses[className].tests;
testSelections ~= TestSelection(className, testNames);
}
}
else
{
foreach (filter; filters)
{
foreach (className; testClassOrder)
{
foreach (testName; testClasses[className].tests)
{
string fullyQualifiedName = className ~ '.' ~ testName;
if (match(fullyQualifiedName, filter))
{
auto result = testSelections.find!"a.className == b"(className);
if (result.empty)
testSelections ~= TestSelection(className, [testName]);
else
result.front.testNames ~= testName;
}
}
}
}
}
if (list)
{
foreach (testSelection; testSelections) with (testSelection)
{
foreach (testName; testNames)
{
string fullyQualifiedName = className ~ '.' ~ testName;
writeln(fullyQualifiedName);
}
}
return 0;
}
TestListener[] testListeners = null;
if (verbose)
{
testListeners ~= new DetailReporter();
}
else
{
testListeners ~= new IssueReporter();
}
if (!report.empty)
{
testListeners ~= new XmlReporter(report);
}
auto reporter = new ResultReporter();
testListeners ~= reporter;
runTests(testSelections, testListeners);
return (reporter.errors > 0) ? 1 : (reporter.failures > 0) ? 2 : 0;
}
public static void runTests(TestSelection[] testSelections, TestListener[] testListeners)
in
{
assert(all!"a !is null"(testListeners));
}
body
{
bool tryRun(string phase, void delegate() action)
{
try
{
action();
return true;
}
catch (AssertException exception)
{
foreach (testListener; testListeners)
testListener.addFailure(phase, exception);
return false;
}
catch (Throwable throwable)
{
foreach (testListener; testListeners)
testListener.addError(phase, throwable);
return false;
}
}
foreach (testSelection; testSelections) with (testSelection)
{
foreach (testListener; testListeners)
testListener.enterClass(className);
Object testObject = null;
bool classSetUp = true; // not yet failed
// run each @Test of the class
foreach (testName; testNames)
{
bool success = true;
bool ignore = cast(bool)(testName in testClasses[className].ignoredTests);
foreach (testListener; testListeners)
testListener.enterTest(testName);
scope (exit)
foreach (testListener; testListeners)
testListener.exitTest(success);
// create test object on demand
if (!ignore && testObject is null)
{
if (classSetUp)
{
classSetUp = tryRun("this",
{ testObject = testClasses[className].create(); });
}
if (classSetUp)
{
classSetUp = tryRun("@BeforeClass",
{ testClasses[className].beforeClass(testObject); });
}
}
if (ignore || !classSetUp)
{
string reason = testClasses[className].ignoredTests.get(testName, null);
foreach (testListener; testListeners)
testListener.skip(reason);
success = false;
continue;
}
success = tryRun("@Before",
{ testClasses[className].before(testObject); });
if (success)
{
success = tryRun("@Test",
{ testClasses[className].test(testObject, testName); });
// run @After even if @Test failed
success = tryRun("@After",
{ testClasses[className].after(testObject); })
&& success;
}
}
if (testObject !is null && classSetUp)
{
tryRun("@AfterClass",
{ testClasses[className].afterClass(testObject); });
}
}
foreach (testListener; testListeners)
testListener.exit();
}
interface TestListener
{
public void enterClass(string className);
public void enterTest(string testName);
public void skip(string reason);
public void addFailure(string phase, AssertException exception);
public void addError(string phase, Throwable throwable);
public void exitTest(bool success);
public void exit();
public static string prettyOrigin(string className, string testName, string phase)
{
string origin = prettyOrigin(testName, phase);
if (origin.startsWith('@'))
return className ~ origin;
else
return className ~ '.' ~ origin;
}
public static string prettyOrigin(string testName, string phase)
{
switch (phase)
{
case "@Test":
return testName;
case "this":
case "@BeforeClass":
case "@AfterClass":
return phase;
default:
return testName ~ phase;
}
}
public static string description(Throwable throwable)
{
with (throwable)
{
if (file.empty)
return typeid(throwable).name;
else
return "%s@%s(%d)".format(typeid(throwable).name, file, line);
}
}
}
class IssueReporter : TestListener
{
private struct Issue
{
string testClass;
string testName;
string phase;
Throwable throwable;
}
private Issue[] failures = null;
private Issue[] errors = null;
private string className;
private string testName;
public void enterClass(string className)
{
this.className = className;
}
public void enterTest(string testName)
{
this.testName = testName;
}
public void skip(string reason)
{
writec(Color.onYellow, "S");
}
public void addFailure(string phase, AssertException exception)
{
this.failures ~= Issue(this.className, this.testName, phase, exception);
writec(Color.onRed, "F");
}
public void addError(string phase, Throwable throwable)
{
this.errors ~= Issue(this.className, this.testName, phase, throwable);
writec(Color.onRed, "E");
}
public void exitTest(bool success)
{
if (success)
writec(Color.onGreen, ".");
}
public void exit()
{
writeln();
// report errors
if (!this.errors.empty)
{
writeln();
if (this.errors.length == 1)
writeln("There was 1 error:");
else
writefln("There were %d errors:", this.errors.length);
foreach (i, issue; this.errors)
{
writefln("%d) %s", i + 1,
prettyOrigin(issue.testClass, issue.testName, issue.phase));
writeln(issue.throwable.toString);
writeln("----------------");
}
}
// report failures
if (!this.failures.empty)
{
writeln();
if (this.failures.length == 1)
writeln("There was 1 failure:");
else
writefln("There were %d failures:", this.failures.length);
foreach (i, issue; this.failures)
{
Throwable throwable = issue.throwable;
writefln("%d) %s", i + 1,
prettyOrigin(issue.testClass, issue.testName, issue.phase));
writefln("%s: %s", description(throwable), throwable.msg);
}
}
}
}
class DetailReporter : TestListener
{
private string testName;
private TickDuration startTime;
public void enterClass(string className)
{
writeln(className);
}
public void enterTest(string testName)
{
this.testName = testName;
this.startTime = TickDuration.currSystemTick();
}
public void skip(string reason)
{
writec(Color.yellow, " SKIP: ");
writeln(this.testName);
if (!reason.empty)
writeln(indent(`"%s"`.format(reason)));
}
public void addFailure(string phase, AssertException exception)
{
writec(Color.red, " FAILURE: ");
writeln(prettyOrigin(this.testName, phase));
writeln(indent("%s: %s".format(description(exception), exception.msg)));
}
public void addError(string phase, Throwable throwable)
{
writec(Color.red, " ERROR: ");
writeln(prettyOrigin(this.testName, phase));
writeln(" ", throwable.toString);
writeln("----------------");
}
public void exitTest(bool success)
{
if (success)
{
double elapsed = (TickDuration.currSystemTick() - this.startTime).usecs() / 1_000.0;
writec(Color.green, " OK: ");
writefln("%6.2f ms %s", elapsed, this.testName);
}
}
public void exit()
{
// do nothing
}
private string indent(string s, string indent = " ")
{
return s.splitLines(KeepTerminator.yes).map!(line => indent ~ line).join;
}
}
class ResultReporter : TestListener
{
private uint tests = 0;
private uint failures = 0;
private uint errors = 0;
private uint skips = 0;
public void enterClass(string className)
{
// do nothing
}
public void enterTest(string testName)
{
++this.tests;
}
public void skip(string reason)
{
++this.skips;
}
public void addFailure(string phase, AssertException exception)
{
++this.failures;
}
public void addError(string phase, Throwable throwable)
{
++this.errors;
}
public void exitTest(bool success)
{
// do nothing
}
public void exit()
{
writeln();
writefln("Tests run: %d, Failures: %d, Errors: %d, Skips: %d",
this.tests, this.failures, this.errors, this.skips);
if (this.failures + this.errors == 0)
{
writec(Color.onGreen, "OK");
writeln();
}
else
{
writec(Color.onRed, "NOT OK");
writeln();
}
}
}
class XmlReporter : TestListener
{
import std.xml;
private string fileName;
private Document document;
private Element testSuite;
private Element testCase;
private string className;
private TickDuration startTime;
public this(string fileName)
{
this.fileName = fileName;
this.document = new Document(new Tag("testsuites"));
this.testSuite = new Element("testsuite");
this.testSuite.tag.attr["name"] = "dunit";
this.document ~= this.testSuite;
}
public void enterClass(string className)
{
this.className = className;
}
public void enterTest(string testName)
{
this.testCase = new Element("testcase");
this.testCase.tag.attr["classname"] = this.className;
this.testCase.tag.attr["name"] = testName;
this.testSuite ~= this.testCase;
this.startTime = TickDuration.currSystemTick();
}
public void skip(string reason)
{
// avoid wrong interpretation of more than one child
if (this.testCase.elements.empty)
{
auto element = new Element("skipped");
element.tag.attr["message"] = reason;
this.testCase ~= element;
}
}
public void addFailure(string phase, AssertException exception)
{
// avoid wrong interpretation of more than one child
if (this.testCase.elements.empty)
{
auto element = new Element("failure");
string message = "%s %s: %s".format(phase,
description(exception), exception.msg);
element.tag.attr["message"] = message;
this.testCase ~= element;
}
}
public void addError(string phase, Throwable throwable)
{
// avoid wrong interpretation of more than one child
if (this.testCase.elements.empty)
{
auto element = new Element("error", throwable.info.toString);
string message = "%s %s: %s".format(phase,
description(throwable), throwable.msg);
element.tag.attr["message"] = message;
this.testCase ~= element;
}
}
public void exitTest(bool success)
{
double elapsed = (TickDuration.currSystemTick() - this.startTime).msecs() / 1_000.0;
this.testCase.tag.attr["time"] = "%.3f".format(elapsed);
}
public void exit()
{
import std.file;
string report = join(this.document.pretty(4), "\n") ~ "\n";
write(this.fileName, report);
}
}
/**
* Registers a class as a unit test.
*/
mixin template UnitTest()
{
private static this()
{
import std.range;
alias TypeTuple!(__traits(allMembers, typeof(this))) allMembers;
TestClass testClass;
string[] ignoredTests = _annotations!(typeof(this), Ignore, allMembers).dup;
testClass.tests = _memberFunctions!(typeof(this), Test, allMembers).dup;
foreach (chunk; chunks(ignoredTests, 2))
{
string testName = chunk[0];
string reason = chunk[1];
testClass.ignoredTests[testName] = reason;
}
static Object create()
{
mixin("return new " ~ typeof(this).stringof ~ "();");
}
static void beforeClass(Object o)
{
mixin(_sequence(_memberFunctions!(typeof(this), BeforeClass, allMembers)));
}
static void before(Object o)
{
mixin(_sequence(_memberFunctions!(typeof(this), Before, allMembers)));
}
static void test(Object o, string name)
{
mixin(_choice(_memberFunctions!(typeof(this), Test, allMembers)));
}
static void after(Object o)
{
mixin(_sequence(_memberFunctions!(typeof(this), After, allMembers)));
}
static void afterClass(Object o)
{
mixin(_sequence(_memberFunctions!(typeof(this), AfterClass, allMembers)));
}
testClass.create = &create;
testClass.beforeClass = &beforeClass;
testClass.before = &before;
testClass.test = &test;
testClass.after = &after;
testClass.afterClass = &afterClass;
testClassOrder ~= this.classinfo.name;
testClasses[this.classinfo.name] = testClass;
}
private static string _choice(const string[] memberFunctions)
{
string block = "auto testObject = cast(" ~ typeof(this).stringof ~ ") o;\n";
block ~= "switch (name)\n{\n";
foreach (memberFunction; memberFunctions)
block ~= `case "` ~ memberFunction ~ `": testObject.` ~ memberFunction ~ "(); break;\n";
block ~= "default: break;\n}\n";
return block;
}
private static string _sequence(const string[] memberFunctions)
{
string block = "auto testObject = cast(" ~ typeof(this).stringof ~ ") o;\n";
foreach (memberFunction; memberFunctions)
block ~= "testObject." ~ memberFunction ~ "();\n";
return block;
}
private template _memberFunctions(alias T, attribute, names...)
{
static if (names.length == 0)
immutable(string[]) _memberFunctions = [];
else
static if (__traits(compiles, mixin("(new " ~ T.stringof ~ "())." ~ names[0] ~ "()"))
&& _hasAttribute!(T, names[0], attribute))
immutable(string[]) _memberFunctions = [names[0]] ~ _memberFunctions!(T, attribute, names[1 .. $]);
else
immutable(string[]) _memberFunctions = _memberFunctions!(T, attribute, names[1 .. $]);
}
private template _hasAttribute(alias T, string name, attribute)
{
alias TypeTuple!(__traits(getMember, T, name)) member;
alias TypeTuple!(__traits(getAttributes, member)) attributes;
enum _hasAttribute = staticIndexOf!(attribute, attributes) != -1;
}
private template _annotations(alias T, attribute, names...)
{
static if (names.length == 0)
immutable(string[]) _annotations = [];
else
static if (__traits(compiles, mixin("(new " ~ T.stringof ~ "())." ~ names[0] ~ "()")))
{
alias TypeTuple!(__traits(getMember, T, names[0])) member;
alias TypeTuple!(__traits(getAttributes, member)) attributes;
enum index = _indexOfValue!(attribute, attributes);
static if (index != -1)
immutable(string[]) _annotations = [names[0], attributes[index].reason]
~ _annotations!(T, attribute, names[1 .. $]);
else
immutable(string[]) _annotations = _annotations!(T, attribute, names[1 .. $]);
}
else
immutable(string[]) _annotations = _annotations!(T, attribute, names[1 .. $]);
}
private template _indexOfValue(attribute, T...)
{
static if (T.length == 0)
enum _indexOfValue = -1;
else
static if (is(typeof(T[0]) : attribute))
enum _indexOfValue = 0;
else
{
enum index = _indexOfValue!(attribute, T[1 .. $]);
enum _indexOfValue = (index == -1) ? -1 : index + 1;
}
}
}
|
D
|
/home/silmoon/MyProjects/Rust/simple_web_server_from_scratch/target/rls/debug/deps/main-27531b72f2f514b1.rmeta: src/bin/main.rs
/home/silmoon/MyProjects/Rust/simple_web_server_from_scratch/target/rls/debug/deps/main-27531b72f2f514b1.d: src/bin/main.rs
src/bin/main.rs:
|
D
|
void main()
{
import std.datetime.stopwatch : benchmark;
import std.math, std.parallelism, std.stdio;
auto arr = [8,2,4,8,2,3,5,1,6];
foreach(i, ref elem; arr)
foreach(j, ref selem; arr)
if(arr[i]>arr[j] && i<j)
{
auto temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
foreach(i, ref elem; arr)
writefln("%d",arr[i]);
}
|
D
|
module net.PKI;
private import time.Time;
private import lib.OpenSSL;
const цел SSL_VERIFY_NONE = 0x00;
const цел SSL_VERIFY_PEER = 0x01;
const цел SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 0x02;
const цел SSL_VERIFY_CLIENT_ONCE = 0x04;
const цел SSL_SESS_CACHE_SERVER = 0x0002;
extern (C) typedef цел function(цел, X509_STORE_CTX *ctx) SSLVerifyCallback;
class КонтекстССЛ
{
package SSL_CTX *_ctx = пусто;
private Сертификат _cert = пусто;
private ЧастныйКлюч _key = пусто;
private ХранилищеСертификатов _store = пусто;
this();
~this();
КонтекстССЛ сертификат(Сертификат серт);
КонтекстССЛ частныйКлюч(ЧастныйКлюч ключ);
КонтекстССЛ проверьКлюч();
КонтекстССЛ настройВерификацию(цел флаги, SSLVerifyCallback ов);
КонтекстССЛ сохрани(ХранилищеСертификатов сохрани) ;
КонтекстССЛ путьКСертСА(ткст путь);
SSL_CTX* исконный();
}
class КонтекстХраненияСертификатов
{
private X509_STORE_CTX *_ctx = пусто;
this(X509_STORE_CTX *ctx);
цел ошибка();
цел глубинаОшибки();
}
class ХранилищеСертификатов
{
package X509_STORE *_store = пусто;
Сертификат[] _certs;
this();
~this();
ХранилищеСертификатов добавь(Сертификат серт);
}
class ПубличныйКлюч
{
package RSA *_evpKey = пусто;
private ЧастныйКлюч _existingKey = пусто;
this (ткст publicPemData);
package this(ЧастныйКлюч ключ) ;
~this();
ткст вФорматПЕМ();
бул проверь(ббайт[] данные, ббайт[] сигнатура);
ббайт[] зашифруй(ббайт[] данные);
ббайт[] расшифруй(ббайт[] данные);
}
class ЧастныйКлюч
{
package EVP_PKEY *_evpKey = пусто;
this (ткст privatePemData, ткст certPass = пусто);
this(цел биты);
~this();
override цел opEquals(Объект об);
ткст вФорматПЕМ(ткст пароль = пусто);
ПубличныйКлюч публичныйКлюч();
ббайт[] знак(ббайт[] данные, ббайт[] sigbuf);
ббайт[] зашифруй(ббайт[] данные);
ббайт[] расшифруй(ббайт[] данные);
}
class Сертификат
{
package X509 *_cert = пусто;
private бул readOnly = да;
private бул freeIt = да;
package this (X509 *серт);
this(ткст publicPemData);
this();
~this();
Сертификат серийныйНомер(бцел serial);
бцел серийныйНомер();
Сертификат смещениеКДатеДо(ИнтервалВремени t);
Сертификат смещениеКДатеПосле(ИнтервалВремени t);
ткст датаПосле();
ткст датаДо() ;
Сертификат частныйКлюч(ЧастныйКлюч ключ);
Сертификат установиСубъект(ткст country, ткст stateProvince, ткст city, ткст organization, ткст cn, ткст organizationalUnit = пусто, ткст email = пусто);
ткст субъект() ;
Сертификат знак(Сертификат caCert, ЧастныйКлюч caKey);
override цел opEquals(Объект об);
бул проверь(ХранилищеСертификатов сохрани);
ткст вФорматПЕМ();
private проц добавьЗаписьИмени(X509_NAME *имя, сим *тип, ткст значение);
private проц проверьФлаг();
}
version (Test)
{
import io.Stdout;
auto t1 = ИнтервалВремени.нуль;
auto t2 = ИнтервалВремени.изДней(365); // can't установи this up in delegate ..??
void main()
{
Test.Status _pkeyGenTest(inout ткст[] messages)
{
auto pkey = new ЧастныйКлюч(2048);
ткст pem = pkey.вФорматПЕМ;
auto pkey2 = new ЧастныйКлюч(pem);
if (pkey == pkey2)
{
auto pkey3 = new ЧастныйКлюч(2048);
ткст pem2 = pkey3.вФорматПЕМ("hello");
try
auto pkey4 = new ЧастныйКлюч(pem2, "badpass");
catch (Исключение ex)
{
auto pkey4 = new ЧастныйКлюч(pem2, "hello");
return Test.Status.Success;
}
}
return Test.Status.Failure;
}
Test.Status _certGenTest(inout ткст[] messages)
{
auto серт = new Сертификат();
auto pkey = new ЧастныйКлюч(2048);
серт.частныйКлюч(pkey).серийныйНомер(123).смещениеКДатеДо(t1).смещениеКДатеПосле(t2);
серт.установиСубъект("CA", "Alberta", "Place", "Нет", "First Last", "no unit", "email@example.com").знак(серт, pkey);
ткст pemData = серт.вФорматПЕМ;
auto cert2 = new Сертификат(pemData);
// Стдвыв.форматнс("{}\n{}\n{}\n{}", cert2.серийныйНомер, cert2.субъект, cert2.датаДо, cert2.датаПосле);
if (cert2 == серт)
return Test.Status.Success;
return Test.Status.Failure;
}
Test.Status _chainValопрation(inout ткст[] messages)
{
auto caCert = new Сертификат();
auto caPkey = new ЧастныйКлюч(2048);
caCert.серийныйНомер = 1;
caCert.частныйКлюч = caPkey;
caCert.смещениеКДатеДо = t1;
caCert.смещениеКДатеПосле = t2;
caCert.установиСубъект("CA", "Alberta", "CA Place", "Super CACerts Anon", "CA Manager");
caCert.знак(caCert, caPkey);
auto сохрани = new ХранилищеСертификатов();
сохрани.добавь(caCert);
auto subCert = new Сертификат();
auto subPkey = new ЧастныйКлюч(2048);
subCert.серийныйНомер = 2;
subCert.частныйКлюч = subPkey;
subCert.смещениеКДатеДо = t1;
subCert.смещениеКДатеПосле = t2;
subCert.установиСубъект("US", "California", "Customer Place", "Penny-Pincher", "IT Director");
subCert.знак(caCert, caPkey);
if (subCert.проверь(сохрани))
{
auto fakeCert = new Сертификат();
auto fakePkey = new ЧастныйКлюч(2048);
fakeCert.серийныйНомер = 1;
fakeCert.частныйКлюч = fakePkey;
fakeCert.смещениеКДатеДо = t1;
fakeCert.смещениеКДатеПосле = t2;
fakeCert.установиСубъект("CA", "Alberta", "CA Place", "Super CACerts Anon", "CA Manager");
fakeCert.знак(caCert, caPkey);
auto store2 = new ХранилищеСертификатов();
if (!subCert.проверь(store2))
return Test.Status.Success;
}
return Test.Status.Failure;
}
Test.Status _rsaCrypto(inout ткст[] messages)
{
auto ключ = new ЧастныйКлюч(2048);
ткст pemData = ключ.публичныйКлюч.вФорматПЕМ;
auto pub = new ПубличныйКлюч(pemData);
auto encrypted = pub.зашифруй(cast(ббайт[])"Hello, как are you today?");
auto decrypted = ключ.расшифруй(encrypted);
if (cast(ткст)decrypted == "Hello, как are you today?")
{
encrypted = ключ.зашифруй(cast(ббайт[])"Hello, как are you today, mister?");
decrypted = pub.расшифруй(encrypted);
if (cast(ткст)decrypted == "Hello, как are you today, mister?")
return Test.Status.Success;
}
return Test.Status.Failure;
}
Test.Status _rsaSignVerify(inout ткст[] messages)
{
auto ключ = new ЧастныйКлюч(1024);
auto key2 = new ЧастныйКлюч(1024);
ббайт[] данные = cast(ббайт[])"I am some special данные, да I am.";
ббайт[512] sigBuf;
ббайт[512] sigBuf2;
auto sig1 = ключ.знак(данные, sigBuf);
auto sig2 = key2.знак(данные, sigBuf2);
if (ключ.публичныйКлюч.проверь(данные, sig1))
{
if (!ключ.публичныйКлюч.проверь(данные, sig2))
{
if (key2.публичныйКлюч.проверь(данные, sig2))
{
if (!key2.публичныйКлюч.проверь(данные, sig1))
return Test.Status.Success;
}
}
}
return Test.Status.Failure;
}
auto t = new Test("tetra.net.PKI");
t["Public/Private Keypair"] = &_pkeyGenTest;
t["Self-Signed Сертификат"] = &_certGenTest;
t["Chain Valопрation"] = &_chainValопрation;
t["RSA Crypto"] = &_rsaCrypto;
t["RSA знак/проверь"] = &_rsaSignVerify;
t.run();
}
}
|
D
|
import std.algorithm : min, max;
import std.math;
import std.stdio;
pragma(msg, min(0, float.nan)); //Yields 0
pragma(msg, max(0, float.nan)); //Yields 0
pragma(msg, min(float.nan, 0)); //Yields float.nan
pragma(msg, max(float.nan, 0)); //Yields float.nan
void main()
{
writeln(min(0, float.nan)); //Yields 0
writeln(max(0, float.nan)); //Yields 0
writeln(min(float.nan, 0)); //Yields float.nan
writeln(max(float.nan, 0)); //Yields float.nan
//assert(isNaN(min(0, float.nan)));
}
static assert(min(0, float.nan)==0);
|
D
|
<?xml version="1.0" encoding="ASCII" standalone="no"?>
<di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0">
<pageList>
<availablePage>
<emfPageIdentifier href="VAR_11_banking-7826624355.notation#_copSALmGEeKQQp7P9cQvNQ"/>
</availablePage>
</pageList>
<sashModel currentSelection="//@sashModel/@windows.0/@children.0">
<windows>
<children xsi:type="di:TabFolder">
<children>
<emfPageIdentifier href="VAR_11_banking-7826624355.notation#_copSALmGEeKQQp7P9cQvNQ"/>
</children>
</children>
</windows>
</sashModel>
</di:SashWindowsMngr>
|
D
|
module android.java.android.view.textclassifier.ConversationActions_Message_Builder;
public import android.java.android.view.textclassifier.ConversationActions_Message_Builder_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!ConversationActions_Message_Builder;
import import5 = android.java.android.view.textclassifier.ConversationActions_Message;
import import6 = android.java.java.lang.Class;
import import1 = android.java.android.view.textclassifier.ConversationActions_Message_Builder;
|
D
|
// Compiler implementation of the D programming language
// Copyright (c) 1999-2015 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
module ddmd.dsymbol;
import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.string;
import ddmd.aggregate;
import ddmd.aliasthis;
import ddmd.arraytypes;
import ddmd.attrib;
import ddmd.gluelayer;
import ddmd.dclass;
import ddmd.declaration;
import ddmd.denum;
import ddmd.dimport;
import ddmd.dmodule;
import ddmd.doc;
import ddmd.dscope;
import ddmd.dstruct;
import ddmd.dtemplate;
import ddmd.errors;
import ddmd.expression;
import ddmd.func;
import ddmd.globals;
import ddmd.hdrgen;
import ddmd.id;
import ddmd.identifier;
import ddmd.init;
import ddmd.lexer;
import ddmd.mtype;
import ddmd.nspace;
import ddmd.opover;
import ddmd.root.aav;
import ddmd.root.outbuffer;
import ddmd.root.rmem;
import ddmd.root.rootobject;
import ddmd.root.speller;
import ddmd.root.stringtable;
import ddmd.statement;
import ddmd.tokens;
import ddmd.visitor;
struct Ungag
{
uint oldgag;
extern (D) this(uint old)
{
this.oldgag = old;
}
extern (C++) ~this()
{
global.gag = oldgag;
}
}
enum PROTKIND : int
{
PROTundefined,
PROTnone, // no access
PROTprivate,
PROTpackage,
PROTprotected,
PROTpublic,
PROTexport,
}
alias PROTundefined = PROTKIND.PROTundefined;
alias PROTnone = PROTKIND.PROTnone;
alias PROTprivate = PROTKIND.PROTprivate;
alias PROTpackage = PROTKIND.PROTpackage;
alias PROTprotected = PROTKIND.PROTprotected;
alias PROTpublic = PROTKIND.PROTpublic;
alias PROTexport = PROTKIND.PROTexport;
struct Prot
{
PROTKIND kind;
Package pkg;
extern (D) this(PROTKIND kind)
{
this.kind = kind;
}
/**
* Checks if `this` is superset of `other` restrictions.
* For example, "protected" is more restrictive than "public".
*/
extern (C++) bool isMoreRestrictiveThan(Prot other)
{
return this.kind < other.kind;
}
/**
* Checks if `this` is absolutely identical protection attribute to `other`
*/
extern (C++) bool opEquals(Prot other)
{
if (this.kind == other.kind)
{
if (this.kind == PROTpackage)
return this.pkg == other.pkg;
return true;
}
return false;
}
/**
* Checks if parent defines different access restrictions than this one.
*
* Params:
* parent = protection attribute for scope that hosts this one
*
* Returns:
* 'true' if parent is already more restrictive than this one and thus
* no differentiation is needed.
*/
extern (C++) bool isSubsetOf(Prot parent)
{
if (this.kind != parent.kind)
return false;
if (this.kind == PROTpackage)
{
if (!this.pkg)
return true;
if (!parent.pkg)
return false;
if (parent.pkg.isAncestorPackageOf(this.pkg))
return true;
}
return true;
}
}
enum PASS : int
{
PASSinit, // initial state
PASSsemantic, // semantic() started
PASSsemanticdone, // semantic() done
PASSsemantic2, // semantic2() started
PASSsemantic2done, // semantic2() done
PASSsemantic3, // semantic3() started
PASSsemantic3done, // semantic3() done
PASSinline, // inline started
PASSinlinedone, // inline done
PASSobj, // toObjFile() run
}
alias PASSinit = PASS.PASSinit;
alias PASSsemantic = PASS.PASSsemantic;
alias PASSsemanticdone = PASS.PASSsemanticdone;
alias PASSsemantic2 = PASS.PASSsemantic2;
alias PASSsemantic2done = PASS.PASSsemantic2done;
alias PASSsemantic3 = PASS.PASSsemantic3;
alias PASSsemantic3done = PASS.PASSsemantic3done;
alias PASSinline = PASS.PASSinline;
alias PASSinlinedone = PASS.PASSinlinedone;
alias PASSobj = PASS.PASSobj;
enum : int
{
IgnoreNone = 0x00, // default
IgnorePrivateMembers = 0x01, // don't find private members
IgnoreErrors = 0x02, // don't give error messages
IgnoreAmbiguous = 0x04, // return NULL if ambiguous
}
extern (C++) alias Dsymbol_apply_ft_t = int function(Dsymbol, void*);
/***********************************************************
*/
extern (C++) class Dsymbol : RootObject
{
public:
Identifier ident;
Dsymbol parent;
Symbol* csym; // symbol for code generator
Symbol* isym; // import version of csym
const(char)* comment; // documentation comment for this Dsymbol
Loc loc; // where defined
Scope* _scope; // !=null means context to use for semantic()
bool errors; // this symbol failed to pass semantic()
PASS semanticRun;
char* depmsg; // customized deprecation message
UserAttributeDeclaration userAttribDecl; // user defined attributes
// !=null means there's a ddoc unittest associated with this symbol
// (only use this with ddoc)
UnitTestDeclaration ddocUnittest;
final extern (D) this()
{
//printf("Dsymbol::Dsymbol(%p)\n", this);
this.semanticRun = PASSinit;
}
final extern (D) this(Identifier ident)
{
//printf("Dsymbol::Dsymbol(%p, ident)\n", this);
this.ident = ident;
this.semanticRun = PASSinit;
}
final static Dsymbol create(Identifier ident)
{
return new Dsymbol(ident);
}
override char* toChars()
{
return ident ? ident.toChars() : cast(char*)"__anonymous";
}
// helper to print fully qualified (template) arguments
char* toPrettyCharsHelper()
{
return toChars();
}
final ref Loc getLoc()
{
if (!loc.filename) // avoid bug 5861.
{
Module m = getModule();
if (m && m.srcfile)
loc.filename = m.srcfile.toChars();
}
return loc;
}
final char* locToChars()
{
return getLoc().toChars();
}
override bool equals(RootObject o)
{
if (this == o)
return true;
Dsymbol s = cast(Dsymbol)o;
// Overload sets don't have an ident
if (s && ident && s.ident && ident.equals(s.ident))
return true;
return false;
}
final bool isAnonymous()
{
return ident is null;
}
final void error(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
.verror(loc, format, ap, kind(), toPrettyChars());
va_end(ap);
}
final void error(const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
.verror(getLoc(), format, ap, kind(), toPrettyChars());
va_end(ap);
}
final void deprecation(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
.vdeprecation(loc, format, ap, kind(), toPrettyChars());
va_end(ap);
}
final void deprecation(const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
.vdeprecation(getLoc(), format, ap, kind(), toPrettyChars());
va_end(ap);
}
final void checkDeprecated(Loc loc, Scope* sc)
{
if (global.params.useDeprecated != 1 && isDeprecated())
{
// Don't complain if we're inside a deprecated symbol's scope
for (Dsymbol sp = sc.parent; sp; sp = sp.parent)
{
if (sp.isDeprecated())
goto L1;
}
for (Scope* sc2 = sc; sc2; sc2 = sc2.enclosing)
{
if (sc2.scopesym && sc2.scopesym.isDeprecated())
goto L1;
// If inside a StorageClassDeclaration that is deprecated
if (sc2.stc & STCdeprecated)
goto L1;
}
const(char)* message = null;
for (Dsymbol p = this; p; p = p.parent)
{
message = p.depmsg;
if (message)
break;
}
if (message)
deprecation(loc, "is deprecated - %s", message);
else
deprecation(loc, "is deprecated");
}
L1:
Declaration d = isDeclaration();
if (d && d.storage_class & STCdisable)
{
if (!(sc.func && sc.func.storage_class & STCdisable))
{
if (d.toParent() && d.isPostBlitDeclaration())
d.toParent().error(loc, "is not copyable because it is annotated with @disable");
else
error(loc, "is not callable because it is annotated with @disable");
}
}
}
/**********************************
* Determine which Module a Dsymbol is in.
*/
final Module getModule()
{
//printf("Dsymbol::getModule()\n");
if (TemplateInstance ti = isInstantiated())
return ti.tempdecl.getModule();
Dsymbol s = this;
while (s)
{
//printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
Module m = s.isModule();
if (m)
return m;
s = s.parent;
}
return null;
}
/**********************************
* Determine which Module a Dsymbol is in, as far as access rights go.
*/
final Module getAccessModule()
{
//printf("Dsymbol::getAccessModule()\n");
if (TemplateInstance ti = isInstantiated())
return ti.tempdecl.getAccessModule();
Dsymbol s = this;
while (s)
{
//printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
Module m = s.isModule();
if (m)
return m;
TemplateInstance ti = s.isTemplateInstance();
if (ti && ti.enclosing)
{
/* Because of local template instantiation, the parent isn't where the access
* rights come from - it's the template declaration
*/
s = ti.tempdecl;
}
else
s = s.parent;
}
return null;
}
final Dsymbol pastMixin()
{
Dsymbol s = this;
//printf("Dsymbol::pastMixin() %s\n", toChars());
while (s && s.isTemplateMixin())
s = s.parent;
return s;
}
final Dsymbol toParent()
{
return parent ? parent.pastMixin() : null;
}
/**********************************
* Use this instead of toParent() when looking for the
* 'this' pointer of the enclosing function/class.
* This skips over both TemplateInstance's and TemplateMixin's.
*/
final Dsymbol toParent2()
{
Dsymbol s = parent;
while (s && s.isTemplateInstance())
s = s.parent;
return s;
}
final TemplateInstance isInstantiated()
{
for (Dsymbol s = parent; s; s = s.parent)
{
TemplateInstance ti = s.isTemplateInstance();
if (ti && !ti.isTemplateMixin())
return ti;
}
return null;
}
// Check if this function is a member of a template which has only been
// instantiated speculatively, eg from inside is(typeof()).
// Return the speculative template instance it is part of,
// or NULL if not speculative.
final TemplateInstance isSpeculative()
{
Dsymbol par = parent;
while (par)
{
TemplateInstance ti = par.isTemplateInstance();
if (ti && ti.gagged)
return ti;
par = par.toParent();
}
return null;
}
final Ungag ungagSpeculative()
{
uint oldgag = global.gag;
if (global.gag && !isSpeculative() && !toParent2().isFuncDeclaration())
global.gag = 0;
return Ungag(oldgag);
}
// kludge for template.isSymbol()
override final int dyncast()
{
return DYNCAST_DSYMBOL;
}
/*************************************
* Do syntax copy of an array of Dsymbol's.
*/
final static Dsymbols* arraySyntaxCopy(Dsymbols* a)
{
Dsymbols* b = null;
if (a)
{
b = a.copy();
for (size_t i = 0; i < b.dim; i++)
{
(*b)[i] = (*b)[i].syntaxCopy(null);
}
}
return b;
}
Identifier getIdent()
{
return ident;
}
const(char)* toPrettyChars(bool QualifyTypes = false)
{
Dsymbol p;
char* s;
char* q;
size_t len;
//printf("Dsymbol::toPrettyChars() '%s'\n", toChars());
if (!parent)
return toChars();
len = 0;
for (p = this; p; p = p.parent)
len += strlen(QualifyTypes ? p.toPrettyCharsHelper() : p.toChars()) + 1;
s = cast(char*)mem.xmalloc(len);
q = s + len - 1;
*q = 0;
for (p = this; p; p = p.parent)
{
char* t = QualifyTypes ? p.toPrettyCharsHelper() : p.toChars();
len = strlen(t);
q -= len;
memcpy(q, t, len);
if (q == s)
break;
q--;
*q = '.';
}
return s;
}
const(char)* kind()
{
return "symbol";
}
/*********************************
* If this symbol is really an alias for another,
* return that other.
* If needed, semantic() is invoked due to resolve forward reference.
*/
Dsymbol toAlias()
{
return this;
}
/*********************************
* Resolve recursive tuple expansion in eponymous template.
*/
Dsymbol toAlias2()
{
return toAlias();
}
int apply(Dsymbol_apply_ft_t fp, void* param)
{
return (*fp)(this, param);
}
void addMember(Scope* sc, ScopeDsymbol sds)
{
//printf("Dsymbol::addMember('%s')\n", toChars());
//printf("Dsymbol::addMember(this = %p, '%s' scopesym = '%s')\n", this, toChars(), sds->toChars());
//printf("Dsymbol::addMember(this = %p, '%s' sds = %p, sds->symtab = %p)\n", this, toChars(), sds, sds->symtab);
parent = sds;
if (!isAnonymous()) // no name, so can't add it to symbol table
{
if (!sds.symtabInsert(this)) // if name is already defined
{
Dsymbol s2 = sds.symtab.lookup(ident);
if (!s2.overloadInsert(this))
{
sds.multiplyDefined(Loc(), this, s2);
errors = true;
}
}
if (sds.isAggregateDeclaration() || sds.isEnumDeclaration())
{
if (ident == Id.__sizeof || ident == Id.__xalignof || ident == Id._mangleof)
{
error(".%s property cannot be redefined", ident.toChars());
errors = true;
}
}
}
}
/*************************************
* Set scope for future semantic analysis so we can
* deal better with forward references.
*/
void setScope(Scope* sc)
{
//printf("Dsymbol::setScope() %p %s, %p stc = %llx\n", this, toChars(), sc, sc->stc);
if (!sc.nofree)
sc.setNoFree(); // may need it even after semantic() finishes
_scope = sc;
if (sc.depmsg)
depmsg = sc.depmsg;
if (!userAttribDecl)
userAttribDecl = sc.userAttribDecl;
}
void importAll(Scope* sc)
{
}
/*************************************
* Does semantic analysis on the public face of declarations.
*/
void semantic(Scope* sc)
{
error("%p has no semantic routine", this);
}
/*************************************
* Does semantic analysis on initializers and members of aggregates.
*/
void semantic2(Scope* sc)
{
// Most Dsymbols have no further semantic analysis needed
}
/*************************************
* Does semantic analysis on function bodies.
*/
void semantic3(Scope* sc)
{
// Most Dsymbols have no further semantic analysis needed
}
/*********************************************
* Search for ident as member of s.
* Input:
* flags: (see IgnoreXXX declared in dsymbol.h)
* Returns:
* NULL if not found
*/
Dsymbol search(Loc loc, Identifier ident, int flags = IgnoreNone)
{
//printf("Dsymbol::search(this=%p,%s, ident='%s')\n", this, toChars(), ident->toChars());
return null;
}
final Dsymbol search_correct(Identifier ident)
{
/***************************************************
* Search for symbol with correct spelling.
*/
extern (D) void* symbol_search_fp(const(char)* seed, ref int cost)
{
/* If not in the lexer's string table, it certainly isn't in the symbol table.
* Doing this first is a lot faster.
*/
size_t len = strlen(seed);
if (!len)
return null;
Identifier id = Identifier.lookup(seed, len);
if (!id)
return null;
cost = 0;
Dsymbol s = this;
Module.clearCache();
return cast(void*)s.search(Loc(), id, IgnoreErrors);
}
if (global.gag)
return null; // don't do it for speculative compiles; too time consuming
return cast(Dsymbol)speller(ident.toChars(), &symbol_search_fp, idchars);
}
/***************************************
* Search for identifier id as a member of 'this'.
* id may be a template instance.
* Returns:
* symbol found, NULL if not
*/
final Dsymbol searchX(Loc loc, Scope* sc, RootObject id)
{
//printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident->toChars());
Dsymbol s = toAlias();
Dsymbol sm;
if (Declaration d = s.isDeclaration())
{
if (d.inuse)
{
.error(loc, "circular reference to '%s'", d.toPrettyChars());
return null;
}
}
switch (id.dyncast())
{
case DYNCAST_IDENTIFIER:
sm = s.search(loc, cast(Identifier)id);
break;
case DYNCAST_DSYMBOL:
{
// It's a template instance
//printf("\ttemplate instance id\n");
Dsymbol st = cast(Dsymbol)id;
TemplateInstance ti = st.isTemplateInstance();
sm = s.search(loc, ti.name);
if (!sm)
{
sm = s.search_correct(ti.name);
if (sm)
.error(loc, "template identifier '%s' is not a member of %s '%s', did you mean %s '%s'?", ti.name.toChars(), s.kind(), s.toPrettyChars(), sm.kind(), sm.toChars());
else
.error(loc, "template identifier '%s' is not a member of %s '%s'", ti.name.toChars(), s.kind(), s.toPrettyChars());
return null;
}
sm = sm.toAlias();
TemplateDeclaration td = sm.isTemplateDeclaration();
if (!td)
{
.error(loc, "%s.%s is not a template, it is a %s", s.toPrettyChars(), ti.name.toChars(), sm.kind());
return null;
}
ti.tempdecl = td;
if (!ti.semanticRun)
ti.semantic(sc);
sm = ti.toAlias();
break;
}
case DYNCAST_TYPE:
case DYNCAST_EXPRESSION:
default:
assert(0);
}
return sm;
}
bool overloadInsert(Dsymbol s)
{
//printf("Dsymbol::overloadInsert('%s')\n", s->toChars());
return false;
}
uint size(Loc loc)
{
error("Dsymbol '%s' has no size", toChars());
return 0;
}
bool isforwardRef()
{
return false;
}
// is a 'this' required to access the member
AggregateDeclaration isThis()
{
return null;
}
// are we a member of an aggregate?
final AggregateDeclaration isAggregateMember()
{
Dsymbol parent = toParent();
if (parent && parent.isAggregateDeclaration())
return cast(AggregateDeclaration)parent;
return null;
}
// are we a member of an aggregate?
final AggregateDeclaration isAggregateMember2()
{
Dsymbol parent = toParent2();
if (parent && parent.isAggregateDeclaration())
return cast(AggregateDeclaration)parent;
return null;
}
// are we a member of a class?
final ClassDeclaration isClassMember()
{
AggregateDeclaration ad = isAggregateMember();
return ad ? ad.isClassDeclaration() : null;
}
// is Dsymbol exported?
bool isExport()
{
return false;
}
// is Dsymbol imported?
bool isImportedSymbol()
{
return false;
}
// is Dsymbol deprecated?
bool isDeprecated()
{
return false;
}
bool isOverloadable()
{
return false;
}
bool hasOverloads()
{
return false;
}
// is this a LabelDsymbol()?
LabelDsymbol isLabel()
{
return null;
}
// is this a member of an AggregateDeclaration?
AggregateDeclaration isMember()
{
//printf("Dsymbol::isMember() %s\n", toChars());
Dsymbol parent = toParent();
//printf("parent is %s %s\n", parent->kind(), parent->toChars());
return parent ? parent.isAggregateDeclaration() : null;
}
// is this a type?
Type getType()
{
return null;
}
// need a 'this' pointer?
bool needThis()
{
return false;
}
/*************************************
*/
Prot prot()
{
return Prot(PROTpublic);
}
/**************************************
* Copy the syntax.
* Used for template instantiations.
* If s is NULL, allocate the new object, otherwise fill it in.
*/
Dsymbol syntaxCopy(Dsymbol s)
{
print();
printf("%s %s\n", kind(), toChars());
assert(0);
}
/**************************************
* Determine if this symbol is only one.
* Returns:
* false, *ps = NULL: There are 2 or more symbols
* true, *ps = NULL: There are zero symbols
* true, *ps = symbol: The one and only one symbol
*/
bool oneMember(Dsymbol* ps, Identifier ident)
{
//printf("Dsymbol::oneMember()\n");
*ps = this;
return true;
}
/*****************************************
* Same as Dsymbol::oneMember(), but look at an array of Dsymbols.
*/
final static bool oneMembers(Dsymbols* members, Dsymbol* ps, Identifier ident)
{
//printf("Dsymbol::oneMembers() %d\n", members ? members.dim : 0);
Dsymbol s = null;
if (members)
{
for (size_t i = 0; i < members.dim; i++)
{
Dsymbol sx = (*members)[i];
bool x = sx.oneMember(ps, ident);
//printf("\t[%d] kind %s = %d, s = %p\n", i, sx.kind(), x, *ps);
if (!x)
{
//printf("\tfalse 1\n");
assert(*ps is null);
return false;
}
if (*ps)
{
static bool isOverloadableAlias(Dsymbol s)
{
auto ad = s.isAliasDeclaration();
return ad && ad.aliassym && ad.aliassym.isOverloadable();
}
assert(ident);
if (!(*ps).ident || !(*ps).ident.equals(ident))
continue;
if (!s)
s = *ps;
else if (( s .isOverloadable() || isOverloadableAlias( s)) &&
((*ps).isOverloadable() || isOverloadableAlias(*ps)))
{
// keep head of overload set
FuncDeclaration f1 = s.isFuncDeclaration();
FuncDeclaration f2 = (*ps).isFuncDeclaration();
if (f1 && f2)
{
assert(!f1.isFuncAliasDeclaration());
assert(!f2.isFuncAliasDeclaration());
for (; f1 != f2; f1 = f1.overnext0)
{
if (f1.overnext0 is null)
{
f1.overnext0 = f2;
break;
}
}
}
}
else // more than one symbol
{
*ps = null;
//printf("\tfalse 2\n");
return false;
}
}
}
}
*ps = s; // s is the one symbol, null if none
//printf("\ttrue\n");
return true;
}
void setFieldOffset(AggregateDeclaration ad, uint* poffset, bool isunion)
{
}
/*****************************************
* Is Dsymbol a variable that contains pointers?
*/
bool hasPointers()
{
//printf("Dsymbol::hasPointers() %s\n", toChars());
return false;
}
bool hasStaticCtorOrDtor()
{
//printf("Dsymbol::hasStaticCtorOrDtor() %s\n", toChars());
return false;
}
void addLocalClass(ClassDeclarations*)
{
}
void checkCtorConstInit()
{
}
/****************************************
* Add documentation comment to Dsymbol.
* Ignore NULL comments.
*/
void addComment(const(char)* comment)
{
//if (comment)
//printf("adding comment '%s' to symbol %p '%s'\n", comment, this, toChars());
if (!this.comment)
this.comment = comment;
else if (comment && strcmp(cast(char*)comment, cast(char*)this.comment) != 0)
{
// Concatenate the two
this.comment = Lexer.combineComments(this.comment, comment);
}
}
/****************************************
* Returns true if this symbol is defined in a non-root module without instantiation.
*/
final bool inNonRoot()
{
Dsymbol s = parent;
for (; s; s = s.toParent())
{
if (TemplateInstance ti = s.isTemplateInstance())
{
return false;
}
if (Module m = s.isModule())
{
if (!m.isRoot())
return true;
break;
}
}
return false;
}
// Eliminate need for dynamic_cast
Package isPackage()
{
return null;
}
Module isModule()
{
return null;
}
EnumMember isEnumMember()
{
return null;
}
TemplateDeclaration isTemplateDeclaration()
{
return null;
}
TemplateInstance isTemplateInstance()
{
return null;
}
TemplateMixin isTemplateMixin()
{
return null;
}
Nspace isNspace()
{
return null;
}
Declaration isDeclaration()
{
return null;
}
ThisDeclaration isThisDeclaration()
{
return null;
}
TypeInfoDeclaration isTypeInfoDeclaration()
{
return null;
}
TupleDeclaration isTupleDeclaration()
{
return null;
}
AliasDeclaration isAliasDeclaration()
{
return null;
}
AggregateDeclaration isAggregateDeclaration()
{
return null;
}
FuncDeclaration isFuncDeclaration()
{
return null;
}
FuncAliasDeclaration isFuncAliasDeclaration()
{
return null;
}
OverDeclaration isOverDeclaration()
{
return null;
}
FuncLiteralDeclaration isFuncLiteralDeclaration()
{
return null;
}
CtorDeclaration isCtorDeclaration()
{
return null;
}
PostBlitDeclaration isPostBlitDeclaration()
{
return null;
}
DtorDeclaration isDtorDeclaration()
{
return null;
}
StaticCtorDeclaration isStaticCtorDeclaration()
{
return null;
}
StaticDtorDeclaration isStaticDtorDeclaration()
{
return null;
}
SharedStaticCtorDeclaration isSharedStaticCtorDeclaration()
{
return null;
}
SharedStaticDtorDeclaration isSharedStaticDtorDeclaration()
{
return null;
}
InvariantDeclaration isInvariantDeclaration()
{
return null;
}
UnitTestDeclaration isUnitTestDeclaration()
{
return null;
}
NewDeclaration isNewDeclaration()
{
return null;
}
VarDeclaration isVarDeclaration()
{
return null;
}
ClassDeclaration isClassDeclaration()
{
return null;
}
StructDeclaration isStructDeclaration()
{
return null;
}
UnionDeclaration isUnionDeclaration()
{
return null;
}
InterfaceDeclaration isInterfaceDeclaration()
{
return null;
}
ScopeDsymbol isScopeDsymbol()
{
return null;
}
WithScopeSymbol isWithScopeSymbol()
{
return null;
}
ArrayScopeSymbol isArrayScopeSymbol()
{
return null;
}
Import isImport()
{
return null;
}
EnumDeclaration isEnumDeclaration()
{
return null;
}
DeleteDeclaration isDeleteDeclaration()
{
return null;
}
SymbolDeclaration isSymbolDeclaration()
{
return null;
}
AttribDeclaration isAttribDeclaration()
{
return null;
}
AnonDeclaration isAnonDeclaration()
{
return null;
}
OverloadSet isOverloadSet()
{
return null;
}
void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Dsymbol that generates a scope
*/
extern (C++) class ScopeDsymbol : Dsymbol
{
public:
Dsymbols* members; // all Dsymbol's in this scope
DsymbolTable symtab; // members[] sorted into table
private:
Dsymbols* imports; // imported Dsymbol's
PROTKIND* prots; // array of PROTKIND, one for each import
public:
final extern (D) this()
{
}
final extern (D) this(Identifier id)
{
super(id);
}
override Dsymbol syntaxCopy(Dsymbol s)
{
//printf("ScopeDsymbol::syntaxCopy('%s')\n", toChars());
ScopeDsymbol sds = s ? cast(ScopeDsymbol)s : new ScopeDsymbol(ident);
sds.members = arraySyntaxCopy(members);
return sds;
}
/*****************************************
* This function is #1 on the list of functions that eat cpu time.
* Be very, very careful about slowing it down.
*/
override Dsymbol search(Loc loc, Identifier ident, int flags = IgnoreNone)
{
//printf("%s->ScopeDsymbol::search(ident='%s', flags=x%x)\n", toChars(), ident->toChars(), flags);
//if (strcmp(ident->toChars(),"c") == 0) *(char*)0=0;
// Look in symbols declared in this module
Dsymbol s1 = symtab ? symtab.lookup(ident) : null;
//printf("\ts1 = %p, imports = %p, %d\n", s1, imports, imports ? imports->dim : 0);
if (s1)
{
//printf("\ts = '%s.%s'\n",toChars(),s1->toChars());
return s1;
}
if (imports)
{
Dsymbol s = null;
OverloadSet a = null;
int sflags = flags & (IgnoreErrors | IgnoreAmbiguous); // remember these in recursive searches
// Look in imported modules
for (size_t i = 0; i < imports.dim; i++)
{
// If private import, don't search it
if ((flags & IgnorePrivateMembers) && prots[i] == PROTprivate)
continue;
Dsymbol ss = (*imports)[i];
//printf("\tscanning import '%s', prots = %d, isModule = %p, isImport = %p\n", ss->toChars(), prots[i], ss->isModule(), ss->isImport());
/* Don't find private members if ss is a module
*/
Dsymbol s2 = ss.search(loc, ident, sflags | (ss.isModule() ? IgnorePrivateMembers : IgnoreNone));
if (!s)
{
s = s2;
if (s && s.isOverloadSet())
a = mergeOverloadSet(ident, a, s);
}
else if (s2 && s != s2)
{
if (s.toAlias() == s2.toAlias() || s.getType() == s2.getType() && s.getType())
{
/* After following aliases, we found the same
* symbol, so it's not an ambiguity. But if one
* alias is deprecated or less accessible, prefer
* the other.
*/
if (s.isDeprecated() || s.prot().isMoreRestrictiveThan(s2.prot()) && s2.prot().kind != PROTnone)
s = s2;
}
else
{
/* Two imports of the same module should be regarded as
* the same.
*/
Import i1 = s.isImport();
Import i2 = s2.isImport();
if (!(i1 && i2 && (i1.mod == i2.mod || (!i1.parent.isImport() && !i2.parent.isImport() && i1.ident.equals(i2.ident)))))
{
/* Bugzilla 8668:
* Public selective import adds AliasDeclaration in module.
* To make an overload set, resolve aliases in here and
* get actual overload roots which accessible via s and s2.
*/
s = s.toAlias();
s2 = s2.toAlias();
/* If both s2 and s are overloadable (though we only
* need to check s once)
*/
if ((s2.isOverloadSet() || s2.isOverloadable()) && (a || s.isOverloadable()))
{
a = mergeOverloadSet(ident, a, s2);
continue;
}
if (flags & IgnoreAmbiguous) // if return NULL on ambiguity
return null;
if (!(flags & IgnoreErrors))
ScopeDsymbol.multiplyDefined(loc, s, s2);
break;
}
}
}
}
if (s)
{
/* Build special symbol if we had multiple finds
*/
if (a)
{
if (!s.isOverloadSet())
a = mergeOverloadSet(ident, a, s);
s = a;
}
if (!(flags & IgnoreErrors) && s.prot().kind == PROTprivate && !s.parent.isTemplateMixin())
{
if (!s.isImport())
error(loc, "%s %s is private", s.kind(), s.toPrettyChars());
}
return s;
}
}
return s1;
}
final OverloadSet mergeOverloadSet(Identifier ident, OverloadSet os, Dsymbol s)
{
if (!os)
{
os = new OverloadSet(ident);
os.parent = this;
}
if (OverloadSet os2 = s.isOverloadSet())
{
// Merge the cross-module overload set 'os2' into 'os'
if (os.a.dim == 0)
{
os.a.setDim(os2.a.dim);
memcpy(os.a.tdata(), os2.a.tdata(), (os.a[0]).sizeof * os2.a.dim);
}
else
{
for (size_t i = 0; i < os2.a.dim; i++)
{
os = mergeOverloadSet(ident, os, os2.a[i]);
}
}
}
else
{
assert(s.isOverloadable());
/* Don't add to os[] if s is alias of previous sym
*/
for (size_t j = 0; j < os.a.dim; j++)
{
Dsymbol s2 = os.a[j];
if (s.toAlias() == s2.toAlias())
{
if (s2.isDeprecated() || (s2.prot().isMoreRestrictiveThan(s.prot()) && s.prot().kind != PROTnone))
{
os.a[j] = s;
}
goto Lcontinue;
}
}
os.push(s);
Lcontinue:
}
return os;
}
final void importScope(Dsymbol s, Prot protection)
{
//printf("%s->ScopeDsymbol::importScope(%s, %d)\n", toChars(), s->toChars(), protection);
// No circular or redundant import's
if (s != this)
{
if (!imports)
imports = new Dsymbols();
else
{
for (size_t i = 0; i < imports.dim; i++)
{
Dsymbol ss = (*imports)[i];
if (ss == s) // if already imported
{
if (protection.kind > prots[i])
prots[i] = protection.kind; // upgrade access
return;
}
}
}
imports.push(s);
prots = cast(PROTKIND*)mem.xrealloc(prots, imports.dim * (prots[0]).sizeof);
prots[imports.dim - 1] = protection.kind;
}
}
override final bool isforwardRef()
{
return (members is null);
}
final static void multiplyDefined(Loc loc, Dsymbol s1, Dsymbol s2)
{
version (none)
{
printf("ScopeDsymbol::multiplyDefined()\n");
printf("s1 = %p, '%s' kind = '%s', parent = %s\n", s1, s1.toChars(), s1.kind(), s1.parent ? s1.parent.toChars() : "");
printf("s2 = %p, '%s' kind = '%s', parent = %s\n", s2, s2.toChars(), s2.kind(), s2.parent ? s2.parent.toChars() : "");
}
if (loc.filename)
{
.error(loc, "%s at %s conflicts with %s at %s", s1.toPrettyChars(), s1.locToChars(), s2.toPrettyChars(), s2.locToChars());
}
else
{
s1.error(s1.loc, "conflicts with %s %s at %s", s2.kind(), s2.toPrettyChars(), s2.locToChars());
}
}
override const(char)* kind()
{
return "ScopeDsymbol";
}
/*******************************************
* Look for member of the form:
* const(MemberInfo)[] getMembers(string);
* Returns NULL if not found
*/
final FuncDeclaration findGetMembers()
{
Dsymbol s = search_function(this, Id.getmembers);
FuncDeclaration fdx = s ? s.isFuncDeclaration() : null;
version (none)
{
// Finish
static __gshared TypeFunction tfgetmembers;
if (!tfgetmembers)
{
Scope sc;
auto parameters = new Parameters();
Parameters* p = new Parameter(STCin, Type.tchar.constOf().arrayOf(), null, null);
parameters.push(p);
Type tret = null;
tfgetmembers = new TypeFunction(parameters, tret, 0, LINKd);
tfgetmembers = cast(TypeFunction)tfgetmembers.semantic(Loc(), &sc);
}
if (fdx)
fdx = fdx.overloadExactMatch(tfgetmembers);
}
if (fdx && fdx.isVirtual())
fdx = null;
return fdx;
}
Dsymbol symtabInsert(Dsymbol s)
{
return symtab.insert(s);
}
/****************************************
* Return true if any of the members are static ctors or static dtors, or if
* any members have members that are.
*/
override bool hasStaticCtorOrDtor()
{
if (members)
{
for (size_t i = 0; i < members.dim; i++)
{
Dsymbol member = (*members)[i];
if (member.hasStaticCtorOrDtor())
return true;
}
}
return false;
}
/***************************************
* Determine number of Dsymbols, folding in AttribDeclaration members.
*/
static size_t dim(Dsymbols* members)
{
size_t n = 0;
int dimDg(size_t idx, Dsymbol s)
{
++n;
return 0;
}
_foreach(null, members, &dimDg, &n);
return n;
}
/***************************************
* Get nth Dsymbol, folding in AttribDeclaration members.
* Returns:
* Dsymbol* nth Dsymbol
* NULL not found, *pn gets incremented by the number
* of Dsymbols
*/
static Dsymbol getNth(Dsymbols* members, size_t nth, size_t* pn = null)
{
Dsymbol sym = null;
int getNthSymbolDg(size_t n, Dsymbol s)
{
if (n == nth)
{
sym = s;
return 1;
}
return 0;
}
int res = _foreach(null, members, &getNthSymbolDg);
return res ? sym : null;
}
extern (D) alias ForeachDg = int delegate(size_t idx, Dsymbol s);
/***************************************
* Expands attribute declarations in members in depth first
* order. Calls dg(size_t symidx, Dsymbol *sym) for each
* member.
* If dg returns !=0, stops and returns that value else returns 0.
* Use this function to avoid the O(N + N^2/2) complexity of
* calculating dim and calling N times getNth.
* Returns:
* last value returned by dg()
*/
extern (D) static int _foreach(Scope* sc, Dsymbols* members, scope ForeachDg dg, size_t* pn = null)
{
assert(dg);
if (!members)
return 0;
size_t n = pn ? *pn : 0; // take over index
int result = 0;
foreach (size_t i; 0 .. members.dim)
{
Dsymbol s = (*members)[i];
if (AttribDeclaration a = s.isAttribDeclaration())
result = _foreach(sc, a.include(sc, null), dg, &n);
else if (TemplateMixin tm = s.isTemplateMixin())
result = _foreach(sc, tm.members, dg, &n);
else if (s.isTemplateInstance())
{
}
else if (s.isUnitTestDeclaration())
{
}
else
result = dg(n++, s);
if (result)
break;
}
if (pn)
*pn = n; // update index
return result;
}
override final ScopeDsymbol isScopeDsymbol()
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* With statement scope
*/
extern (C++) final class WithScopeSymbol : ScopeDsymbol
{
public:
WithStatement withstate;
extern (D) this(WithStatement withstate)
{
this.withstate = withstate;
}
override Dsymbol search(Loc loc, Identifier ident, int flags = IgnoreNone)
{
// Acts as proxy to the with class declaration
Dsymbol s = null;
Expression eold = null;
for (Expression e = withstate.exp; e != eold; e = resolveAliasThis(_scope, e))
{
if (e.op == TOKscope)
{
s = (cast(ScopeExp)e).sds;
}
else if (e.op == TOKtype)
{
s = e.type.toDsymbol(null);
}
else
{
Type t = e.type.toBasetype();
s = t.toDsymbol(null);
}
if (s)
{
s = s.search(loc, ident);
if (s)
return s;
}
eold = e;
}
return null;
}
override WithScopeSymbol isWithScopeSymbol()
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Array Index/Slice scope
*/
extern (C++) final class ArrayScopeSymbol : ScopeDsymbol
{
public:
Expression exp; // IndexExp or SliceExp
TypeTuple type; // for tuple[length]
TupleDeclaration td; // for tuples of objects
Scope* sc;
extern (D) this(Scope* sc, Expression e)
{
assert(e.op == TOKindex || e.op == TOKslice || e.op == TOKarray);
exp = e;
this.sc = sc;
}
extern (D) this(Scope* sc, TypeTuple t)
{
type = t;
this.sc = sc;
}
extern (D) this(Scope* sc, TupleDeclaration s)
{
td = s;
this.sc = sc;
}
override Dsymbol search(Loc loc, Identifier ident, int flags = IgnoreNone)
{
//printf("ArrayScopeSymbol::search('%s', flags = %d)\n", ident->toChars(), flags);
if (ident == Id.dollar)
{
VarDeclaration* pvar;
Expression ce;
L1:
if (td)
{
/* $ gives the number of elements in the tuple
*/
auto v = new VarDeclaration(loc, Type.tsize_t, Id.dollar, null);
Expression e = new IntegerExp(Loc(), td.objects.dim, Type.tsize_t);
v._init = new ExpInitializer(Loc(), e);
v.storage_class |= STCtemp | STCstatic | STCconst;
v.semantic(sc);
return v;
}
if (type)
{
/* $ gives the number of type entries in the type tuple
*/
auto v = new VarDeclaration(loc, Type.tsize_t, Id.dollar, null);
Expression e = new IntegerExp(Loc(), type.arguments.dim, Type.tsize_t);
v._init = new ExpInitializer(Loc(), e);
v.storage_class |= STCtemp | STCstatic | STCconst;
v.semantic(sc);
return v;
}
if (exp.op == TOKindex)
{
/* array[index] where index is some function of $
*/
IndexExp ie = cast(IndexExp)exp;
pvar = &ie.lengthVar;
ce = ie.e1;
}
else if (exp.op == TOKslice)
{
/* array[lwr .. upr] where lwr or upr is some function of $
*/
SliceExp se = cast(SliceExp)exp;
pvar = &se.lengthVar;
ce = se.e1;
}
else if (exp.op == TOKarray)
{
/* array[e0, e1, e2, e3] where e0, e1, e2 are some function of $
* $ is a opDollar!(dim)() where dim is the dimension(0,1,2,...)
*/
ArrayExp ae = cast(ArrayExp)exp;
pvar = &ae.lengthVar;
ce = ae.e1;
}
else
{
/* Didn't find $, look in enclosing scope(s).
*/
return null;
}
while (ce.op == TOKcomma)
ce = (cast(CommaExp)ce).e2;
/* If we are indexing into an array that is really a type
* tuple, rewrite this as an index into a type tuple and
* try again.
*/
if (ce.op == TOKtype)
{
Type t = (cast(TypeExp)ce).type;
if (t.ty == Ttuple)
{
type = cast(TypeTuple)t;
goto L1;
}
}
/* *pvar is lazily initialized, so if we refer to $
* multiple times, it gets set only once.
*/
if (!*pvar) // if not already initialized
{
/* Create variable v and set it to the value of $
*/
VarDeclaration v;
Type t;
if (ce.op == TOKtuple)
{
/* It is for an expression tuple, so the
* length will be a const.
*/
Expression e = new IntegerExp(Loc(), (cast(TupleExp)ce).exps.dim, Type.tsize_t);
v = new VarDeclaration(loc, Type.tsize_t, Id.dollar, new ExpInitializer(Loc(), e));
v.storage_class |= STCtemp | STCstatic | STCconst;
}
else if (ce.type && (t = ce.type.toBasetype()) !is null && (t.ty == Tstruct || t.ty == Tclass))
{
// Look for opDollar
assert(exp.op == TOKarray || exp.op == TOKslice);
AggregateDeclaration ad = isAggregate(t);
assert(ad);
Dsymbol s = ad.search(loc, Id.opDollar);
if (!s) // no dollar exists -- search in higher scope
return null;
s = s.toAlias();
Expression e = null;
// Check for multi-dimensional opDollar(dim) template.
if (TemplateDeclaration td = s.isTemplateDeclaration())
{
dinteger_t dim = 0;
if (exp.op == TOKarray)
{
dim = (cast(ArrayExp)exp).currentDimension;
}
else if (exp.op == TOKslice)
{
dim = 0; // slices are currently always one-dimensional
}
else
{
assert(0);
}
auto tiargs = new Objects();
Expression edim = new IntegerExp(Loc(), dim, Type.tsize_t);
edim = edim.semantic(sc);
tiargs.push(edim);
e = new DotTemplateInstanceExp(loc, ce, td.ident, tiargs);
}
else
{
/* opDollar exists, but it's not a template.
* This is acceptable ONLY for single-dimension indexing.
* Note that it's impossible to have both template & function opDollar,
* because both take no arguments.
*/
if (exp.op == TOKarray && (cast(ArrayExp)exp).arguments.dim != 1)
{
exp.error("%s only defines opDollar for one dimension", ad.toChars());
return null;
}
Declaration d = s.isDeclaration();
assert(d);
e = new DotVarExp(loc, ce, d);
}
e = e.semantic(sc);
if (!e.type)
exp.error("%s has no value", e.toChars());
t = e.type.toBasetype();
if (t && t.ty == Tfunction)
e = new CallExp(e.loc, e);
v = new VarDeclaration(loc, null, Id.dollar, new ExpInitializer(Loc(), e));
v.storage_class |= STCtemp | STCctfe | STCrvalue;
}
else
{
/* For arrays, $ will either be a compile-time constant
* (in which case its value in set during constant-folding),
* or a variable (in which case an expression is created in
* toir.c).
*/
auto e = new VoidInitializer(Loc());
e.type = Type.tsize_t;
v = new VarDeclaration(loc, Type.tsize_t, Id.dollar, e);
v.storage_class |= STCtemp | STCctfe; // it's never a true static variable
}
*pvar = v;
}
(*pvar).semantic(sc);
return (*pvar);
}
return null;
}
override ArrayScopeSymbol isArrayScopeSymbol()
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Overload Sets
*/
extern (C++) final class OverloadSet : Dsymbol
{
public:
Dsymbols a; // array of Dsymbols
extern (D) this(Identifier ident, OverloadSet os = null)
{
super(ident);
if (os)
{
for (size_t i = 0; i < os.a.dim; i++)
a.push(os.a[i]);
}
}
void push(Dsymbol s)
{
a.push(s);
}
override OverloadSet isOverloadSet()
{
return this;
}
override const(char)* kind()
{
return "overloadset";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Table of Dsymbol's
*/
extern (C++) final class DsymbolTable : RootObject
{
public:
AA* tab;
// Look up Identifier. Return Dsymbol if found, NULL if not.
Dsymbol lookup(Identifier ident)
{
//printf("DsymbolTable::lookup(%s)\n", (char*)ident->string);
return cast(Dsymbol)dmd_aaGetRvalue(tab, cast(void*)ident);
}
// Insert Dsymbol in table. Return NULL if already there.
Dsymbol insert(Dsymbol s)
{
//printf("DsymbolTable::insert(this = %p, '%s')\n", this, s->ident->toChars());
Identifier ident = s.ident;
Dsymbol* ps = cast(Dsymbol*)dmd_aaGet(&tab, cast(void*)ident);
if (*ps)
return null; // already in table
*ps = s;
return s;
}
// Look for Dsymbol in table. If there, return it. If not, insert s and return that.
Dsymbol update(Dsymbol s)
{
Identifier ident = s.ident;
Dsymbol* ps = cast(Dsymbol*)dmd_aaGet(&tab, cast(void*)ident);
*ps = s;
return s;
}
// when ident and s are not the same
Dsymbol insert(Identifier ident, Dsymbol s)
{
//printf("DsymbolTable::insert()\n");
Dsymbol* ps = cast(Dsymbol*)dmd_aaGet(&tab, cast(void*)ident);
if (*ps)
return null; // already in table
*ps = s;
return s;
}
}
|
D
|
module staticswitch;
template staticSwitch(List...) // List[0] is the value commanding the switching
// It can be a type or a symbol.
{
static if (List.length == 1) // No slot left: error
static assert(0, "StaticSwitch: no match for " ~ List[0].stringof);
else static if (List.length == 2) // One slot left: default case
enum staticSwitch = List[1];
else static if (is(List[0] == List[1]) // Comparison on types
|| ( !is(List[0]) // Comparison on values
&& !is(List[1])
&& is(typeof(List[0] == List[1]))
&& (List[0] == List[1])))
enum staticSwitch = List[2];
else
enum staticSwitch = staticSwitch!(List[0], List[3..$]);
}
|
D
|
<?xml version="1.0" encoding="ASCII"?>
<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
<pageList>
<availablePage>
<emfPageIdentifier href="cornice.profile.notation#_ELwdQGZAEeKWD5QSKmVm5w"/>
</availablePage>
</pageList>
<sashModel currentSelection="//@sashModel/@windows.0/@children.0">
<windows>
<children xsi:type="di:TabFolder">
<children>
<emfPageIdentifier href="cornice.profile.notation#_ELwdQGZAEeKWD5QSKmVm5w"/>
</children>
</children>
</windows>
</sashModel>
</di:SashWindowsMngr>
|
D
|
/*
* main.d
*
* This file contains the main logic and the main class for handling
* an Application.
*
* Author: Dave Wilkinson
*
*/
module core.main;
import core.string;
import core.arguments;
import core.application;
import core.locale;
import core.system;
import io.console;
import synch.semaphore;
import synch.thread;
import gui.apploop;
// Section: Core
// Description: This class is the main class for the framework. It provides base functionality.
class Djehuty {
static:
public:
void application(Application application) {
if (app !is null) {
throw new Exception("Application Already Spawned");
}
app = application;
}
Application application() {
return app;
}
package:
void start() {
// Get default locale
Locale.id = System.Locale.id;
// Allow console output
Console.unlock();
// Can only start the framework once
if (!_hasStarted) {
_hasStarted = true;
}
else {
throw new Exception("Framework Already Started");
}
// Constitute the main thread class
ThreadModuleInit();
// Check to make sure the app provided a suitable class to use
if (app is null) {
throw new Exception("No Application Class");
}
else {
app.onPreApplicationStart();
app.onApplicationStart();
}
}
void end(uint code = 0) {
// Tell all running threads that they should end to allow shutdown to commense
if (_threads !is null) {
_threadRegisterSemaphore.down();
foreach(th; _threads) {
th.pleaseStop();
}
_threadRegisterSemaphore.up();
}
// Reset colors to something sane
Console.setColor(fgColor.White, bgColor.Black);
if (app !is null) {
app.onApplicationEnd();
app.onPostApplicationEnd(code);
}
}
bool _hasStarted = false;
Thread[] _threads;
Semaphore _threadRegisterSemaphore;
Application app;
}
void RegisterThread(ref Thread thread) {
if (Djehuty._threadRegisterSemaphore is null) {
Djehuty._threadRegisterSemaphore = new Semaphore(1);
}
Djehuty._threadRegisterSemaphore.down();
Djehuty._threads ~= thread;
Djehuty._threadRegisterSemaphore.up();
}
void UnregisterThread(ref Thread thread)
{
Djehuty._threadRegisterSemaphore.down();
if (Djehuty._threads !is null) {
foreach(i, th; Djehuty._threads) {
if (th is thread) {
if (Djehuty._threads.length == 1) {
Djehuty._threads = null;
}
else if (i >= Djehuty._threads.length - 1) {
Djehuty._threads = Djehuty._threads[0..i];
}
else {
Djehuty._threads = Djehuty._threads[0..i] ~ Djehuty._threads[i+1..$];
}
break;
}
}
}
Djehuty._threadRegisterSemaphore.up();
}
|
D
|
/*
* Problem 46
*
* 20 June 2003
*
*
* It was proposed by Christian Goldbach that every odd composite
* number can be written as the sum of a prime and twice a square.
*
* 9 = 7 + 2x1^2
* 15 = 7 + 2x2^2
* 21 = 3 + 2x3^2
* 25 = 7 + 2x3^2
* 27 = 19 + 2x2^2
* 33 = 31 + 2x1^2
*
* It turns out that the conjecture was false.
*
* What is the smallest odd composite that cannot be written as the sum
* of a prime and twice a square?
*
* 5777
*/
import euler.sieve;
debug {
import std.stdio;
void main() {
writeln(euler46());
}
}
uint euler46() {
AutoSieve!uint sieve;
/* Does this number have a goldbach decomposition. */
bool goldbachable(uint n) {
for (uint p = 2; p < n; p = sieve.nextPrime(p)) {
for (uint s = 1; ; s++) {
auto v = p + 2 * s * s;
if (v == n)
return true;
if (v > n)
break;
}
}
return false;
}
for (uint p = 9; ; p += 2) {
if (sieve.isPrime(p))
continue;
if (!goldbachable(p))
return p;
}
}
unittest {
assert(euler46() == 5777);
}
|
D
|
module mangler;
/**
* Mangles the input string
*
* This should generate the exact same string as defined in the C++ module!
* This is used to cache-bust the game's string cache.
* Params:
* value = String to mangle
* Returns: Mangled output
*/
string mangle()(auto ref const(string) value) @safe nothrow {
return "_^@" ~ value ~ "_SmoothCamSetting";
}
|
D
|
void main() { runSolver(); }
void problem() {
auto N = scan!long;
auto A = scan!long(N);
auto B = scan!long(N);
auto solve() {
long ans = long.max;
auto segTreeA = SegTree!(max, long)(A, int.min);
auto segTreeB = SegTree!(min, long)(B, int.max);
foreach(l; 0..N) {
// long maxA = A[l];
// long minB = B[l];
// foreach(r; l + 1..N + 1) {
// maxA = max(maxA, A[r - 1]);
// minB = min(minB, B[r - 1]);
// ans = min(ans, maxA * minB);
// }
ans.chmin(A[l] * B[l]);
ans.chmin(segTreeA.sum(l, N) * segTreeB.sum(l, N));
}
return ans;
}
outputForAtCoder(&solve);
}
// ----------------------------------------------
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric, std.traits, std.functional, std.bigint, std.datetime.stopwatch, core.time, core.bitop;
T[][] combinations(T)(T[] s, in long m) { if (!m) return [[]]; if (s.empty) return []; return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(long n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
Point invert(Point p) { return Point(p.y, p.x); }
long[] divisors(long n) { long[] ret; for (long i = 1; i * i <= n; i++) { if (n % i == 0) { ret ~= i; if (i * i != n) ret ~= n / i; } } return ret.sort.array; }
bool chmin(T)(ref T a, T b) { if (b < a) { a = b; return true; } else return false; }
bool chmax(T)(ref T a, T b) { if (b > a) { a = b; return true; } else return false; }
string charSort(alias S = "a < b")(string s) { return (cast(char[])((cast(byte[])s).sort!S.array)).to!string; }
ulong comb(ulong a, ulong b) { if (b == 0) {return 1;}else{return comb(a - 1, b - 1) * a / b;}}
string toAnswerString(R)(R r) { return r.map!"a.to!string".joiner(" ").array.to!string; }
struct ModInt(uint MD) if (MD < int.max) {ulong v;this(string v) {this(v.to!long);}this(int v) {this(long(v));}this(long v) {this.v = (v%MD+MD)%MD;}void opAssign(long t) {v = (t%MD+MD)%MD;}static auto normS(ulong x) {return (x<MD)?x:x-MD;}static auto make(ulong x) {ModInt m; m.v = x; return m;}auto opBinary(string op:"+")(ModInt r) const {return make(normS(v+r.v));}auto opBinary(string op:"-")(ModInt r) const {return make(normS(v+MD-r.v));}auto opBinary(string op:"*")(ModInt r) const {return make((ulong(v)*r.v%MD).to!ulong);}auto opBinary(string op:"^^", T)(T r) const {long x=v;long y=1;while(r){if(r%2==1)y=(y*x)%MD;x=x^^2%MD;r/=2;} return make(y);}auto opBinary(string op:"/")(ModInt r) const {return this*memoize!inv(r);}static ModInt inv(ModInt x) {return x^^(MD-2);}string toString() const {return v.to!string;}auto opOpAssign(string op)(ModInt r) {return mixin ("this=this"~op~"r");}}
alias MInt1 = ModInt!(10^^9 + 7);
alias MInt9 = ModInt!(998_244_353);
void outputForAtCoder(T)(T delegate() fn) {
static if (is(T == float) || is(T == double) || is(T == real)) "%.16f".writefln(fn());
else static if (is(T == void)) fn();
else static if (is(T == string)) fn().writeln;
else static if (isInputRange!T) {
static if (!is(string == ElementType!T) && isInputRange!(ElementType!T)) foreach(r; fn()) r.toAnswerString.writeln;
else foreach(r; fn()) r.writeln;
}
else fn().writeln;
}
void runSolver() {
enum BORDER = "==================================";
debug { BORDER.writeln; while(!stdin.eof) { "<<< Process time: %s >>>".writefln(benchmark!problem(1)); BORDER.writeln; } }
else problem();
}
enum YESNO = [true: "Yes", false: "No"];
// -----------------------------------------------
struct SegTree(alias pred = "a + b", T = long) {
alias predFun = binaryFun!pred;
size_t size;
T[] data;
T monoid;
this(T[] src, T monoid = T.init) {
this.monoid = monoid;
for(long i = 2; i < 2L^^32; i *= 2) {
if (src.length <= i) {
size = i;
break;
}
}
data = new T[](size * 2);
foreach(i, s; src) data[i + size] = s;
foreach_reverse(b; 1..size) {
data[b] = predFun(data[b * 2], data[b * 2 + 1]);
}
}
void update(long index, T value) {
long i = index + size;
data[i] = value;
while(i > 0) {
i /= 2;
data[i] = predFun(data[i * 2], data[i * 2 + 1]);
}
}
T get(long index) {
return data[index + size];
}
T sum(long a, long b, size_t k = 1, long l = 0, long r = -1) {
if (r < 0) r = size;
if (r <= a || b <= l) return monoid;
if (a <= l && r <= b) return data[k];
T leftValue = sum(a, b, 2*k, l, (l + r) / 2);
T rightValue = sum(a, b, 2*k + 1, (l + r) / 2, r);
return predFun(leftValue, rightValue);
}
}
|
D
|
// Written in the D programming language.
/**
Source: $(PHOBOSSRC std/experimental/logger/_filelogger.d)
*/
module std.experimental.logger.filelogger;
import std.experimental.logger.core;
import std.stdio;
import std.typecons : Flag;
/** An option to create $(LREF FileLogger) directory if it is non-existent.
*/
alias CreateFolder = Flag!"CreateFolder";
/** This `Logger` implementation writes log messages to the associated
file. The name of the file has to be passed on construction time. If the file
is already present new log messages will be append at its end.
*/
class FileLogger : Logger
{
import std.concurrency : Tid;
import std.datetime.systime : SysTime;
import std.format : formattedWrite;
/** A constructor for the `FileLogger` Logger.
Params:
fn = The filename of the output file of the `FileLogger`. If that
file can not be opened for writting an exception will be thrown.
lv = The `LogLevel` for the `FileLogger`. By default the
Example:
-------------
auto l1 = new FileLogger("logFile");
auto l2 = new FileLogger("logFile", LogLevel.fatal);
auto l3 = new FileLogger("logFile", LogLevel.fatal, CreateFolder.yes);
-------------
*/
this(in string fn, const LogLevel lv = LogLevel.all) @safe
{
this(fn, lv, CreateFolder.yes);
}
/** A constructor for the `FileLogger` Logger that takes a reference to
a `File`.
The `File` passed must be open for all the log call to the
`FileLogger`. If the `File` gets closed, using the `FileLogger`
for logging will result in undefined behaviour.
Params:
fn = The file used for logging.
lv = The `LogLevel` for the `FileLogger`. By default the
`LogLevel` for `FileLogger` is `LogLevel.all`.
createFileNameFolder = if yes and fn contains a folder name, this
folder will be created.
Example:
-------------
auto file = File("logFile.log", "w");
auto l1 = new FileLogger(file);
auto l2 = new FileLogger(file, LogLevel.fatal);
-------------
*/
this(in string fn, const LogLevel lv, CreateFolder createFileNameFolder) @safe
{
import std.file : exists, mkdirRecurse;
import std.path : dirName;
import std.conv : text;
super(lv);
this.filename = fn;
if (createFileNameFolder)
{
auto d = dirName(this.filename);
mkdirRecurse(d);
assert(exists(d), text("The folder the FileLogger should have",
" created in '", d,"' could not be created."));
}
this.file_.open(this.filename, "a");
}
/** A constructor for the `FileLogger` Logger that takes a reference to
a `File`.
The `File` passed must be open for all the log call to the
`FileLogger`. If the `File` gets closed, using the `FileLogger`
for logging will result in undefined behaviour.
Params:
file = The file used for logging.
lv = The `LogLevel` for the `FileLogger`. By default the
`LogLevel` for `FileLogger` is `LogLevel.all`.
Example:
-------------
auto file = File("logFile.log", "w");
auto l1 = new FileLogger(file);
auto l2 = new FileLogger(file, LogLevel.fatal);
-------------
*/
this(File file, const LogLevel lv = LogLevel.all) @safe
{
super(lv);
this.file_ = file;
}
/** If the `FileLogger` is managing the `File` it logs to, this
method will return a reference to this File.
*/
@property File file() @safe
{
return this.file_;
}
/* This method overrides the base class method in order to log to a file
without requiring heap allocated memory. Additionally, the `FileLogger`
local mutex is logged to serialize the log calls.
*/
override protected void beginLogMsg(string file, int line, string funcName,
string prettyFuncName, string moduleName, LogLevel logLevel,
Tid threadId, SysTime timestamp, Logger logger)
@safe
{
import std.string : lastIndexOf;
ptrdiff_t fnIdx = file.lastIndexOf('/') + 1;
ptrdiff_t funIdx = funcName.lastIndexOf('.') + 1;
auto lt = this.file_.lockingTextWriter();
systimeToISOString(lt, timestamp);
formattedWrite(lt, ":%s:%s:%u ", file[fnIdx .. $],
funcName[funIdx .. $], line);
}
/* This methods overrides the base class method and writes the parts of
the log call directly to the file.
*/
override protected void logMsgPart(scope const(char)[] msg)
{
formattedWrite(this.file_.lockingTextWriter(), "%s", msg);
}
/* This methods overrides the base class method and finalizes the active
log call. This requires flushing the `File` and releasing the
`FileLogger` local mutex.
*/
override protected void finishLogMsg()
{
this.file_.lockingTextWriter().put("\n");
this.file_.flush();
}
/* This methods overrides the base class method and delegates the
`LogEntry` data to the actual implementation.
*/
override protected void writeLogMsg(ref LogEntry payload)
{
this.beginLogMsg(payload.file, payload.line, payload.funcName,
payload.prettyFuncName, payload.moduleName, payload.logLevel,
payload.threadId, payload.timestamp, payload.logger);
this.logMsgPart(payload.msg);
this.finishLogMsg();
}
/** If the `FileLogger` was constructed with a filename, this method
returns this filename. Otherwise an empty `string` is returned.
*/
string getFilename()
{
return this.filename;
}
/** The `File` log messages are written to. */
protected File file_;
/** The filename of the `File` log messages are written to. */
protected string filename;
}
@system unittest
{
import std.array : empty;
import std.file : deleteme, remove;
import std.string : indexOf;
string filename = deleteme ~ __FUNCTION__ ~ ".tempLogFile";
auto l = new FileLogger(filename);
scope(exit)
{
remove(filename);
}
string notWritten = "this should not be written to file";
string written = "this should be written to file";
l.logLevel = LogLevel.critical;
l.log(LogLevel.warning, notWritten);
l.log(LogLevel.critical, written);
destroy(l);
auto file = File(filename, "r");
string readLine = file.readln();
assert(readLine.indexOf(written) != -1, readLine);
readLine = file.readln();
assert(readLine.indexOf(notWritten) == -1, readLine);
}
@safe unittest
{
import std.file : rmdirRecurse, exists, deleteme;
import std.path : dirName;
const string tmpFolder = dirName(deleteme);
const string filepath = tmpFolder ~ "/bug15771/minas/oops/";
const string filename = filepath ~ "output.txt";
assert(!exists(filepath));
auto f = new FileLogger(filename, LogLevel.all, CreateFolder.yes);
scope(exit) () @trusted { rmdirRecurse(tmpFolder ~ "/bug15771"); }();
f.log("Hello World!");
assert(exists(filepath));
f.file.close();
}
@system unittest
{
import std.array : empty;
import std.file : deleteme, remove;
import std.string : indexOf;
string filename = deleteme ~ __FUNCTION__ ~ ".tempLogFile";
auto file = File(filename, "w");
auto l = new FileLogger(file);
scope(exit)
{
remove(filename);
}
string notWritten = "this should not be written to file";
string written = "this should be written to file";
l.logLevel = LogLevel.critical;
l.log(LogLevel.warning, notWritten);
l.log(LogLevel.critical, written);
file.close();
file = File(filename, "r");
string readLine = file.readln();
assert(readLine.indexOf(written) != -1, readLine);
readLine = file.readln();
assert(readLine.indexOf(notWritten) == -1, readLine);
file.close();
}
@safe unittest
{
auto dl = cast(FileLogger) sharedLog;
assert(dl !is null);
assert(dl.logLevel == LogLevel.all);
assert(globalLogLevel == LogLevel.all);
auto tl = cast(StdForwardLogger) stdThreadLocalLog;
assert(tl !is null);
stdThreadLocalLog.logLevel = LogLevel.all;
}
|
D
|
module reggae.options;
import reggae.types: Backend;
import std.file: thisExePath;
import std.conv: ConvException;
import std.path: absolutePath, buildPath;
import std.file: exists;
struct Options {
Backend backend;
string projectPath;
string dflags;
string reggaePath;
string[string] userVars;
string cCompiler;
string cppCompiler;
string dCompiler;
bool noFetch;
bool help;
bool perModule;
bool isDubProject;
//finished setup
void finalize() @safe{
reggaePath = thisExePath();
if(!cCompiler) cCompiler = "gcc";
if(!cppCompiler) cppCompiler = "g++";
if(!dCompiler) dCompiler = "dmd";
isDubProject = _isDubProject;
if(isDubProject && backend == Backend.tup) {
throw new Exception("dub integration not supported with the tup backend");
}
}
private bool _isDubProject() @safe nothrow {
return buildPath(projectPath, "dub.json").exists ||
buildPath(projectPath, "package.json").exists;
}
}
//getopt is @system
Options getOptions(string[] args) @trusted {
import std.getopt;
Options options;
try {
auto helpInfo = getopt(
args,
"backend|b", "Backend to use (ninja|make). Mandatory.", &options.backend,
"dflags", "D compiler flags.", &options.dflags,
"d", "User-defined variables (e.g. -d myvar=foo).", &options.userVars,
"dc", "D compiler to use (default dmd).", &options.dCompiler,
"cc", "C compiler to use (default gcc).", &options.cCompiler,
"cxx", "C++ compiler to use (default g++).", &options.cppCompiler,
"nofetch", "Assume dub packages are present (no dub fetch).", &options.noFetch,
"per_module", "Compile D files per module (default is per package)", &options.perModule,
);
if(helpInfo.helpWanted) {
defaultGetoptPrinter("Usage: reggae -b <ninja|make> </path/to/project>",
helpInfo.options);
options.help = true;
}
} catch(ConvException ex) {
throw new Exception("Unsupported backend, -b must be one of: make|ninja|tup|binary");
}
if(args.length > 1) options.projectPath = args[1].absolutePath;
options.finalize();
return options;
}
string projectBuildFile(in Options options) @safe pure nothrow {
return buildPath(options.projectPath, "reggaefile.d");
}
|
D
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
module vtkGaussianBlurPass;
static import vtkd_im;
static import core.stdc.config;
static import std.conv;
static import std.string;
static import std.conv;
static import std.string;
static import vtkObjectBase;
static import vtkImageProcessingPass;
class vtkGaussianBlurPass : vtkImageProcessingPass.vtkImageProcessingPass {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(vtkd_im.vtkGaussianBlurPass_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(vtkGaussianBlurPass obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin vtkd_im.SwigOperatorDefinitions;
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
throw new object.Exception("C++ destructor does not have public access");
}
swigCPtr = null;
super.dispose();
}
}
}
public static vtkGaussianBlurPass New() {
void* cPtr = vtkd_im.vtkGaussianBlurPass_New();
vtkGaussianBlurPass ret = (cPtr is null) ? null : new vtkGaussianBlurPass(cPtr, false);
return ret;
}
public static int IsTypeOf(string type) {
auto ret = vtkd_im.vtkGaussianBlurPass_IsTypeOf((type ? std.string.toStringz(type) : null));
return ret;
}
public static vtkGaussianBlurPass SafeDownCast(vtkObjectBase.vtkObjectBase o) {
void* cPtr = vtkd_im.vtkGaussianBlurPass_SafeDownCast(vtkObjectBase.vtkObjectBase.swigGetCPtr(o));
vtkGaussianBlurPass ret = (cPtr is null) ? null : new vtkGaussianBlurPass(cPtr, false);
return ret;
}
public vtkGaussianBlurPass NewInstance() const {
void* cPtr = vtkd_im.vtkGaussianBlurPass_NewInstance(cast(void*)swigCPtr);
vtkGaussianBlurPass ret = (cPtr is null) ? null : new vtkGaussianBlurPass(cPtr, false);
return ret;
}
alias vtkImageProcessingPass.vtkImageProcessingPass.NewInstance NewInstance;
}
|
D
|
module mach.range.filter;
private:
import mach.traits : ElementType, isRange, isBidirectionalRange, isSavingRange;
import mach.traits : isMutableRange, isMutableFrontRange, isMutableBackRange;
import mach.traits : isMutableRemoveFrontRange, isMutableRemoveBackRange;
import mach.range.asrange : asrange, validAsRange, AsRangeElementType;
import mach.range.meta : MetaRangeEmptyMixin;
/++ Docs
This module implements the
[filter higher-order function](https://en.wikipedia.org/wiki/Filter_(higher-order_function))
for iterable inputs.
The `filter` function produces a range enumerating only those elements of an
input iterable which satisfy its predicate.
The predicate is passed as a template argument, and the input iterable can be
anything that is valid as a range.
The range returned by `filter` supports bidirectionality, saving, removal,
and mutation when the input range supports them. Infiniteness is similarly
propagated.
The range does not provide `length` or `remaining` properties, as the only way
to determine those values in advance is to traverse the outputted sequence.
To acquire these properties, or to get a slice or element at an index, the
`walklength`, `walkindex`, and `walkslice` functions in `mach.range.walk` may
be used.
+/
unittest{ /// Example
import mach.range.compare : equals;
auto range = [0, 1, 2, 3, 4].filter!(n => n % 2 == 0);
assert(range.equals([0, 2, 4]));
}
unittest{ /// Example
import mach.range.compare : equals;
auto range = "h e l l o".filter!(ch => ch != ' ');
assert(range.equals("hello"));
}
public:
/// Get whether an input can be filtered.
template canFilter(T, alias pred){
enum bool canFilter = validAsRange!T && is(typeof({
if(pred(AsRangeElementType!T.init)){}
}));
}
/// Get whether a `FilterRange` can be constructed from a given type.
template canFilterRange(T, alias pred){
enum bool canFilterRange = isRange!T && canFilter!(T, pred);
}
/// Given an object that can be taken as a range, create a new range which
/// enumerates only those values of the original range matching some predicate.
auto filter(alias pred, Iter)(auto ref Iter iter) if(canFilter!(Iter, pred)){
auto range = iter.asrange;
return FilterRange!(pred, typeof(range))(range);
}
/// Range for filtering the elements of an input according to a predicate function.
struct FilterRange(alias pred, Range) if(canFilterRange!(Range, pred)){
alias Element = typeof(Range.front);
mixin MetaRangeEmptyMixin!Range;
/// Represents the input being filtered.
Range source;
this(Range source){
this.source = source;
this.consumeFront();
static if(isBidirectionalRange!Range) this.consumeBack();
}
/// Get the front element.
@property auto front() in{assert(!this.empty);} body{
return this.source.front;
}
/// Pop the front element.
void popFront() in{assert(!this.empty);} body{
this.source.popFront();
this.consumeFront();
}
/// Pop values from the source range until a value matching the
/// predicate is found.
private void consumeFront(){
while(!this.source.empty && !pred(this.source.front)){
this.source.popFront();
}
}
static if(isBidirectionalRange!Range){
/// Get the back element.
@property auto back() in{assert(!this.empty);} body{
return this.source.back;
}
/// Pop the back element.
void popBack() in{assert(!this.empty);} body{
this.source.popBack();
this.consumeBack();
}
/// Pop values from the source range until a value matching the
/// predicate is found.
private void consumeBack(){
while(!this.source.empty && !pred(this.source.back)){
this.source.popBack();
}
}
}
static if(isSavingRange!Range){
/// Save the range.
@property typeof(this) save(){
return typeof(this)(this.source.save);
}
}
enum bool mutable = isMutableRange!Range;
static if(isMutableFrontRange!Range){
/// Set the front element.
@property void front(Element value) in{assert(!this.empty);} body{
this.source.front = value;
}
}
static if(isMutableBackRange!Range){
/// Set the back element.
@property void back(Element value) in{assert(!this.empty);} body{
this.source.back = value;
}
}
static if(isMutableRemoveFrontRange!Range){
/// Remove the front element.
auto removeFront(){
scope(exit) this.consumeFront();
return this.source.removeFront();
}
}
static if(isMutableRemoveBackRange!Range){
/// Remove the back element.
auto removeBack(){
scope(exit) this.consumeBack();
return this.source.removeBack();
}
}
}
version(unittest){
private:
import mach.test;
import mach.range.compare : equals;
import mach.range.consume : consume;
import mach.range.mutate : mutate;
import mach.range.retro : retro;
import mach.collect : DoublyLinkedList;
}
unittest{
tests("Filter", {
alias even = (n) => (n % 2 == 0);
tests("Iteration", {
auto empty = new int[0];
test(empty.filter!even.equals(empty));
test([0].filter!even.equals([0]));
test([1].filter!even.equals(empty));
test([1, 2, 3, 4, 5, 6].filter!even.equals([2, 4, 6]));
});
tests("Bidirectionality", {
test([2, 4, 5].filter!even.retro.equals([4, 2]));
auto range = [0, 1, 2, 3, 4].filter!even;
testeq(range.back, 4);
range.popBack();
testeq(range.back, 2);
range.popBack();
testeq(range.back, 0);
range.popBack();
test(range.empty);
testfail({range.front;});
testfail({range.popFront();});
testfail({range.back;});
testfail({range.popBack();});
});
tests("Saving", {
auto range = [0, 1, 2, 3].filter!even;
auto saved = range.save;
range.popFront();
testeq(range.front, 2);
testeq(saved.front, 0);
});
tests("Mutability", {
tests("Mutation", {
auto array = [1, 2, 3, 4, 5, 6];
array.filter!even.mutate!((n) => (n - 1)).consume;
testeq(array, [1, 1, 3, 3, 5, 5]);
});
tests("Mutation & Removal", {
auto list = new DoublyLinkedList!int([0, 1, 2, 3, 4, 5]);
auto range = list.filter!(n => n % 2);
testeq(range.front, 1);
testeq(range.back, 5);
range.front = 6;
testeq(range.front, 6);
test!equals(list.ivalues, [0, 6, 2, 3, 4, 5]);
range.back = 7;
testeq(range.back, 7);
test!equals(list.ivalues, [0, 6, 2, 3, 4, 7]);
range.removeFront();
testeq(range.front, 3);
test!equals(list.ivalues, [0, 2, 3, 4, 7]);
range.removeBack();
testeq(range.back, 3);
test!equals(list.ivalues, [0, 2, 3, 4]);
range.removeFront();
test(range.empty);
test!equals(list.ivalues, [0, 2, 4]);
testfail({range.front = 0;});
testfail({range.back = 0;});
testfail({range.removeFront();});
testfail({range.removeBack();});
});
});
});
}
|
D
|
module hunt.http.codec.http.model.QuotedCSV;
import std.array;
import std.conv;
import std.container.array;
import hunt.util.Common;
import hunt.collection.StringBuffer;
import hunt.text.Common;
import hunt.text.StringBuilder;
/**
* Implements a quoted comma separated list of values
* in accordance with RFC7230.
* OWS is removed and quoted characters ignored for parsing.
*
* @see "https://tools.ietf.org/html/rfc7230#section-3.2.6"
* @see "https://tools.ietf.org/html/rfc7230#section-7"
*/
class QuotedCSV : Iterable!string {
private enum State {VALUE, PARAM_NAME, PARAM_VALUE}
protected Array!string _values; // = new ArrayList<>();
protected bool _keepQuotes;
this(string[] values...) {
this(true, values);
}
this(bool keepQuotes, string[] values...) {
_keepQuotes = keepQuotes;
foreach (string v ; values)
addValue(v);
}
/**
* Add and parse a value string(s)
*
* @param value A value that may contain one or more Quoted CSV items.
*/
void addValue(string value)
{
if (value.empty)
return;
StringBuffer buffer = new StringBuffer();
int l = cast(int)value.length;
State state = State.VALUE;
bool quoted = false;
bool sloshed = false;
int nws_length = 0;
int last_length = 0;
int value_length = -1;
int param_name = -1;
int param_value = -1;
for (int i = 0; i <= l; i++) {
char c = (i == l ? 0 : value[i]);
// Handle quoting https://tools.ietf.org/html/rfc7230#section-3.2.6
if (quoted && c != 0) {
if (sloshed)
sloshed = false;
else {
switch (c) {
case '\\':
sloshed = true;
if (!_keepQuotes)
continue;
break;
case '"':
quoted = false;
if (!_keepQuotes)
continue;
break;
default: break;
}
}
buffer.append(c);
nws_length = buffer.length;
continue;
}
// Handle common cases
switch (c) {
case ' ':
case '\t':
if (buffer.length > last_length) // not leading OWS
buffer.append(c);
continue;
case '"':
quoted = true;
if (_keepQuotes) {
if (state == State.PARAM_VALUE && param_value < 0)
param_value = nws_length;
buffer.append(c);
} else if (state == State.PARAM_VALUE && param_value < 0)
param_value = nws_length;
nws_length = buffer.length;
continue;
case ';':
buffer.setLength(nws_length); // trim following OWS
if (state == State.VALUE) {
parsedValue(buffer);
value_length = buffer.length;
} else
parsedParam(buffer, value_length, param_name, param_value);
nws_length = buffer.length;
param_name = param_value = -1;
buffer.append(c);
last_length = ++nws_length;
state = State.PARAM_NAME;
continue;
case ',':
case 0:
if (nws_length > 0) {
buffer.setLength(nws_length); // trim following OWS
switch (state) {
case State.VALUE:
parsedValue(buffer);
break;
case State.PARAM_NAME:
case State.PARAM_VALUE:
parsedParam(buffer, value_length, param_name, param_value);
break;
default: break;
}
_values.insertBack(buffer.toString());
}
buffer.clear();
last_length = 0;
nws_length = 0;
value_length = param_name = param_value = -1;
state = State.VALUE;
continue;
case '=':
switch (state) {
case State.VALUE:
// It wasn't really a value, it was a param name
value_length = param_name = 0;
buffer.setLength(nws_length); // trim following OWS
string param = buffer.toString();
buffer.clear();
parsedValue(buffer);
value_length = buffer.length;
buffer.append(param);
buffer.append(c);
last_length = ++nws_length;
state = State.PARAM_VALUE;
continue;
case State.PARAM_NAME:
buffer.setLength(nws_length); // trim following OWS
buffer.append(c);
last_length = ++nws_length;
state = State.PARAM_VALUE;
continue;
case State.PARAM_VALUE:
if (param_value < 0)
param_value = nws_length;
buffer.append(c);
nws_length = buffer.length;
continue;
default: break;
}
continue;
default: {
final switch (state) {
case State.VALUE: {
buffer.append(c);
nws_length = buffer.length;
continue;
}
case State.PARAM_NAME: {
if (param_name < 0)
param_name = nws_length;
buffer.append(c);
nws_length = buffer.length;
continue;
}
case State.PARAM_VALUE: {
if (param_value < 0)
param_value = nws_length;
buffer.append(c);
nws_length = buffer.length;
}
}
}
}
}
}
/**
* Called when a value has been parsed
*
* @param buffer Containing the trimmed value, which may be mutated
*/
protected void parsedValue(ref StringBuffer buffer) {
}
/**
* Called when a parameter has been parsed
*
* @param buffer Containing the trimmed value and all parameters, which may be mutated
* @param valueLength The length of the value
* @param paramName The index of the start of the parameter just parsed
* @param paramValue The index of the start of the parameter value just parsed, or -1
*/
protected void parsedParam(ref StringBuffer, int valueLength, int paramName, int paramValue) {
}
int size() {
return cast(int)_values.length;
}
bool isEmpty() {
return _values.empty();
}
// List<string> getValues() {
// return _values;
// }
// ref Array!string getValues() {
// return _values;
// }
string[] getValues() {
return _values[].array;
}
int opApply(scope int delegate(ref string) dg)
{
int result = 0;
foreach(string v; _values)
{
result = dg(v);
if(result != 0) return result;
}
return result;
}
static string unquote(string s) {
// if (!StringUtils.hasText(s)) {
// return s;
// }
// handle trivial cases
int l = cast(int)s.length;
// Look for any quotes
int i = 0;
for (; i < l; i++) {
char c = s[i];
if (c == '"')
break;
}
if (i == l)
return s;
bool quoted = true;
bool sloshed = false;
StringBuilder buffer = new StringBuilder();
buffer.append(s, 0, i);
i++;
for (; i < l; i++) {
char c = s[i];
if (quoted) {
if (sloshed) {
buffer.append(c);
sloshed = false;
} else if (c == '"')
quoted = false;
else if (c == '\\')
sloshed = true;
else
buffer.append(c);
} else if (c == '"')
quoted = true;
else
buffer.append(c);
}
return buffer.toString();
}
override
string toString() {
return to!string(_values[]);
}
}
|
D
|
/Users/yajnavalkya/Developer/Rationalize/build/Rationalize.build/Debug-iphonesimulator/Rationalize.build/Objects-normal/x86_64/AppDelegate.o : /Users/yajnavalkya/Developer/Rationalize/Rationalize/AppDelegate.swift /Users/yajnavalkya/Developer/Rationalize/Rationalize/HouseholdTableViewController.swift /Users/yajnavalkya/Developer/Rationalize/Rationalize/ShoppingListTableViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/yajnavalkya/Developer/Rationalize/build/Rationalize.build/Debug-iphonesimulator/Rationalize.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule : /Users/yajnavalkya/Developer/Rationalize/Rationalize/AppDelegate.swift /Users/yajnavalkya/Developer/Rationalize/Rationalize/HouseholdTableViewController.swift /Users/yajnavalkya/Developer/Rationalize/Rationalize/ShoppingListTableViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/yajnavalkya/Developer/Rationalize/build/Rationalize.build/Debug-iphonesimulator/Rationalize.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc : /Users/yajnavalkya/Developer/Rationalize/Rationalize/AppDelegate.swift /Users/yajnavalkya/Developer/Rationalize/Rationalize/HouseholdTableViewController.swift /Users/yajnavalkya/Developer/Rationalize/Rationalize/ShoppingListTableViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
the condition or quality of being a virgin
|
D
|
instance VLK_507_Buddler(Npc_Default)
{
name[0] = NAME_Buddler;
npcType = npctype_ambient;
guild = GIL_VLK;
level = 2;
voice = 3;
id = 507;
attribute[ATR_STRENGTH] = 25;
attribute[ATR_DEXTERITY] = 20;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX] = 94;
attribute[ATR_HITPOINTS] = 94;
Mdl_SetVisual(self,"HUMANS.MDS");
Mdl_ApplyOverlayMds(self,"Humans_Tired.mds");
Mdl_SetVisualBody(self,"hum_body_Naked0",13,0,"Hum_Head_Thief",16,1,-1);
B_Scale(self);
Mdl_SetModelFatness(self,0);
fight_tactic = FAI_HUMAN_COWARD;
EquipItem(self,ItMw_1H_Nailmace_01);
CreateInvItem(self,ItMwPickaxe);
CreateInvItem(self,ItFoLoaf);
CreateInvItem(self,ItFoBeer);
CreateInvItem(self,ItLsTorch);
daily_routine = Rtn_start_507;
};
func void Rtn_start_507()
{
TA_Sleep(22,30,7,15,"OCR_HUT_54");
TA_StandAround(7,15,11,0,"OCR_OUTSIDE_HUT_54");
TA_Smalltalk(11,0,17,0,"OCR_OUTSIDE_HUT_53");
TA_StandAround(17,0,22,30,"OCR_OUTSIDE_HUT_54");
};
|
D
|
import std.algorithm;
import std.conv;
import std.datetime;
import std.format;
import std.range;
import std.stdio;
import std.string;
import std.socket;
import std.uni;
import core.thread;
import utils.http_server;
class HelloWorldProcessor : HttpProcessor {
this(Socket sock){ super(sock); }
override void onComplete(HttpRequest req) {
respondWith("Hello, world!", 200);
}
}
void server_worker(Socket client) {
scope processor = new HelloWorldProcessor(client);
processor.run();
}
void server() {
Socket server = new TcpSocket();
server.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true);
server.bind(new InternetAddress("0.0.0.0", 8080));
server.listen(1000);
debug writeln("Started server");
void processClient(Socket client) {
new Thread(() => server_worker(client)).start();
}
while(true) {
try {
debug writeln("Waiting for server.accept()");
Socket client = server.accept();
debug writeln("New client accepted");
processClient(client);
}
catch(Exception e) {
writefln("Failure to accept %s", e);
}
}
}
void main() {
version(Windows) {
import core.memory;
GC.disable(); // temporary for Win64 UMS threading
}
new Thread(() => server()).start();
}
|
D
|
/**
#
#Copyright (c) 2018 IoTone, Inc. All rights reserved.
#
**/
module shelld.shellnode;
|
D
|
the commercial enterprise of moving goods and materials
conveyance provided by the ships belonging to one country or industry
transport commercially
hire for work on a ship
go on board
travel by ship
place on board a ship
|
D
|
module game.ui.hotbar;
class Hotbar {
}
|
D
|
/**
* Compute common subexpressions for non-optimized code generation
*
* Compiler implementation of the
* $(LINK2 https://www.dlang.org, D programming language).
*
* Compute common subexpressions for non-optimized builds.
*
* Copyright: Copyright (C) 1985-1995 by Symantec
* Copyright (C) 2000-2023 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: https://github.com/dlang/dmd/blob/master/src/dmd/backend/cgcs.d
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/cgcs.d
*/
module dmd.backend.cgcs;
import core.stdc.stdio;
import core.stdc.stdlib;
import dmd.backend.cc;
import dmd.backend.cdef;
import dmd.backend.code;
import dmd.backend.el;
import dmd.backend.global;
import dmd.backend.oper;
import dmd.backend.ty;
import dmd.backend.type;
import dmd.backend.barray;
import dmd.backend.dlist;
import dmd.backend.dvec;
nothrow:
@safe:
/*******************************
* Do common subexpression elimination for non-optimized builds.
*/
@trusted
public extern (C++) void comsubs()
{
debug if (debugx) printf("comsubs(%p)\n",startblock);
version (SCPP)
{
if (errcnt)
return;
}
comsubs2(startblock, cgcsdata);
debug if (debugx)
printf("done with comsubs()\n");
}
/*******************************
*/
@trusted
public extern (C++) void cgcs_term()
{
cgcsdata.term();
debug debugw && printf("cgcs_term()\n");
}
/***********************************************************************/
private:
alias hash_t = uint; // for hash values
/*******************************
* Eliminate common subexpressions across extended basic blocks.
* String together as many blocks as we can.
*/
@trusted
void comsubs2(block* startblock, ref CGCS cgcs)
{
// No longer just compute Bcount - eliminate unreachable blocks too
block_compbcount(); // eliminate unreachable blocks
cgcs.start();
block* bln;
for (block* bl = startblock; bl; bl = bln)
{
bln = bl.Bnext;
if (!bl.Belem)
continue; /* if no expression or no parents */
// Count up n, the number of blocks in this extended basic block (EBB)
int n = 1; // always at least one block in EBB
auto blc = bl;
while (bln && list_nitems(bln.Bpred) == 1 &&
((blc.BC == BCiftrue &&
blc.nthSucc(1) == bln) ||
(blc.BC == BCgoto && blc.nthSucc(0) == bln)
) &&
bln.BC != BCasm // no CSE's extending across ASM blocks
)
{
n++; // add block to EBB
blc = bln;
bln = blc.Bnext;
}
cgcs.reset();
bln = bl;
while (n--) // while more blocks in EBB
{
debug if (debugx)
printf("cses for block %p\n",bln);
if (bln.Belem)
ecom(cgcs, bln.Belem); // do the tree
bln = bln.Bnext;
}
}
}
/*********************************
* Struct for each potential CSE
*/
struct HCS
{
elem* Helem; /// pointer to elem
hash_t Hhash; /// hash value for the elem
}
struct HCSArray
{
size_t touchstari;
size_t[2] touchfunci;
}
/**************************************
* All the global data for this module
*/
struct CGCS
{
Barray!HCS hcstab; // array of hcs's
HCSArray hcsarray;
// Use a bit vector for quick check if expression is possibly in hcstab[].
// This results in much faster compiles when hcstab[] gets big.
vec_t csvec; // vector of used entries
enum CSVECDIM = 16_001; //8009 //3001 // dimension of csvec (should be prime)
nothrow:
/*********************************
* Initialize for this iteration.
*/
void start()
{
if (!csvec)
{
csvec = vec_calloc(CGCS.CSVECDIM);
}
}
/*******************************
* Reset for next time.
* hcstab[]'s storage is kept instead of reallocated.
*/
void reset()
{
vec_clear(csvec); // don't free it, recycle storage
hcstab.reset();
hcsarray = HCSArray.init;
}
/*********************************
* All done for this compiler instance.
*/
void term()
{
vec_free(csvec);
csvec = null;
//hcstab.dtor(); // cache allocation for next iteration
}
/****************************
* Add an elem to the common subexpression table.
*/
void push(elem *e, hash_t hash)
{
hcstab.push(HCS(e, hash));
}
/*******************************
* Eliminate all common subexpressions.
*/
void touchall()
{
foreach (ref hcs; hcstab[])
{
hcs.Helem = null;
}
const len = hcstab.length;
hcsarray.touchstari = len;
hcsarray.touchfunci[0] = len;
hcsarray.touchfunci[1] = len;
}
}
__gshared CGCS cgcsdata;
/*************************
* Eliminate common subexpressions for an element.
* Params:
* cgcs = cgcsdata
* pe = elem that is changed to previous elem if it's a CSE
*/
@trusted
void ecom(ref CGCS cgcs, ref elem* pe)
{
auto e = pe;
assert(e);
elem_debug(e);
debug assert(e.Ecount == 0);
//assert(e.Ecomsub == 0);
const tym = tybasic(e.Ety);
const op = e.Eoper;
switch (op)
{
case OPconst:
case OPrelconst:
break;
case OPvar:
if (e.EV.Vsym.ty() & mTYshared)
return; // don't cache shared variables
break;
case OPstreq:
case OPpostinc:
case OPpostdec:
case OPeq:
case OPaddass:
case OPminass:
case OPmulass:
case OPdivass:
case OPmodass:
case OPshrass:
case OPashrass:
case OPshlass:
case OPandass:
case OPxorass:
case OPorass:
case OPvecsto:
/* Reverse order of evaluation for double op=. This is so that */
/* the pushing of the address of the second operand is easier. */
/* However, with the 8087 we don't need the kludge. */
if (op != OPeq && tym == TYdouble && !config.inline8087)
{
if (!OTleaf(e.EV.E1.Eoper))
ecom(cgcs, e.EV.E1.EV.E1);
ecom(cgcs, e.EV.E2);
}
else
{
/* Don't mark the increment of an i++ or i-- as a CSE, if it */
/* can be done with an INC or DEC instruction. */
if (!(OTpost(op) && elemisone(e.EV.E2)))
ecom(cgcs, e.EV.E2); /* evaluate 2nd operand first */
case OPnegass:
if (!OTleaf(e.EV.E1.Eoper)) /* if lvalue is an operator */
{
if (e.EV.E1.Eoper != OPind)
elem_print(e);
assert(e.EV.E1.Eoper == OPind);
ecom(cgcs, e.EV.E1.EV.E1);
}
}
touchlvalue(cgcs, e.EV.E1);
if (!OTpost(op)) /* lvalue of i++ or i-- is not a cse*/
{
const hash = cs_comphash(e.EV.E1);
vec_setbit(hash % CGCS.CSVECDIM,cgcs.csvec);
cgcs.push(e.EV.E1,hash); // add lvalue to cgcs.hcstab[]
}
return;
case OPbtc:
case OPbts:
case OPbtr:
case OPcmpxchg:
ecom(cgcs, e.EV.E1);
ecom(cgcs, e.EV.E2);
touchfunc(cgcs, 0); // indirect assignment
return;
case OPandand:
case OPoror:
{
ecom(cgcs, e.EV.E1);
const lengthSave = cgcs.hcstab.length;
auto hcsarraySave = cgcs.hcsarray;
ecom(cgcs, e.EV.E2);
cgcs.hcsarray = hcsarraySave; // no common subs by E2
cgcs.hcstab.setLength(lengthSave);
return; /* if comsub then logexp() will */
}
case OPcond:
{
ecom(cgcs, e.EV.E1);
const lengthSave = cgcs.hcstab.length;
auto hcsarraySave = cgcs.hcsarray;
ecom(cgcs, e.EV.E2.EV.E1); // left condition
cgcs.hcsarray = hcsarraySave; // no common subs by E2
cgcs.hcstab.setLength(lengthSave);
ecom(cgcs, e.EV.E2.EV.E2); // right condition
cgcs.hcsarray = hcsarraySave; // no common subs by E2
cgcs.hcstab.setLength(lengthSave);
return; // can't be a common sub
}
case OPcall:
case OPcallns:
ecom(cgcs, e.EV.E2); /* eval right first */
goto case OPucall;
case OPucall:
case OPucallns:
ecom(cgcs, e.EV.E1);
touchfunc(cgcs, 1);
return;
case OPstrpar: /* so we don't break logexp() */
case OPinp: /* never CSE the I/O instruction itself */
case OPprefetch: // don't CSE E2 or the instruction
ecom(cgcs, e.EV.E1);
goto case OPasm;
case OPasm:
case OPstrthis: // don't CSE these
case OPframeptr:
case OPgot:
case OPctor:
case OPdtor:
case OPdctor:
case OPmark:
return;
case OPddtor:
cgcs.touchall();
ecom(cgcs, e.EV.E1);
cgcs.touchall();
return;
case OPparam:
case OPoutp:
ecom(cgcs, e.EV.E1);
goto case OPinfo;
case OPinfo:
ecom(cgcs, e.EV.E2);
return;
case OPcomma:
ecom(cgcs, e.EV.E1);
ecom(cgcs, e.EV.E2);
return;
case OPremquo:
ecom(cgcs, e.EV.E1);
ecom(cgcs, e.EV.E2);
break;
case OPvp_fp:
case OPcvp_fp:
ecom(cgcs, e.EV.E1);
touchaccess(cgcs.hcstab, e);
break;
case OPind:
ecom(cgcs, e.EV.E1);
/* Generally, CSEing a *(double *) results in worse code */
if (tyfloating(tym))
return;
if (tybasic(e.EV.E1.Ety) == TYsharePtr)
return;
break;
case OPstrcpy:
case OPstrcat:
case OPmemcpy:
case OPmemset:
ecom(cgcs, e.EV.E2);
goto case OPsetjmp;
case OPsetjmp:
ecom(cgcs, e.EV.E1);
touchfunc(cgcs, 0);
return;
default: /* other operators */
if (!OTbinary(e.Eoper))
printf("e.Eoper: '%s'\n", oper_str(e.Eoper));
assert(OTbinary(e.Eoper));
goto case OPadd;
case OPadd:
case OPmin:
case OPmul:
case OPdiv:
case OPor:
case OPxor:
case OPand:
case OPeqeq:
case OPne:
case OPscale:
case OPyl2x:
case OPyl2xp1:
ecom(cgcs, e.EV.E1);
ecom(cgcs, e.EV.E2);
break;
case OPstring:
case OPaddr:
case OPbit:
printf("e.Eoper: '%s'\n", oper_str(e.Eoper));
elem_print(e);
assert(0); /* optelem() should have removed these */
// Explicitly list all the unary ops for speed
case OPnot: case OPcom: case OPneg: case OPuadd:
case OPabs: case OPrndtol: case OPrint:
case OPpreinc: case OPpredec:
case OPbool: case OPstrlen: case OPs16_32: case OPu16_32:
case OPs32_d: case OPu32_d: case OPd_s16: case OPs16_d: case OP32_16:
case OPf_d:
case OPld_d:
case OPc_r: case OPc_i:
case OPu8_16: case OPs8_16: case OP16_8:
case OPu32_64: case OPs32_64: case OP64_32: case OPmsw:
case OPu64_128: case OPs64_128: case OP128_64:
case OPs64_d: case OPd_u64: case OPu64_d:
case OPstrctor: case OPu16_d: case OPd_u16:
case OParrow:
case OPvoid:
case OPbsf: case OPbsr: case OPbswap: case OPpopcnt: case OPvector:
case OPld_u64:
case OPsqrt: case OPsin: case OPcos:
case OPoffset: case OPnp_fp: case OPnp_f16p: case OPf16p_np:
case OPvecfill: case OPtoprec:
ecom(cgcs, e.EV.E1);
break;
case OPd_ld:
return;
case OPd_f:
{
const op1 = e.EV.E1.Eoper;
if (config.fpxmmregs &&
(op1 == OPs32_d ||
I64 && (op1 == OPs64_d || op1 == OPu32_d))
)
ecom(cgcs, e.EV.E1.EV.E1); // e and e1 ops are fused (see xmmcnvt())
else
ecom(cgcs, e.EV.E1);
break;
}
case OPd_s32:
case OPd_u32:
case OPd_s64:
if (e.EV.E1.Eoper == OPf_d && config.fpxmmregs)
ecom(cgcs, e.EV.E1.EV.E1); // e and e1 ops are fused (see xmmcnvt());
else
ecom(cgcs, e.EV.E1);
break;
case OPhalt:
return;
}
/* don't CSE structures or unions or volatile stuff */
if (tym == TYstruct ||
tym == TYvoid ||
e.Ety & mTYvolatile)
return;
if (tyfloating(tym) && config.inline8087)
{
/* can CSE XMM code, but not x87
*/
if (!(config.fpxmmregs && tyxmmreg(tym)))
return;
}
const hash = cs_comphash(e); /* must be AFTER leaves are done */
/* Search for a match in hcstab[].
* Search backwards, as most likely matches will be towards the end
* of the list.
*/
debug if (debugx) printf("elem: %p hash: %6d\n",e,hash);
int csveci = hash % CGCS.CSVECDIM;
if (vec_testbit(csveci,cgcs.csvec))
{
foreach_reverse (i, ref hcs; cgcs.hcstab[])
{
debug if (debugx)
printf("i: %2d Hhash: %6d Helem: %p\n",
cast(int) i,hcs.Hhash,hcs.Helem);
elem* ehash;
if (hash == hcs.Hhash && (ehash = hcs.Helem) != null)
{
/* if elems are the same and we still have room for more */
if (el_match(e,ehash) && ehash.Ecount < 0xFF)
{
/* Make sure leaves are also common subexpressions
* to avoid false matches.
*/
if (!OTleaf(op))
{
if (!e.EV.E1.Ecount)
continue;
if (OTbinary(op) && !e.EV.E2.Ecount)
continue;
}
ehash.Ecount++;
pe = ehash;
debug if (debugx)
printf("**MATCH** %p with %p\n",e,pe);
el_free(e);
return;
}
}
}
}
else
vec_setbit(csveci,cgcs.csvec);
cgcs.push(e,hash); // add this elem to hcstab[]
}
/**************************
* Compute hash function for elem e.
*/
@trusted
hash_t cs_comphash(const elem *e)
{
elem_debug(e);
const op = e.Eoper;
hash_t hash = (e.Ety & (mTYbasic | mTYconst | mTYvolatile)) + (op << 8);
if (!OTleaf(op))
{
hash += cast(hash_t) e.EV.E1;
if (OTbinary(op))
hash += cast(hash_t) e.EV.E2;
}
else
{
hash += e.EV.Vint;
if (op == OPvar || op == OPrelconst)
hash += cast(hash_t) e.EV.Vsym;
}
return hash;
}
/***************************
* "touch" the elem.
* If it is a pointer, "touch" all the suspects
* who could be pointed to.
* Eliminate common subs that are indirect loads.
*/
@trusted
void touchlvalue(ref CGCS cgcs, const elem* e)
{
if (e.Eoper == OPind) /* if indirect store */
{
/* NOTE: Some types of array assignments do not need
* to touch all variables. (Like a[5], where a is an
* array instead of a pointer.)
*/
touchfunc(cgcs, 0);
return;
}
foreach_reverse (ref hcs; cgcs.hcstab[])
{
if (hcs.Helem &&
hcs.Helem.EV.Vsym == e.EV.Vsym)
hcs.Helem = null;
}
if (!(e.Eoper == OPvar || e.Eoper == OPrelconst))
{
elem_print(e);
assert(0);
}
switch (e.EV.Vsym.Sclass)
{
case SC.regpar:
case SC.register:
case SC.pseudo:
break;
case SC.auto_:
case SC.parameter:
case SC.fastpar:
case SC.shadowreg:
case SC.bprel:
if (e.EV.Vsym.Sflags & SFLunambig)
break;
goto case SC.static_;
case SC.static_:
case SC.extern_:
case SC.global:
case SC.locstat:
case SC.comdat:
case SC.inline:
case SC.sinline:
case SC.einline:
case SC.comdef:
touchstar(cgcs);
break;
default:
elem_print(e);
symbol_print(e.EV.Vsym);
assert(0);
}
}
/**************************
* "touch" variables that could be changed by a function call or
* an indirect assignment.
* Eliminate any subexpressions that are "starred" (they need to
* be recomputed).
* Params:
* flag = If 1, then this is a function call.
* If 0, then this is an indirect assignment.
*/
@trusted
void touchfunc(ref CGCS cgcs, int flag)
{
//printf("touchfunc(%d)\n", flag);
//pe = &cgcs.hcstab[0]; printf("pe = %p, petop = %p\n",pe,petop);
assert(cgcs.hcsarray.touchfunci[flag] <= cgcs.hcstab.length);
foreach (ref pe; cgcs.hcstab[cgcs.hcsarray.touchfunci[flag] .. cgcs.hcstab.length])
{
const he = pe.Helem;
if (!he)
continue;
switch (he.Eoper)
{
case OPvar:
if (Symbol_isAffected(*he.EV.Vsym))
{
pe.Helem = null;
continue;
}
break;
case OPind:
if (tybasic(he.EV.E1.Ety) == TYimmutPtr)
break;
goto Ltouch;
case OPstrlen:
case OPstrcmp:
case OPmemcmp:
case OPbt:
goto Ltouch;
case OPvp_fp:
case OPcvp_fp:
if (flag == 0) /* function calls destroy vptrfptr's, */
break; /* not indirect assignments */
Ltouch:
pe.Helem = null;
break;
default:
break;
}
}
cgcs.hcsarray.touchfunci[flag] = cgcs.hcstab.length;
}
/*******************************
* Eliminate all common subexpressions that
* do any indirection ("starred" elems).
*/
@trusted
void touchstar(ref CGCS cgcs)
{
foreach (ref hcs; cgcs.hcstab[cgcs.hcsarray.touchstari .. $])
{
const e = hcs.Helem;
if (e &&
(e.Eoper == OPind && tybasic(e.EV.E1.Ety) != TYimmutPtr ||
e.Eoper == OPbt) )
hcs.Helem = null;
}
cgcs.hcsarray.touchstari = cgcs.hcstab.length;
}
/*****************************************
* Eliminate any common subexpressions that could be modified
* if a handle pointer access occurs.
*/
@trusted
void touchaccess(ref Barray!HCS hcstab, const elem *ev) pure nothrow
{
const ev1 = ev.EV.E1;
foreach (ref hcs; hcstab[])
{
const e = hcs.Helem;
/* Invalidate any previous handle pointer accesses that */
/* are not accesses of ev. */
if (e && (e.Eoper == OPvp_fp || e.Eoper == OPcvp_fp) && e.EV.E1 != ev1)
hcs.Helem = null;
}
}
|
D
|
// Written in the D programming language.
/**
Serialize data to $(D ubyte) arrays.
* Macros:
* WIKI = Phobos/StdOutbuffer
*
* Copyright: Copyright Digital Mars 2000 - 2015.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: $(WEB digitalmars.com, Walter Bright)
* Source: $(PHOBOSSRC std/_outbuffer.d)
*/
module std.outbuffer;
private
{
import core.memory;
import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.stdlib;
import std.algorithm;
import std.string;
}
/*********************************************
* OutBuffer provides a way to build up an array of bytes out
* of raw data. It is useful for things like preparing an
* array of bytes to write out to a file.
* OutBuffer's byte order is the format native to the computer.
* To control the byte order (endianness), use a class derived
* from OutBuffer.
* OutBuffer's internal buffer is allocated with the GC. Pointers
* stored into the buffer are scanned by the GC, but you have to
* ensure proper alignment, e.g. by using alignSize((void*).sizeof).
*/
class OutBuffer
{
ubyte[] data;
size_t offset;
invariant()
{
//printf("this = %p, offset = %x, data.length = %u\n", this, offset, data.length);
assert(offset <= data.length);
}
pure nothrow @safe
{
this()
{
//printf("in OutBuffer constructor\n");
}
/*********************************
* Convert to array of bytes.
*/
ubyte[] toBytes() { return data[0 .. offset]; }
/***********************************
* Preallocate nbytes more to the size of the internal buffer.
*
* This is a
* speed optimization, a good guess at the maximum size of the resulting
* buffer will improve performance by eliminating reallocations and copying.
*/
void reserve(size_t nbytes) @trusted
in
{
assert(offset + nbytes >= offset);
}
out
{
assert(offset + nbytes <= data.length);
}
body
{
//c.stdio.printf("OutBuffer.reserve: length = %d, offset = %d, nbytes = %d\n", data.length, offset, nbytes);
if (data.length < offset + nbytes)
{
void[] vdata = data;
vdata.length = (offset + nbytes + 7) * 2; // allocates as void[] to not set BlkAttr.NO_SCAN
data = cast(ubyte[])vdata;
}
}
/**********************************
* put enables OutBuffer to be used as an OutputRange.
*/
alias put = write;
/*************************************
* Append data to the internal buffer.
*/
void write(const(ubyte)[] bytes)
{
reserve(bytes.length);
data[offset .. offset + bytes.length] = bytes[];
offset += bytes.length;
}
void write(in wchar[] chars) @trusted
{
write(cast(ubyte[]) chars);
}
void write(const(dchar)[] chars) @trusted
{
write(cast(ubyte[]) chars);
}
void write(ubyte b) /// ditto
{
reserve(ubyte.sizeof);
this.data[offset] = b;
offset += ubyte.sizeof;
}
void write(byte b) { write(cast(ubyte)b); } /// ditto
void write(char c) { write(cast(ubyte)c); } /// ditto
void write(dchar c) { write(cast(uint)c); } /// ditto
void write(ushort w) @trusted /// ditto
{
reserve(ushort.sizeof);
*cast(ushort *)&data[offset] = w;
offset += ushort.sizeof;
}
void write(short s) { write(cast(ushort)s); } /// ditto
void write(wchar c) @trusted /// ditto
{
reserve(wchar.sizeof);
*cast(wchar *)&data[offset] = c;
offset += wchar.sizeof;
}
void write(uint w) @trusted /// ditto
{
reserve(uint.sizeof);
*cast(uint *)&data[offset] = w;
offset += uint.sizeof;
}
void write(int i) { write(cast(uint)i); } /// ditto
void write(ulong l) @trusted /// ditto
{
reserve(ulong.sizeof);
*cast(ulong *)&data[offset] = l;
offset += ulong.sizeof;
}
void write(long l) { write(cast(ulong)l); } /// ditto
void write(float f) @trusted /// ditto
{
reserve(float.sizeof);
*cast(float *)&data[offset] = f;
offset += float.sizeof;
}
void write(double f) @trusted /// ditto
{
reserve(double.sizeof);
*cast(double *)&data[offset] = f;
offset += double.sizeof;
}
void write(real f) @trusted /// ditto
{
reserve(real.sizeof);
*cast(real *)&data[offset] = f;
offset += real.sizeof;
}
void write(in char[] s) @trusted /// ditto
{
write(cast(ubyte[])s);
}
void write(OutBuffer buf) /// ditto
{
write(buf.toBytes());
}
/****************************************
* Append nbytes of 0 to the internal buffer.
*/
void fill0(size_t nbytes)
{
reserve(nbytes);
data[offset .. offset + nbytes] = 0;
offset += nbytes;
}
/**********************************
* 0-fill to align on power of 2 boundary.
*/
void alignSize(size_t alignsize)
in
{
assert(alignsize && (alignsize & (alignsize - 1)) == 0);
}
out
{
assert((offset & (alignsize - 1)) == 0);
}
body
{
auto nbytes = offset & (alignsize - 1);
if (nbytes)
fill0(alignsize - nbytes);
}
/****************************************
* Optimize common special case alignSize(2)
*/
void align2()
{
if (offset & 1)
write(cast(byte)0);
}
/****************************************
* Optimize common special case alignSize(4)
*/
void align4()
{
if (offset & 3)
{ auto nbytes = (4 - offset) & 3;
fill0(nbytes);
}
}
/**************************************
* Convert internal buffer to array of chars.
*/
override string toString() const
{
//printf("OutBuffer.toString()\n");
return cast(string) data[0 .. offset].idup;
}
}
/*****************************************
* Append output of C's vprintf() to internal buffer.
*/
void vprintf(string format, va_list args) @trusted nothrow
{
char[128] buffer;
int count;
// Can't use `tempCString()` here as it will result in compilation error:
// "cannot mix core.std.stdlib.alloca() and exception handling".
auto f = toStringz(format);
auto p = buffer.ptr;
auto psize = buffer.length;
for (;;)
{
version(Windows)
{
count = vsnprintf(p,psize,f,args);
if (count != -1)
break;
psize *= 2;
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
}
else version(Posix)
{
count = vsnprintf(p,psize,f,args);
if (count == -1)
psize *= 2;
else if (count >= psize)
psize = count + 1;
else
break;
/+
if (p != buffer)
c.stdlib.free(p);
p = (char *) c.stdlib.malloc(psize); // buffer too small, try again with larger size
+/
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
}
else
{
static assert(0);
}
}
write(cast(ubyte[]) p[0 .. count]);
/+
version (Posix)
{
if (p != buffer)
c.stdlib.free(p);
}
+/
}
/*****************************************
* Append output of C's printf() to internal buffer.
*/
void printf(string format, ...) @trusted
{
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
}
/**
* Formats and writes its arguments in text format to the OutBuffer.
*
* Params:
* fmt = format string as described in $(XREF format, formattedWrite)
* args = arguments to be formatted
*
* See_Also:
* $(XREF stdio, _writef);
* $(XREF format, formattedWrite);
*/
void writef(Char, A...)(in Char[] fmt, A args)
{
import std.format : formattedWrite;
formattedWrite(this, fmt, args);
}
///
unittest
{
OutBuffer b = new OutBuffer();
b.writef("a%sb", 16);
assert(b.toString() == "a16b");
}
/**
* Formats and writes its arguments in text format to the OutBuffer,
* followed by a newline.
*
* Params:
* fmt = format string as described in $(XREF format, formattedWrite)
* args = arguments to be formatted
*
* See_Also:
* $(XREF stdio, _writefln);
* $(XREF format, formattedWrite);
*/
void writefln(Char, A...)(in Char[] fmt, A args)
{
import std.format : formattedWrite;
formattedWrite(this, fmt, args);
put('\n');
}
///
unittest
{
OutBuffer b = new OutBuffer();
b.writefln("a%sb", 16);
assert(b.toString() == "a16b\n");
}
/*****************************************
* At offset index into buffer, create nbytes of space by shifting upwards
* all data past index.
*/
void spread(size_t index, size_t nbytes) pure nothrow @safe
in
{
assert(index <= offset);
}
body
{
reserve(nbytes);
// This is an overlapping copy - should use memmove()
for (size_t i = offset; i > index; )
{
--i;
data[i + nbytes] = data[i];
}
offset += nbytes;
}
}
unittest
{
//printf("Starting OutBuffer test\n");
OutBuffer buf = new OutBuffer();
//printf("buf = %p\n", buf);
//printf("buf.offset = %x\n", buf.offset);
assert(buf.offset == 0);
buf.write("hello"[]);
buf.write(cast(byte)0x20);
buf.write("world"[]);
buf.printf(" %d", 6);
//auto s = buf.toString();
//printf("buf = '%.*s'\n", s.length, s.ptr);
assert(cmp(buf.toString(), "hello world 6") == 0);
}
unittest
{
import std.range;
static assert(isOutputRange!(OutBuffer, char));
import std.algorithm;
{
OutBuffer buf = new OutBuffer();
"hello".copy(buf);
assert(buf.toBytes() == "hello");
}
{
OutBuffer buf = new OutBuffer();
"hello"w.copy(buf);
assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00");
}
{
OutBuffer buf = new OutBuffer();
"hello"d.copy(buf);
assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00");
}
}
|
D
|
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/Fluent.build/Objects-normal/x86_64/Driver.o : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/UUID.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Database+Schema.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Blob.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Field.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/ComputedField.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Method+Node.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Filter+Node.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Query+Page.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Page.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Storage.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Timestampable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Paginatable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Transactable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/SoftDeletable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QueryRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/RowConvertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Filter+Scope.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/IdentifierType.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Database.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Aggregate.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Scope+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Relation+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Comparison+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Log.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Chunk.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/PivotProtocol.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/ThreadConnectionPool.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Children.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Join.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Database+Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Migration.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Action.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Connection.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/KeyNamingConvention.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Comparison.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Query+Group.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Builder.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Modifier.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Query+Filter.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Filter.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Driver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQLite/SQLiteDriver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQL/SQLSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQL/GeneralSQLSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQLite/SQLiteSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/RelationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/PaginationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/PreparationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/PivotError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QueryError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/EntityError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Creator.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Executor.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Siblings.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Exports.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Distinct.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Limit.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Parent.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/Pivot.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/DoublePivot.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Sort.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/RowContext.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Raw.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/Row.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Index.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/ForeignKey.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Query.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Entity.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Dirty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SQLite.framework/Modules/SQLite.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Random.framework/Modules/Random.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/sqlite.git--8232814251736334455/Sources/CSQLite/include/sqlite3.h /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CSQLite/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/Fluent.build/Objects-normal/x86_64/Driver~partial.swiftmodule : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/UUID.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Database+Schema.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Blob.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Field.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/ComputedField.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Method+Node.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Filter+Node.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Query+Page.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Page.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Storage.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Timestampable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Paginatable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Transactable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/SoftDeletable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QueryRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/RowConvertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Filter+Scope.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/IdentifierType.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Database.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Aggregate.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Scope+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Relation+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Comparison+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Log.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Chunk.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/PivotProtocol.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/ThreadConnectionPool.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Children.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Join.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Database+Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Migration.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Action.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Connection.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/KeyNamingConvention.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Comparison.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Query+Group.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Builder.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Modifier.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Query+Filter.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Filter.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Driver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQLite/SQLiteDriver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQL/SQLSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQL/GeneralSQLSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQLite/SQLiteSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/RelationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/PaginationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/PreparationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/PivotError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QueryError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/EntityError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Creator.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Executor.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Siblings.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Exports.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Distinct.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Limit.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Parent.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/Pivot.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/DoublePivot.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Sort.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/RowContext.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Raw.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/Row.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Index.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/ForeignKey.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Query.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Entity.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Dirty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SQLite.framework/Modules/SQLite.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Random.framework/Modules/Random.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/sqlite.git--8232814251736334455/Sources/CSQLite/include/sqlite3.h /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CSQLite/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/Fluent.build/Objects-normal/x86_64/Driver~partial.swiftdoc : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/UUID.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Database+Schema.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Blob.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Field.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/ComputedField.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Method+Node.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Filter+Node.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Query+Page.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Page.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Storage.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Timestampable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/Paginatable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Transactable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/SoftDeletable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QueryRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/RowConvertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Filter+Scope.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/IdentifierType.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Database.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Aggregate.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Scope+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Relation+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/NodeUtilities/Comparison+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Log.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Chunk.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/PivotProtocol.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/ThreadConnectionPool.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Children.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Join.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Database+Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/Migration.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Action.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Connection.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/KeyNamingConvention.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Comparison.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Query+Group.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Builder.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Modifier.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Query+Filter.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Filter/Filter.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Driver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQLite/SQLiteDriver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQL/SQLSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQL/GeneralSQLSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/SQLite/SQLiteSerializer.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/RelationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pagination/PaginationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Preparation/PreparationError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/PivotError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QueryError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/EntityError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Creator.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/Executor.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Siblings.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Exports.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Distinct.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Limit.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Parent.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/Pivot.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Pivot/DoublePivot.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Sort.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/RowContext.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Raw.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Row/Row.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/Index.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/ForeignKey.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/Query.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Entity.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Entity/Dirty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SQLite.framework/Modules/SQLite.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Random.framework/Modules/Random.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/sqlite.git--8232814251736334455/Sources/CSQLite/include/sqlite3.h /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CSQLite/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
|
D
|
/**
Integration tests that compile and run the resulting code.
*/
module it.c.run;
public import it;
public import clang: TranslationUnit, Cursor;
|
D
|
/**
$(D std._parallelism) implements high-level primitives for SMP _parallelism.
These include parallel foreach, parallel reduce, parallel eager map, pipelining
and future/promise _parallelism. $(D std._parallelism) is recommended when the
same operation is to be executed in parallel on different data, or when a
function is to be executed in a background thread and its result returned to a
well-defined main thread. For communication between arbitrary threads, see
$(D std.concurrency).
$(D std._parallelism) is based on the concept of a $(D Task). A $(D Task) is an
object that represents the fundamental unit of work in this library and may be
executed in parallel with any other $(D Task). Using $(D Task)
directly allows programming with a future/promise paradigm. All other
supported _parallelism paradigms (parallel foreach, map, reduce, pipelining)
represent an additional level of abstraction over $(D Task). They
automatically create one or more $(D Task) objects, or closely related types
that are conceptually identical but not part of the public API.
After creation, a $(D Task) may be executed in a new thread, or submitted
to a $(D TaskPool) for execution. A $(D TaskPool) encapsulates a task queue
and its worker threads. Its purpose is to efficiently map a large
number of $(D Task)s onto a smaller number of threads. A task queue is a
FIFO queue of $(D Task) objects that have been submitted to the
$(D TaskPool) and are awaiting execution. A worker thread is a thread that
is associated with exactly one task queue. It executes the $(D Task) at the
front of its queue when the queue has work available, or sleeps when
no work is available. Each task queue is associated with zero or
more worker threads. If the result of a $(D Task) is needed before execution
by a worker thread has begun, the $(D Task) can be removed from the task queue
and executed immediately in the thread where the result is needed.
Warning: Unless marked as $(D @trusted) or $(D @safe), artifacts in
this module allow implicit data sharing between threads and cannot
guarantee that client code is free from low level data races.
Source: $(PHOBOSSRC std/_parallelism.d)
Author: David Simcha
Copyright: Copyright (c) 2009-2011, David Simcha.
License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0)
*/
module std.parallelism;
///
unittest
{
import std.algorithm : map;
import std.range : iota;
import std.math : approxEqual;
import std.parallelism : taskPool;
// Parallel reduce can be combined with
// std.algorithm.map to interesting effect.
// The following example (thanks to Russel Winder)
// calculates pi by quadrature using
// std.algorithm.map and TaskPool.reduce.
// getTerm is evaluated in parallel as needed by
// TaskPool.reduce.
//
// Timings on an Intel i5-3450 quad core machine
// for n = 1_000_000_000:
//
// TaskPool.reduce: 1.067 s
// std.algorithm.reduce: 4.011 s
enum n = 1_000_000;
enum delta = 1.0 / n;
alias getTerm = (int i)
{
immutable x = ( i - 0.5 ) * delta;
return delta / ( 1.0 + x * x ) ;
};
immutable pi = 4.0 * taskPool.reduce!"a + b"(n.iota.map!getTerm);
assert(pi.approxEqual(3.1415926));
}
import core.atomic;
import core.exception;
import core.memory;
import core.sync.condition;
import core.thread;
import std.algorithm;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.meta;
import std.range;
import std.traits;
import std.typecons;
version(OSX)
{
version = useSysctlbyname;
}
else version(FreeBSD)
{
version = useSysctlbyname;
}
else version(NetBSD)
{
version = useSysctlbyname;
}
version(Windows)
{
// BUGS: Only works on Windows 2000 and above.
shared static this()
{
import core.sys.windows.windows : SYSTEM_INFO, GetSystemInfo;
SYSTEM_INFO si;
GetSystemInfo(&si);
totalCPUs = max(1, cast(uint) si.dwNumberOfProcessors);
}
}
else version(linux)
{
shared static this()
{
import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf;
totalCPUs = cast(uint) sysconf(_SC_NPROCESSORS_ONLN);
}
}
else version(Solaris)
{
shared static this()
{
import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf;
totalCPUs = cast(uint) sysconf(_SC_NPROCESSORS_ONLN);
}
}
else version(useSysctlbyname)
{
extern(C) int sysctlbyname(
const char *, void *, size_t *, void *, size_t
);
shared static this()
{
version(OSX)
{
auto nameStr = "machdep.cpu.core_count\0".ptr;
}
else version(FreeBSD)
{
auto nameStr = "hw.ncpu\0".ptr;
}
else version(NetBSD)
{
auto nameStr = "hw.ncpu\0".ptr;
}
uint ans;
size_t len = uint.sizeof;
sysctlbyname(nameStr, &ans, &len, null, 0);
totalCPUs = ans;
}
}
else
{
static assert(0, "Don't know how to get N CPUs on this OS.");
}
immutable size_t cacheLineSize;
shared static this()
{
import core.cpuid : datacache;
size_t lineSize = 0;
foreach (cachelevel; datacache)
{
if (cachelevel.lineSize > lineSize && cachelevel.lineSize < uint.max)
{
lineSize = cachelevel.lineSize;
}
}
cacheLineSize = lineSize;
}
/* Atomics code. These forward to core.atomic, but are written like this
for two reasons:
1. They used to actually contain ASM code and I don' want to have to change
to directly calling core.atomic in a zillion different places.
2. core.atomic has some misc. issues that make my use cases difficult
without wrapping it. If I didn't wrap it, casts would be required
basically everywhere.
*/
private void atomicSetUbyte(T)(ref T stuff, T newVal)
if (__traits(isIntegral, T) && is(T : ubyte))
{
//core.atomic.cas(cast(shared) &stuff, stuff, newVal);
atomicStore(*(cast(shared) &stuff), newVal);
}
private ubyte atomicReadUbyte(T)(ref T val)
if (__traits(isIntegral, T) && is(T : ubyte))
{
return atomicLoad(*(cast(shared) &val));
}
// This gets rid of the need for a lot of annoying casts in other parts of the
// code, when enums are involved.
private bool atomicCasUbyte(T)(ref T stuff, T testVal, T newVal)
if (__traits(isIntegral, T) && is(T : ubyte))
{
return core.atomic.cas(cast(shared) &stuff, testVal, newVal);
}
/*--------------------- Generic helper functions, etc.------------------------*/
private template MapType(R, functions...)
{
static assert(functions.length);
ElementType!R e = void;
alias MapType =
typeof(adjoin!(staticMap!(unaryFun, functions))(e));
}
private template ReduceType(alias fun, R, E)
{
alias ReduceType = typeof(binaryFun!fun(E.init, ElementType!R.init));
}
private template noUnsharedAliasing(T)
{
enum bool noUnsharedAliasing = !hasUnsharedAliasing!T;
}
// This template tests whether a function may be executed in parallel from
// @safe code via Task.executeInNewThread(). There is an additional
// requirement for executing it via a TaskPool. (See isSafeReturn).
private template isSafeTask(F)
{
enum bool isSafeTask =
(functionAttributes!F & (FunctionAttribute.safe | FunctionAttribute.trusted)) != 0 &&
(functionAttributes!F & FunctionAttribute.ref_) == 0 &&
(isFunctionPointer!F || !hasUnsharedAliasing!F) &&
allSatisfy!(noUnsharedAliasing, Parameters!F);
}
unittest
{
alias F1 = void function() @safe;
alias F2 = void function();
alias F3 = void function(uint, string) @trusted;
alias F4 = void function(uint, char[]);
static assert( isSafeTask!F1);
static assert(!isSafeTask!F2);
static assert( isSafeTask!F3);
static assert(!isSafeTask!F4);
alias F5 = uint[] function(uint, string) pure @trusted;
static assert( isSafeTask!F5);
}
// This function decides whether Tasks that meet all of the other requirements
// for being executed from @safe code can be executed on a TaskPool.
// When executing via TaskPool, it's theoretically possible
// to return a value that is also pointed to by a worker thread's thread local
// storage. When executing from executeInNewThread(), the thread that executed
// the Task is terminated by the time the return value is visible in the calling
// thread, so this is a non-issue. It's also a non-issue for pure functions
// since they can't read global state.
private template isSafeReturn(T)
{
static if (!hasUnsharedAliasing!(T.ReturnType))
{
enum isSafeReturn = true;
}
else static if (T.isPure)
{
enum isSafeReturn = true;
}
else
{
enum isSafeReturn = false;
}
}
private template randAssignable(R)
{
enum randAssignable = isRandomAccessRange!R && hasAssignableElements!R;
}
private enum TaskStatus : ubyte
{
notStarted,
inProgress,
done
}
private template AliasReturn(alias fun, T...)
{
alias AliasReturn = typeof({ T args; return fun(args); });
}
// Should be private, but std.algorithm.reduce is used in the zero-thread case
// and won't work w/ private.
template reduceAdjoin(functions...)
{
static if (functions.length == 1)
{
alias reduceAdjoin = binaryFun!(functions[0]);
}
else
{
T reduceAdjoin(T, U)(T lhs, U rhs)
{
alias funs = staticMap!(binaryFun, functions);
foreach (i, Unused; typeof(lhs.expand))
{
lhs.expand[i] = funs[i](lhs.expand[i], rhs);
}
return lhs;
}
}
}
private template reduceFinish(functions...)
{
static if (functions.length == 1)
{
alias reduceFinish = binaryFun!(functions[0]);
}
else
{
T reduceFinish(T)(T lhs, T rhs)
{
alias funs = staticMap!(binaryFun, functions);
foreach (i, Unused; typeof(lhs.expand))
{
lhs.expand[i] = funs[i](lhs.expand[i], rhs.expand[i]);
}
return lhs;
}
}
}
private template isRoundRobin(R : RoundRobinBuffer!(C1, C2), C1, C2)
{
enum isRoundRobin = true;
}
private template isRoundRobin(T)
{
enum isRoundRobin = false;
}
unittest
{
static assert( isRoundRobin!(RoundRobinBuffer!(void delegate(char[]), bool delegate())));
static assert(!isRoundRobin!(uint));
}
// This is the base "class" for all of the other tasks. Using C-style
// polymorphism to allow more direct control over memory allocation, etc.
private struct AbstractTask
{
AbstractTask* prev;
AbstractTask* next;
// Pointer to a function that executes this task.
void function(void*) runTask;
Throwable exception;
ubyte taskStatus = TaskStatus.notStarted;
bool done() @property
{
if (atomicReadUbyte(taskStatus) == TaskStatus.done)
{
if (exception)
{
throw exception;
}
return true;
}
return false;
}
void job()
{
runTask(&this);
}
}
/**
$(D Task) represents the fundamental unit of work. A $(D Task) may be
executed in parallel with any other $(D Task). Using this struct directly
allows future/promise _parallelism. In this paradigm, a function (or delegate
or other callable) is executed in a thread other than the one it was called
from. The calling thread does not block while the function is being executed.
A call to $(D workForce), $(D yieldForce), or $(D spinForce) is used to
ensure that the $(D Task) has finished executing and to obtain the return
value, if any. These functions and $(D done) also act as full memory barriers,
meaning that any memory writes made in the thread that executed the $(D Task)
are guaranteed to be visible in the calling thread after one of these functions
returns.
The $(REF task, std,parallelism) and $(REF scopedTask, std,parallelism) functions can
be used to create an instance of this struct. See $(D task) for usage examples.
Function results are returned from $(D yieldForce), $(D spinForce) and
$(D workForce) by ref. If $(D fun) returns by ref, the reference will point
to the returned reference of $(D fun). Otherwise it will point to a
field in this struct.
Copying of this struct is disabled, since it would provide no useful semantics.
If you want to pass this struct around, you should do so by reference or
pointer.
Bugs: Changes to $(D ref) and $(D out) arguments are not propagated to the
call site, only to $(D args) in this struct.
*/
struct Task(alias fun, Args...)
{
AbstractTask base = {runTask : &impl};
alias base this;
private @property AbstractTask* basePtr()
{
return &base;
}
private static void impl(void* myTask)
{
import std.algorithm.internal : addressOf;
Task* myCastedTask = cast(typeof(this)*) myTask;
static if (is(ReturnType == void))
{
fun(myCastedTask._args);
}
else static if (is(typeof(addressOf(fun(myCastedTask._args)))))
{
myCastedTask.returnVal = addressOf(fun(myCastedTask._args));
}
else
{
myCastedTask.returnVal = fun(myCastedTask._args);
}
}
private TaskPool pool;
private bool isScoped; // True if created with scopedTask.
Args _args;
/**
The arguments the function was called with. Changes to $(D out) and
$(D ref) arguments will be visible here.
*/
static if (__traits(isSame, fun, run))
{
alias args = _args[1..$];
}
else
{
alias args = _args;
}
// The purpose of this code is to decide whether functions whose
// return values have unshared aliasing can be executed via
// TaskPool from @safe code. See isSafeReturn.
static if (__traits(isSame, fun, run))
{
static if (isFunctionPointer!(_args[0]))
{
private enum bool isPure =
functionAttributes!(Args[0]) & FunctionAttribute.pure_;
}
else
{
// BUG: Should check this for delegates too, but std.traits
// apparently doesn't allow this. isPure is irrelevant
// for delegates, at least for now since shared delegates
// don't work.
private enum bool isPure = false;
}
}
else
{
// We already know that we can't execute aliases in @safe code, so
// just put a dummy value here.
private enum bool isPure = false;
}
/**
The return type of the function called by this $(D Task). This can be
$(D void).
*/
alias ReturnType = typeof(fun(_args));
static if (!is(ReturnType == void))
{
static if (is(typeof(&fun(_args))))
{
// Ref return.
ReturnType* returnVal;
ref ReturnType fixRef(ReturnType* val)
{
return *val;
}
}
else
{
ReturnType returnVal;
ref ReturnType fixRef(ref ReturnType val)
{
return val;
}
}
}
private void enforcePool()
{
enforce(this.pool !is null, "Job not submitted yet.");
}
static if (Args.length > 0)
{
private this(Args args)
{
_args = args;
}
}
// Work around DMD bug 6588, allow immutable elements.
static if (allSatisfy!(isAssignable, Args))
{
typeof(this) opAssign(typeof(this) rhs)
{
foreach (i, Type; typeof(this.tupleof))
{
this.tupleof[i] = rhs.tupleof[i];
}
return this;
}
}
else
{
@disable typeof(this) opAssign(typeof(this) rhs)
{
assert(0);
}
}
/**
If the $(D Task) isn't started yet, execute it in the current thread.
If it's done, return its return value, if any. If it's in progress,
busy spin until it's done, then return the return value. If it threw
an exception, rethrow that exception.
This function should be used when you expect the result of the
$(D Task) to be available on a timescale shorter than that of an OS
context switch.
*/
@property ref ReturnType spinForce() @trusted
{
enforcePool();
this.pool.tryDeleteExecute(basePtr);
while (atomicReadUbyte(this.taskStatus) != TaskStatus.done) {}
if (exception)
{
throw exception;
}
static if (!is(ReturnType == void))
{
return fixRef(this.returnVal);
}
}
/**
If the $(D Task) isn't started yet, execute it in the current thread.
If it's done, return its return value, if any. If it's in progress,
wait on a condition variable. If it threw an exception, rethrow that
exception.
This function should be used for expensive functions, as waiting on a
condition variable introduces latency, but avoids wasted CPU cycles.
*/
@property ref ReturnType yieldForce() @trusted
{
enforcePool();
this.pool.tryDeleteExecute(basePtr);
if (done)
{
static if (is(ReturnType == void))
{
return;
}
else
{
return fixRef(this.returnVal);
}
}
pool.waiterLock();
scope(exit) pool.waiterUnlock();
while (atomicReadUbyte(this.taskStatus) != TaskStatus.done)
{
pool.waitUntilCompletion();
}
if (exception)
{
throw exception;
}
static if (!is(ReturnType == void))
{
return fixRef(this.returnVal);
}
}
/**
If this $(D Task) was not started yet, execute it in the current
thread. If it is finished, return its result. If it is in progress,
execute any other $(D Task) from the $(D TaskPool) instance that
this $(D Task) was submitted to until this one
is finished. If it threw an exception, rethrow that exception.
If no other tasks are available or this $(D Task) was executed using
$(D executeInNewThread), wait on a condition variable.
*/
@property ref ReturnType workForce() @trusted
{
enforcePool();
this.pool.tryDeleteExecute(basePtr);
while (true)
{
if (done) // done() implicitly checks for exceptions.
{
static if (is(ReturnType == void))
{
return;
}
else
{
return fixRef(this.returnVal);
}
}
AbstractTask* job;
{
// Locking explicitly and calling popNoSync() because
// pop() waits on a condition variable if there are no Tasks
// in the queue.
pool.queueLock();
scope(exit) pool.queueUnlock();
job = pool.popNoSync();
}
if (job !is null)
{
version(verboseUnittest)
{
stderr.writeln("Doing workForce work.");
}
pool.doJob(job);
if (done)
{
static if (is(ReturnType == void))
{
return;
}
else
{
return fixRef(this.returnVal);
}
}
}
else
{
version(verboseUnittest)
{
stderr.writeln("Yield from workForce.");
}
return yieldForce;
}
}
}
/**
Returns $(D true) if the $(D Task) is finished executing.
Throws: Rethrows any exception thrown during the execution of the
$(D Task).
*/
@property bool done() @trusted
{
// Explicitly forwarded for documentation purposes.
return base.done;
}
/**
Create a new thread for executing this $(D Task), execute it in the
newly created thread, then terminate the thread. This can be used for
future/promise parallelism. An explicit priority may be given
to the $(D Task). If one is provided, its value is forwarded to
$(D core.thread.Thread.priority). See $(REF task, std,parallelism) for
usage example.
*/
void executeInNewThread() @trusted
{
pool = new TaskPool(basePtr);
}
/// Ditto
void executeInNewThread(int priority) @trusted
{
pool = new TaskPool(basePtr, priority);
}
@safe ~this()
{
if (isScoped && pool !is null && taskStatus != TaskStatus.done)
{
yieldForce;
}
}
// When this is uncommented, it somehow gets called on returning from
// scopedTask even though the struct shouldn't be getting copied.
//@disable this(this) {}
}
// Calls $(D fpOrDelegate) with $(D args). This is an
// adapter that makes $(D Task) work with delegates, function pointers and
// functors instead of just aliases.
ReturnType!F run(F, Args...)(F fpOrDelegate, ref Args args)
{
return fpOrDelegate(args);
}
/**
Creates a $(D Task) on the GC heap that calls an alias. This may be executed
via $(D Task.executeInNewThread) or by submitting to a
$(REF TaskPool, std,parallelism). A globally accessible instance of
$(D TaskPool) is provided by $(REF taskPool, std,parallelism).
Returns: A pointer to the $(D Task).
Example:
---
// Read two files into memory at the same time.
import std.file;
void main()
{
// Create and execute a Task for reading
// foo.txt.
auto file1Task = task!read("foo.txt");
file1Task.executeInNewThread();
// Read bar.txt in parallel.
auto file2Data = read("bar.txt");
// Get the results of reading foo.txt.
auto file1Data = file1Task.yieldForce;
}
---
---
// Sorts an array using a parallel quick sort algorithm.
// The first partition is done serially. Both recursion
// branches are then executed in parallel.
//
// Timings for sorting an array of 1,000,000 doubles on
// an Athlon 64 X2 dual core machine:
//
// This implementation: 176 milliseconds.
// Equivalent serial implementation: 280 milliseconds
void parallelSort(T)(T[] data)
{
// Sort small subarrays serially.
if (data.length < 100)
{
std.algorithm.sort(data);
return;
}
// Partition the array.
swap(data[$ / 2], data[$ - 1]);
auto pivot = data[$ - 1];
bool lessThanPivot(T elem) { return elem < pivot; }
auto greaterEqual = partition!lessThanPivot(data[0..$ - 1]);
swap(data[$ - greaterEqual.length - 1], data[$ - 1]);
auto less = data[0..$ - greaterEqual.length - 1];
greaterEqual = data[$ - greaterEqual.length..$];
// Execute both recursion branches in parallel.
auto recurseTask = task!parallelSort(greaterEqual);
taskPool.put(recurseTask);
parallelSort(less);
recurseTask.yieldForce;
}
---
*/
auto task(alias fun, Args...)(Args args)
{
return new Task!(fun, Args)(args);
}
/**
Creates a $(D Task) on the GC heap that calls a function pointer, delegate, or
class/struct with overloaded opCall.
Example:
---
// Read two files in at the same time again,
// but this time use a function pointer instead
// of an alias to represent std.file.read.
import std.file;
void main()
{
// Create and execute a Task for reading
// foo.txt.
auto file1Task = task(&read, "foo.txt");
file1Task.executeInNewThread();
// Read bar.txt in parallel.
auto file2Data = read("bar.txt");
// Get the results of reading foo.txt.
auto file1Data = file1Task.yieldForce;
}
---
Notes: This function takes a non-scope delegate, meaning it can be
used with closures. If you can't allocate a closure due to objects
on the stack that have scoped destruction, see $(D scopedTask), which
takes a scope delegate.
*/
auto task(F, Args...)(F delegateOrFp, Args args)
if (is(typeof(delegateOrFp(args))) && !isSafeTask!F)
{
return new Task!(run, F, Args)(delegateOrFp, args);
}
/**
Version of $(D task) usable from $(D @safe) code. Usage mechanics are
identical to the non-@safe case, but safety introduces some restrictions:
1. $(D fun) must be @safe or @trusted.
2. $(D F) must not have any unshared aliasing as defined by
$(REF hasUnsharedAliasing, std,traits). This means it
may not be an unshared delegate or a non-shared class or struct
with overloaded $(D opCall). This also precludes accepting template
alias parameters.
3. $(D Args) must not have unshared aliasing.
4. $(D fun) must not return by reference.
5. The return type must not have unshared aliasing unless $(D fun) is
$(D pure) or the $(D Task) is executed via $(D executeInNewThread) instead
of using a $(D TaskPool).
*/
@trusted auto task(F, Args...)(F fun, Args args)
if (is(typeof(fun(args))) && isSafeTask!F)
{
return new Task!(run, F, Args)(fun, args);
}
/**
These functions allow the creation of $(D Task) objects on the stack rather
than the GC heap. The lifetime of a $(D Task) created by $(D scopedTask)
cannot exceed the lifetime of the scope it was created in.
$(D scopedTask) might be preferred over $(D task):
1. When a $(D Task) that calls a delegate is being created and a closure
cannot be allocated due to objects on the stack that have scoped
destruction. The delegate overload of $(D scopedTask) takes a $(D scope)
delegate.
2. As a micro-optimization, to avoid the heap allocation associated with
$(D task) or with the creation of a closure.
Usage is otherwise identical to $(D task).
Notes: $(D Task) objects created using $(D scopedTask) will automatically
call $(D Task.yieldForce) in their destructor if necessary to ensure
the $(D Task) is complete before the stack frame they reside on is destroyed.
*/
auto scopedTask(alias fun, Args...)(Args args)
{
auto ret = Task!(fun, Args)(args);
ret.isScoped = true;
return ret;
}
/// Ditto
auto scopedTask(F, Args...)(scope F delegateOrFp, Args args)
if (is(typeof(delegateOrFp(args))) && !isSafeTask!F)
{
auto ret = Task!(run, F, Args)(delegateOrFp, args);
ret.isScoped = true;
return ret;
}
/// Ditto
@trusted auto scopedTask(F, Args...)(F fun, Args args)
if (is(typeof(fun(args))) && isSafeTask!F)
{
auto ret = Task!(run, F, Args)(fun, args);
ret.isScoped = true;
return ret;
}
/**
The total number of CPU cores available on the current machine, as reported by
the operating system.
*/
immutable uint totalCPUs;
/*
This class serves two purposes:
1. It distinguishes std.parallelism threads from other threads so that
the std.parallelism daemon threads can be terminated.
2. It adds a reference to the pool that the thread is a member of,
which is also necessary to allow the daemon threads to be properly
terminated.
*/
private final class ParallelismThread : Thread
{
this(void delegate() dg)
{
super(dg);
}
TaskPool pool;
}
// Kill daemon threads.
shared static ~this()
{
foreach (ref thread; Thread)
{
auto pthread = cast(ParallelismThread) thread;
if (pthread is null) continue;
auto pool = pthread.pool;
if (!pool.isDaemon) continue;
pool.stop();
pthread.join();
}
}
/**
This class encapsulates a task queue and a set of worker threads. Its purpose
is to efficiently map a large number of $(D Task)s onto a smaller number of
threads. A task queue is a FIFO queue of $(D Task) objects that have been
submitted to the $(D TaskPool) and are awaiting execution. A worker thread is a
thread that executes the $(D Task) at the front of the queue when one is
available and sleeps when the queue is empty.
This class should usually be used via the global instantiation
available via the $(REF taskPool, std,parallelism) property.
Occasionally it is useful to explicitly instantiate a $(D TaskPool):
1. When you want $(D TaskPool) instances with multiple priorities, for example
a low priority pool and a high priority pool.
2. When the threads in the global task pool are waiting on a synchronization
primitive (for example a mutex), and you want to parallelize the code that
needs to run before these threads can be resumed.
*/
final class TaskPool
{
private:
// A pool can either be a regular pool or a single-task pool. A
// single-task pool is a dummy pool that's fired up for
// Task.executeInNewThread().
bool isSingleTask;
ParallelismThread[] pool;
Thread singleTaskThread;
AbstractTask* head;
AbstractTask* tail;
PoolState status = PoolState.running;
Condition workerCondition;
Condition waiterCondition;
Mutex queueMutex;
Mutex waiterMutex; // For waiterCondition
// The instanceStartIndex of the next instance that will be created.
__gshared static size_t nextInstanceIndex = 1;
// The index of the current thread.
static size_t threadIndex;
// The index of the first thread in this instance.
immutable size_t instanceStartIndex;
// The index that the next thread to be initialized in this pool will have.
size_t nextThreadIndex;
enum PoolState : ubyte
{
running,
finishing,
stopNow
}
void doJob(AbstractTask* job)
{
assert(job.taskStatus == TaskStatus.inProgress);
assert(job.next is null);
assert(job.prev is null);
scope(exit)
{
if (!isSingleTask)
{
waiterLock();
scope(exit) waiterUnlock();
notifyWaiters();
}
}
try
{
job.job();
}
catch (Throwable e)
{
job.exception = e;
}
atomicSetUbyte(job.taskStatus, TaskStatus.done);
}
// This function is used for dummy pools created by Task.executeInNewThread().
void doSingleTask()
{
// No synchronization. Pool is guaranteed to only have one thread,
// and the queue is submitted to before this thread is created.
assert(head);
auto t = head;
t.next = t.prev = head = null;
doJob(t);
}
// This function performs initialization for each thread that affects
// thread local storage and therefore must be done from within the
// worker thread. It then calls executeWorkLoop().
void startWorkLoop()
{
// Initialize thread index.
{
queueLock();
scope(exit) queueUnlock();
threadIndex = nextThreadIndex;
nextThreadIndex++;
}
executeWorkLoop();
}
// This is the main work loop that worker threads spend their time in
// until they terminate. It's also entered by non-worker threads when
// finish() is called with the blocking variable set to true.
void executeWorkLoop()
{
while (atomicReadUbyte(status) != PoolState.stopNow)
{
AbstractTask* task = pop();
if (task is null)
{
if (atomicReadUbyte(status) == PoolState.finishing)
{
atomicSetUbyte(status, PoolState.stopNow);
return;
}
}
else
{
doJob(task);
}
}
}
// Pop a task off the queue.
AbstractTask* pop()
{
queueLock();
scope(exit) queueUnlock();
auto ret = popNoSync();
while (ret is null && status == PoolState.running)
{
wait();
ret = popNoSync();
}
return ret;
}
AbstractTask* popNoSync()
out(returned)
{
/* If task.prev and task.next aren't null, then another thread
* can try to delete this task from the pool after it's
* alreadly been deleted/popped.
*/
if (returned !is null)
{
assert(returned.next is null);
assert(returned.prev is null);
}
}
do
{
if (isSingleTask) return null;
AbstractTask* returned = head;
if (head !is null)
{
head = head.next;
returned.prev = null;
returned.next = null;
returned.taskStatus = TaskStatus.inProgress;
}
if (head !is null)
{
head.prev = null;
}
return returned;
}
// Push a task onto the queue.
void abstractPut(AbstractTask* task)
{
queueLock();
scope(exit) queueUnlock();
abstractPutNoSync(task);
}
void abstractPutNoSync(AbstractTask* task)
in
{
assert(task);
}
out
{
assert(tail.prev !is tail);
assert(tail.next is null, text(tail.prev, '\t', tail.next));
if (tail.prev !is null)
{
assert(tail.prev.next is tail, text(tail.prev, '\t', tail.next));
}
}
do
{
// Not using enforce() to save on function call overhead since this
// is a performance critical function.
if (status != PoolState.running)
{
throw new Error(
"Cannot submit a new task to a pool after calling " ~
"finish() or stop()."
);
}
task.next = null;
if (head is null) //Queue is empty.
{
head = task;
tail = task;
tail.prev = null;
}
else
{
assert(tail);
task.prev = tail;
tail.next = task;
tail = task;
}
notify();
}
void abstractPutGroupNoSync(AbstractTask* h, AbstractTask* t)
{
if (status != PoolState.running)
{
throw new Error(
"Cannot submit a new task to a pool after calling " ~
"finish() or stop()."
);
}
if (head is null)
{
head = h;
tail = t;
}
else
{
h.prev = tail;
tail.next = h;
tail = t;
}
notifyAll();
}
void tryDeleteExecute(AbstractTask* toExecute)
{
if (isSingleTask) return;
if ( !deleteItem(toExecute) )
{
return;
}
try
{
toExecute.job();
}
catch (Exception e)
{
toExecute.exception = e;
}
atomicSetUbyte(toExecute.taskStatus, TaskStatus.done);
}
bool deleteItem(AbstractTask* item)
{
queueLock();
scope(exit) queueUnlock();
return deleteItemNoSync(item);
}
bool deleteItemNoSync(AbstractTask* item)
{
if (item.taskStatus != TaskStatus.notStarted)
{
return false;
}
item.taskStatus = TaskStatus.inProgress;
if (item is head)
{
// Make sure head gets set properly.
popNoSync();
return true;
}
if (item is tail)
{
tail = tail.prev;
if (tail !is null)
{
tail.next = null;
}
item.next = null;
item.prev = null;
return true;
}
if (item.next !is null)
{
assert(item.next.prev is item); // Check queue consistency.
item.next.prev = item.prev;
}
if (item.prev !is null)
{
assert(item.prev.next is item); // Check queue consistency.
item.prev.next = item.next;
}
item.next = null;
item.prev = null;
return true;
}
void queueLock()
{
assert(queueMutex);
if (!isSingleTask) queueMutex.lock();
}
void queueUnlock()
{
assert(queueMutex);
if (!isSingleTask) queueMutex.unlock();
}
void waiterLock()
{
if (!isSingleTask) waiterMutex.lock();
}
void waiterUnlock()
{
if (!isSingleTask) waiterMutex.unlock();
}
void wait()
{
if (!isSingleTask) workerCondition.wait();
}
void notify()
{
if (!isSingleTask) workerCondition.notify();
}
void notifyAll()
{
if (!isSingleTask) workerCondition.notifyAll();
}
void waitUntilCompletion()
{
if (isSingleTask)
{
singleTaskThread.join();
}
else
{
waiterCondition.wait();
}
}
void notifyWaiters()
{
if (!isSingleTask) waiterCondition.notifyAll();
}
// Private constructor for creating dummy pools that only have one thread,
// only execute one Task, and then terminate. This is used for
// Task.executeInNewThread().
this(AbstractTask* task, int priority = int.max)
{
assert(task);
// Dummy value, not used.
instanceStartIndex = 0;
this.isSingleTask = true;
task.taskStatus = TaskStatus.inProgress;
this.head = task;
singleTaskThread = new Thread(&doSingleTask);
singleTaskThread.start();
// Disabled until writing code to support
// running thread with specified priority
// See https://d.puremagic.com/issues/show_bug.cgi?id=8960
/*if (priority != int.max)
{
singleTaskThread.priority = priority;
}*/
}
public:
// This is used in parallel_algorithm but is too unstable to document
// as public API.
size_t defaultWorkUnitSize(size_t rangeLen) const @safe pure nothrow
{
if (this.size == 0)
{
return rangeLen;
}
immutable size_t eightSize = 4 * (this.size + 1);
auto ret = (rangeLen / eightSize) + ((rangeLen % eightSize == 0) ? 0 : 1);
return max(ret, 1);
}
/**
Default constructor that initializes a $(D TaskPool) with
$(D totalCPUs) - 1 worker threads. The minus 1 is included because the
main thread will also be available to do work.
Note: On single-core machines, the primitives provided by $(D TaskPool)
operate transparently in single-threaded mode.
*/
this() @trusted
{
this(totalCPUs - 1);
}
/**
Allows for custom number of worker threads.
*/
this(size_t nWorkers) @trusted
{
synchronized(typeid(TaskPool))
{
instanceStartIndex = nextInstanceIndex;
// The first worker thread to be initialized will have this index,
// and will increment it. The second worker to be initialized will
// have this index plus 1.
nextThreadIndex = instanceStartIndex;
nextInstanceIndex += nWorkers;
}
queueMutex = new Mutex(this);
waiterMutex = new Mutex();
workerCondition = new Condition(queueMutex);
waiterCondition = new Condition(waiterMutex);
pool = new ParallelismThread[nWorkers];
foreach (ref poolThread; pool)
{
poolThread = new ParallelismThread(&startWorkLoop);
poolThread.pool = this;
poolThread.start();
}
}
/**
Implements a parallel foreach loop over a range. This works by implicitly
creating and submitting one $(D Task) to the $(D TaskPool) for each worker
thread. A work unit is a set of consecutive elements of $(D range) to
be processed by a worker thread between communication with any other
thread. The number of elements processed per work unit is controlled by the
$(D workUnitSize) parameter. Smaller work units provide better load
balancing, but larger work units avoid the overhead of communicating
with other threads frequently to fetch the next work unit. Large work
units also avoid false sharing in cases where the range is being modified.
The less time a single iteration of the loop takes, the larger
$(D workUnitSize) should be. For very expensive loop bodies,
$(D workUnitSize) should be 1. An overload that chooses a default work
unit size is also available.
Example:
---
// Find the logarithm of every number from 1 to
// 10_000_000 in parallel.
auto logs = new double[10_000_000];
// Parallel foreach works with or without an index
// variable. It can be iterate by ref if range.front
// returns by ref.
// Iterate over logs using work units of size 100.
foreach (i, ref elem; taskPool.parallel(logs, 100))
{
elem = log(i + 1.0);
}
// Same thing, but use the default work unit size.
//
// Timings on an Athlon 64 X2 dual core machine:
//
// Parallel foreach: 388 milliseconds
// Regular foreach: 619 milliseconds
foreach (i, ref elem; taskPool.parallel(logs))
{
elem = log(i + 1.0);
}
---
Notes:
The memory usage of this implementation is guaranteed to be constant
in $(D range.length).
Breaking from a parallel foreach loop via a break, labeled break,
labeled continue, return or goto statement throws a
$(D ParallelForeachError).
In the case of non-random access ranges, parallel foreach buffers lazily
to an array of size $(D workUnitSize) before executing the parallel portion
of the loop. The exception is that, if a parallel foreach is executed
over a range returned by $(D asyncBuf) or $(D map), the copying is elided
and the buffers are simply swapped. In this case $(D workUnitSize) is
ignored and the work unit size is set to the buffer size of $(D range).
A memory barrier is guaranteed to be executed on exit from the loop,
so that results produced by all threads are visible in the calling thread.
$(B Exception Handling):
When at least one exception is thrown from inside a parallel foreach loop,
the submission of additional $(D Task) objects is terminated as soon as
possible, in a non-deterministic manner. All executing or
enqueued work units are allowed to complete. Then, all exceptions that
were thrown by any work unit are chained using $(D Throwable.next) and
rethrown. The order of the exception chaining is non-deterministic.
*/
ParallelForeach!R parallel(R)(R range, size_t workUnitSize)
{
enforce(workUnitSize > 0, "workUnitSize must be > 0.");
alias RetType = ParallelForeach!R;
return RetType(this, range, workUnitSize);
}
/// Ditto
ParallelForeach!R parallel(R)(R range)
{
static if (hasLength!R)
{
// Default work unit size is such that we would use 4x as many
// slots as are in this thread pool.
size_t workUnitSize = defaultWorkUnitSize(range.length);
return parallel(range, workUnitSize);
}
else
{
// Just use a really, really dumb guess if the user is too lazy to
// specify.
return parallel(range, 512);
}
}
///
template amap(functions...)
{
/**
Eager parallel map. The eagerness of this function means it has less
overhead than the lazily evaluated $(D TaskPool.map) and should be
preferred where the memory requirements of eagerness are acceptable.
$(D functions) are the functions to be evaluated, passed as template
alias parameters in a style similar to
$(REF map, std,algorithm,iteration).
The first argument must be a random access range. For performance
reasons, amap will assume the range elements have not yet been
initialized. Elements will be overwritten without calling a destructor
nor doing an assignment. As such, the range must not contain meaningful
data: either un-initialized objects, or objects in their $(D .init)
state.
---
auto numbers = iota(100_000_000.0);
// Find the square roots of numbers.
//
// Timings on an Athlon 64 X2 dual core machine:
//
// Parallel eager map: 0.802 s
// Equivalent serial implementation: 1.768 s
auto squareRoots = taskPool.amap!sqrt(numbers);
---
Immediately after the range argument, an optional work unit size argument
may be provided. Work units as used by $(D amap) are identical to those
defined for parallel foreach. If no work unit size is provided, the
default work unit size is used.
---
// Same thing, but make work unit size 100.
auto squareRoots = taskPool.amap!sqrt(numbers, 100);
---
An output range for returning the results may be provided as the last
argument. If one is not provided, an array of the proper type will be
allocated on the garbage collected heap. If one is provided, it must be a
random access range with assignable elements, must have reference
semantics with respect to assignment to its elements, and must have the
same length as the input range. Writing to adjacent elements from
different threads must be safe.
---
// Same thing, but explicitly allocate an array
// to return the results in. The element type
// of the array may be either the exact type
// returned by functions or an implicit conversion
// target.
auto squareRoots = new float[numbers.length];
taskPool.amap!sqrt(numbers, squareRoots);
// Multiple functions, explicit output range, and
// explicit work unit size.
auto results = new Tuple!(float, real)[numbers.length];
taskPool.amap!(sqrt, log)(numbers, 100, results);
---
Note:
A memory barrier is guaranteed to be executed after all results are written
but before returning so that results produced by all threads are visible
in the calling thread.
Tips:
To perform the mapping operation in place, provide the same range for the
input and output range.
To parallelize the copying of a range with expensive to evaluate elements
to an array, pass an identity function (a function that just returns
whatever argument is provided to it) to $(D amap).
$(B Exception Handling):
When at least one exception is thrown from inside the map functions,
the submission of additional $(D Task) objects is terminated as soon as
possible, in a non-deterministic manner. All currently executing or
enqueued work units are allowed to complete. Then, all exceptions that
were thrown from any work unit are chained using $(D Throwable.next) and
rethrown. The order of the exception chaining is non-deterministic.
*/
auto amap(Args...)(Args args)
if (isRandomAccessRange!(Args[0]))
{
alias fun = adjoin!(staticMap!(unaryFun, functions));
alias range = args[0];
immutable len = range.length;
static if (
Args.length > 1 &&
randAssignable!(Args[$ - 1]) &&
is(MapType!(Args[0], functions) : ElementType!(Args[$ - 1]))
)
{
alias buf = args[$ - 1];
alias args2 = args[0..$ - 1];
alias Args2 = Args[0..$ - 1];
enforce(buf.length == len,
text("Can't use a user supplied buffer that's the wrong ",
"size. (Expected :", len, " Got: ", buf.length));
}
else static if (randAssignable!(Args[$ - 1]) && Args.length > 1)
{
static assert(0, "Wrong buffer type.");
}
else
{
auto buf = uninitializedArray!(MapType!(Args[0], functions)[])(len);
alias args2 = args;
alias Args2 = Args;
}
if (!len) return buf;
static if (isIntegral!(Args2[$ - 1]))
{
static assert(args2.length == 2);
auto workUnitSize = cast(size_t) args2[1];
}
else
{
static assert(args2.length == 1, Args);
auto workUnitSize = defaultWorkUnitSize(range.length);
}
alias R = typeof(range);
if (workUnitSize > len)
{
workUnitSize = len;
}
// Handle as a special case:
if (size == 0)
{
size_t index = 0;
foreach (elem; range)
{
emplaceRef(buf[index++], fun(elem));
}
return buf;
}
// Effectively -1: chunkIndex + 1 == 0:
shared size_t workUnitIndex = size_t.max;
shared bool shouldContinue = true;
void doIt()
{
scope(failure)
{
// If an exception is thrown, all threads should bail.
atomicStore(shouldContinue, false);
}
while (atomicLoad(shouldContinue))
{
immutable myUnitIndex = atomicOp!"+="(workUnitIndex, 1);
immutable start = workUnitSize * myUnitIndex;
if (start >= len)
{
atomicStore(shouldContinue, false);
break;
}
immutable end = min(len, start + workUnitSize);
static if (hasSlicing!R)
{
auto subrange = range[start..end];
foreach (i; start..end)
{
emplaceRef(buf[i], fun(subrange.front));
subrange.popFront();
}
}
else
{
foreach (i; start..end)
{
emplaceRef(buf[i], fun(range[i]));
}
}
}
}
submitAndExecute(this, &doIt);
return buf;
}
}
///
template map(functions...)
{
/**
A semi-lazy parallel map that can be used for pipelining. The map
functions are evaluated for the first $(D bufSize) elements and stored in a
buffer and made available to $(D popFront). Meanwhile, in the
background a second buffer of the same size is filled. When the first
buffer is exhausted, it is swapped with the second buffer and filled while
the values from what was originally the second buffer are read. This
implementation allows for elements to be written to the buffer without
the need for atomic operations or synchronization for each write, and
enables the mapping function to be evaluated efficiently in parallel.
$(D map) has more overhead than the simpler procedure used by $(D amap)
but avoids the need to keep all results in memory simultaneously and works
with non-random access ranges.
Params:
source = The input range to be mapped. If $(D source) is not random
access it will be lazily buffered to an array of size $(D bufSize) before
the map function is evaluated. (For an exception to this rule, see Notes.)
bufSize = The size of the buffer to store the evaluated elements.
workUnitSize = The number of elements to evaluate in a single
$(D Task). Must be less than or equal to $(D bufSize), and
should be a fraction of $(D bufSize) such that all worker threads can be
used. If the default of size_t.max is used, workUnitSize will be set to
the pool-wide default.
Returns: An input range representing the results of the map. This range
has a length iff $(D source) has a length.
Notes:
If a range returned by $(D map) or $(D asyncBuf) is used as an input to
$(D map), then as an optimization the copying from the output buffer
of the first range to the input buffer of the second range is elided, even
though the ranges returned by $(D map) and $(D asyncBuf) are non-random
access ranges. This means that the $(D bufSize) parameter passed to the
current call to $(D map) will be ignored and the size of the buffer
will be the buffer size of $(D source).
Example:
---
// Pipeline reading a file, converting each line
// to a number, taking the logarithms of the numbers,
// and performing the additions necessary to find
// the sum of the logarithms.
auto lineRange = File("numberList.txt").byLine();
auto dupedLines = std.algorithm.map!"a.idup"(lineRange);
auto nums = taskPool.map!(to!double)(dupedLines);
auto logs = taskPool.map!log10(nums);
double sum = 0;
foreach (elem; logs)
{
sum += elem;
}
---
$(B Exception Handling):
Any exceptions thrown while iterating over $(D source)
or computing the map function are re-thrown on a call to $(D popFront) or,
if thrown during construction, are simply allowed to propagate to the
caller. In the case of exceptions thrown while computing the map function,
the exceptions are chained as in $(D TaskPool.amap).
*/
auto
map(S)(S source, size_t bufSize = 100, size_t workUnitSize = size_t.max)
if (isInputRange!S)
{
enforce(workUnitSize == size_t.max || workUnitSize <= bufSize,
"Work unit size must be smaller than buffer size.");
alias fun = adjoin!(staticMap!(unaryFun, functions));
static final class Map
{
// This is a class because the task needs to be located on the
// heap and in the non-random access case source needs to be on
// the heap, too.
private:
enum bufferTrick = is(typeof(source.buf1)) &&
is(typeof(source.bufPos)) &&
is(typeof(source.doBufSwap()));
alias E = MapType!(S, functions);
E[] buf1, buf2;
S source;
TaskPool pool;
Task!(run, E[] delegate(E[]), E[]) nextBufTask;
size_t workUnitSize;
size_t bufPos;
bool lastTaskWaited;
static if (isRandomAccessRange!S)
{
alias FromType = S;
void popSource()
{
static if (__traits(compiles, source[0..source.length]))
{
source = source[min(buf1.length, source.length)..source.length];
}
else static if (__traits(compiles, source[0..$]))
{
source = source[min(buf1.length, source.length)..$];
}
else
{
static assert(0, "S must have slicing for Map."
~ " " ~ S.stringof ~ " doesn't.");
}
}
}
else static if (bufferTrick)
{
// Make sure we don't have the buffer recycling overload of
// asyncBuf.
static if (
is(typeof(source.source)) &&
isRoundRobin!(typeof(source.source))
)
{
static assert(0, "Cannot execute a parallel map on " ~
"the buffer recycling overload of asyncBuf."
);
}
alias FromType = typeof(source.buf1);
FromType from;
// Just swap our input buffer with source's output buffer.
// No need to copy element by element.
FromType dumpToFrom()
{
assert(source.buf1.length <= from.length);
from.length = source.buf1.length;
swap(source.buf1, from);
// Just in case this source has been popped before
// being sent to map:
from = from[source.bufPos..$];
static if (is(typeof(source._length)))
{
source._length -= (from.length - source.bufPos);
}
source.doBufSwap();
return from;
}
}
else
{
alias FromType = ElementType!S[];
// The temporary array that data is copied to before being
// mapped.
FromType from;
FromType dumpToFrom()
{
assert(from !is null);
size_t i;
for (; !source.empty && i < from.length; source.popFront())
{
from[i++] = source.front;
}
from = from[0..i];
return from;
}
}
static if (hasLength!S)
{
size_t _length;
public @property size_t length() const @safe pure nothrow
{
return _length;
}
}
this(S source, size_t bufSize, size_t workUnitSize, TaskPool pool)
{
static if (bufferTrick)
{
bufSize = source.buf1.length;
}
buf1.length = bufSize;
buf2.length = bufSize;
static if (!isRandomAccessRange!S)
{
from.length = bufSize;
}
this.workUnitSize = (workUnitSize == size_t.max) ?
pool.defaultWorkUnitSize(bufSize) : workUnitSize;
this.source = source;
this.pool = pool;
static if (hasLength!S)
{
_length = source.length;
}
buf1 = fillBuf(buf1);
submitBuf2();
}
// The from parameter is a dummy and ignored in the random access
// case.
E[] fillBuf(E[] buf)
{
static if (isRandomAccessRange!S)
{
auto toMap = take(source, buf.length);
scope(success) popSource();
}
else
{
auto toMap = dumpToFrom();
}
buf = buf[0..min(buf.length, toMap.length)];
// Handle as a special case:
if (pool.size == 0)
{
size_t index = 0;
foreach (elem; toMap)
{
buf[index++] = fun(elem);
}
return buf;
}
pool.amap!functions(toMap, workUnitSize, buf);
return buf;
}
void submitBuf2()
in
{
assert(nextBufTask.prev is null);
assert(nextBufTask.next is null);
} do
{
// Hack to reuse the task object.
nextBufTask = typeof(nextBufTask).init;
nextBufTask._args[0] = &fillBuf;
nextBufTask._args[1] = buf2;
pool.put(nextBufTask);
}
void doBufSwap()
{
if (lastTaskWaited)
{
// Then the source is empty. Signal it here.
buf1 = null;
buf2 = null;
static if (!isRandomAccessRange!S)
{
from = null;
}
return;
}
buf2 = buf1;
buf1 = nextBufTask.yieldForce;
bufPos = 0;
if (source.empty)
{
lastTaskWaited = true;
}
else
{
submitBuf2();
}
}
public:
@property auto front()
{
return buf1[bufPos];
}
void popFront()
{
static if (hasLength!S)
{
_length--;
}
bufPos++;
if (bufPos >= buf1.length)
{
doBufSwap();
}
}
static if (std.range.isInfinite!S)
{
enum bool empty = false;
}
else
{
bool empty() @property
{
// popFront() sets this when source is empty
return buf1.length == 0;
}
}
}
return new Map(source, bufSize, workUnitSize, this);
}
}
/**
Given a $(D source) range that is expensive to iterate over, returns an
input range that asynchronously buffers the contents of
$(D source) into a buffer of $(D bufSize) elements in a worker thread,
while making previously buffered elements from a second buffer, also of size
$(D bufSize), available via the range interface of the returned
object. The returned range has a length iff $(D hasLength!S).
$(D asyncBuf) is useful, for example, when performing expensive operations
on the elements of ranges that represent data on a disk or network.
Example:
---
import std.conv, std.stdio;
void main()
{
// Fetch lines of a file in a background thread
// while processing previously fetched lines,
// dealing with byLine's buffer recycling by
// eagerly duplicating every line.
auto lines = File("foo.txt").byLine();
auto duped = std.algorithm.map!"a.idup"(lines);
// Fetch more lines in the background while we
// process the lines already read into memory
// into a matrix of doubles.
double[][] matrix;
auto asyncReader = taskPool.asyncBuf(duped);
foreach (line; asyncReader)
{
auto ls = line.split("\t");
matrix ~= to!(double[])(ls);
}
}
---
$(B Exception Handling):
Any exceptions thrown while iterating over $(D source) are re-thrown on a
call to $(D popFront) or, if thrown during construction, simply
allowed to propagate to the caller.
*/
auto asyncBuf(S)(S source, size_t bufSize = 100) if (isInputRange!S)
{
static final class AsyncBuf
{
// This is a class because the task and source both need to be on
// the heap.
// The element type of S.
alias E = ElementType!S; // Needs to be here b/c of forward ref bugs.
private:
E[] buf1, buf2;
S source;
TaskPool pool;
Task!(run, E[] delegate(E[]), E[]) nextBufTask;
size_t bufPos;
bool lastTaskWaited;
static if (hasLength!S)
{
size_t _length;
// Available if hasLength!S.
public @property size_t length() const @safe pure nothrow
{
return _length;
}
}
this(S source, size_t bufSize, TaskPool pool)
{
buf1.length = bufSize;
buf2.length = bufSize;
this.source = source;
this.pool = pool;
static if (hasLength!S)
{
_length = source.length;
}
buf1 = fillBuf(buf1);
submitBuf2();
}
E[] fillBuf(E[] buf)
{
assert(buf !is null);
size_t i;
for (; !source.empty && i < buf.length; source.popFront())
{
buf[i++] = source.front;
}
buf = buf[0..i];
return buf;
}
void submitBuf2()
in
{
assert(nextBufTask.prev is null);
assert(nextBufTask.next is null);
} do
{
// Hack to reuse the task object.
nextBufTask = typeof(nextBufTask).init;
nextBufTask._args[0] = &fillBuf;
nextBufTask._args[1] = buf2;
pool.put(nextBufTask);
}
void doBufSwap()
{
if (lastTaskWaited)
{
// Then source is empty. Signal it here.
buf1 = null;
buf2 = null;
return;
}
buf2 = buf1;
buf1 = nextBufTask.yieldForce;
bufPos = 0;
if (source.empty)
{
lastTaskWaited = true;
}
else
{
submitBuf2();
}
}
public:
E front() @property
{
return buf1[bufPos];
}
void popFront()
{
static if (hasLength!S)
{
_length--;
}
bufPos++;
if (bufPos >= buf1.length)
{
doBufSwap();
}
}
static if (std.range.isInfinite!S)
{
enum bool empty = false;
}
else
{
///
bool empty() @property
{
// popFront() sets this when source is empty:
return buf1.length == 0;
}
}
}
return new AsyncBuf(source, bufSize, this);
}
/**
Given a callable object $(D next) that writes to a user-provided buffer and
a second callable object $(D empty) that determines whether more data is
available to write via $(D next), returns an input range that
asynchronously calls $(D next) with a set of size $(D nBuffers) of buffers
and makes the results available in the order they were obtained via the
input range interface of the returned object. Similarly to the
input range overload of $(D asyncBuf), the first half of the buffers
are made available via the range interface while the second half are
filled and vice-versa.
Params:
next = A callable object that takes a single argument that must be an array
with mutable elements. When called, $(D next) writes data to
the array provided by the caller.
empty = A callable object that takes no arguments and returns a type
implicitly convertible to $(D bool). This is used to signify
that no more data is available to be obtained by calling $(D next).
initialBufSize = The initial size of each buffer. If $(D next) takes its
array by reference, it may resize the buffers.
nBuffers = The number of buffers to cycle through when calling $(D next).
Example:
---
// Fetch lines of a file in a background
// thread while processing previously fetched
// lines, without duplicating any lines.
auto file = File("foo.txt");
void next(ref char[] buf)
{
file.readln(buf);
}
// Fetch more lines in the background while we
// process the lines already read into memory
// into a matrix of doubles.
double[][] matrix;
auto asyncReader = taskPool.asyncBuf(&next, &file.eof);
foreach (line; asyncReader)
{
auto ls = line.split("\t");
matrix ~= to!(double[])(ls);
}
---
$(B Exception Handling):
Any exceptions thrown while iterating over $(D range) are re-thrown on a
call to $(D popFront).
Warning:
Using the range returned by this function in a parallel foreach loop
will not work because buffers may be overwritten while the task that
processes them is in queue. This is checked for at compile time
and will result in a static assertion failure.
*/
auto asyncBuf(C1, C2)(C1 next, C2 empty, size_t initialBufSize = 0, size_t nBuffers = 100)
if (is(typeof(C2.init()) : bool) &&
Parameters!C1.length == 1 &&
Parameters!C2.length == 0 &&
isArray!(Parameters!C1[0])
) {
auto roundRobin = RoundRobinBuffer!(C1, C2)(next, empty, initialBufSize, nBuffers);
return asyncBuf(roundRobin, nBuffers / 2);
}
///
template reduce(functions...)
{
/**
Parallel reduce on a random access range. Except as otherwise noted,
usage is similar to $(REF _reduce, std,algorithm,iteration). This
function works by splitting the range to be reduced into work units,
which are slices to be reduced in parallel. Once the results from all
work units are computed, a final serial reduction is performed on these
results to compute the final answer. Therefore, care must be taken to
choose the seed value appropriately.
Because the reduction is being performed in parallel, $(D functions)
must be associative. For notational simplicity, let # be an
infix operator representing $(D functions). Then, (a # b) # c must equal
a # (b # c). Floating point addition is not associative
even though addition in exact arithmetic is. Summing floating
point numbers using this function may give different results than summing
serially. However, for many practical purposes floating point addition
can be treated as associative.
Note that, since $(D functions) are assumed to be associative,
additional optimizations are made to the serial portion of the reduction
algorithm. These take advantage of the instruction level parallelism of
modern CPUs, in addition to the thread-level parallelism that the rest
of this module exploits. This can lead to better than linear speedups
relative to $(REF _reduce, std,algorithm,iteration), especially for
fine-grained benchmarks like dot products.
An explicit seed may be provided as the first argument. If
provided, it is used as the seed for all work units and for the final
reduction of results from all work units. Therefore, if it is not the
identity value for the operation being performed, results may differ
from those generated by $(REF _reduce, std,algorithm,iteration) or
depending on how many work units are used. The next argument must be
the range to be reduced.
---
// Find the sum of squares of a range in parallel, using
// an explicit seed.
//
// Timings on an Athlon 64 X2 dual core machine:
//
// Parallel reduce: 72 milliseconds
// Using std.algorithm.reduce instead: 181 milliseconds
auto nums = iota(10_000_000.0f);
auto sumSquares = taskPool.reduce!"a + b"(
0.0, std.algorithm.map!"a * a"(nums)
);
---
If no explicit seed is provided, the first element of each work unit
is used as a seed. For the final reduction, the result from the first
work unit is used as the seed.
---
// Find the sum of a range in parallel, using the first
// element of each work unit as the seed.
auto sum = taskPool.reduce!"a + b"(nums);
---
An explicit work unit size may be specified as the last argument.
Specifying too small a work unit size will effectively serialize the
reduction, as the final reduction of the result of each work unit will
dominate computation time. If $(D TaskPool.size) for this instance
is zero, this parameter is ignored and one work unit is used.
---
// Use a work unit size of 100.
auto sum2 = taskPool.reduce!"a + b"(nums, 100);
// Work unit size of 100 and explicit seed.
auto sum3 = taskPool.reduce!"a + b"(0.0, nums, 100);
---
Parallel reduce supports multiple functions, like
$(D std.algorithm.reduce).
---
// Find both the min and max of nums.
auto minMax = taskPool.reduce!(min, max)(nums);
assert(minMax[0] == reduce!min(nums));
assert(minMax[1] == reduce!max(nums));
---
$(B Exception Handling):
After this function is finished executing, any exceptions thrown
are chained together via $(D Throwable.next) and rethrown. The chaining
order is non-deterministic.
*/
auto reduce(Args...)(Args args)
{
alias fun = reduceAdjoin!functions;
alias finishFun = reduceFinish!functions;
static if (isIntegral!(Args[$ - 1]))
{
size_t workUnitSize = cast(size_t) args[$ - 1];
alias args2 = args[0..$ - 1];
alias Args2 = Args[0..$ - 1];
}
else
{
alias args2 = args;
alias Args2 = Args;
}
auto makeStartValue(Type)(Type e)
{
static if (functions.length == 1)
{
return e;
}
else
{
typeof(adjoin!(staticMap!(binaryFun, functions))(e, e)) seed = void;
foreach (i, T; seed.Types)
{
emplaceRef(seed.expand[i], e);
}
return seed;
}
}
static if (args2.length == 2)
{
static assert(isInputRange!(Args2[1]));
alias range = args2[1];
alias seed = args2[0];
enum explicitSeed = true;
static if (!is(typeof(workUnitSize)))
{
size_t workUnitSize = defaultWorkUnitSize(range.length);
}
}
else
{
static assert(args2.length == 1);
alias range = args2[0];
static if (!is(typeof(workUnitSize)))
{
size_t workUnitSize = defaultWorkUnitSize(range.length);
}
enforce(!range.empty,
"Cannot reduce an empty range with first element as start value.");
auto seed = makeStartValue(range.front);
enum explicitSeed = false;
range.popFront();
}
alias E = typeof(seed);
alias R = typeof(range);
E reduceOnRange(R range, size_t lowerBound, size_t upperBound)
{
// This is for exploiting instruction level parallelism by
// using multiple accumulator variables within each thread,
// since we're assuming functions are associative anyhow.
// This is so that loops can be unrolled automatically.
enum ilpTuple = AliasSeq!(0, 1, 2, 3, 4, 5);
enum nILP = ilpTuple.length;
immutable subSize = (upperBound - lowerBound) / nILP;
if (subSize <= 1)
{
// Handle as a special case.
static if (explicitSeed)
{
E result = seed;
}
else
{
E result = makeStartValue(range[lowerBound]);
lowerBound++;
}
foreach (i; lowerBound..upperBound)
{
result = fun(result, range[i]);
}
return result;
}
assert(subSize > 1);
E[nILP] results;
size_t[nILP] offsets;
foreach (i; ilpTuple)
{
offsets[i] = lowerBound + subSize * i;
static if (explicitSeed)
{
results[i] = seed;
}
else
{
results[i] = makeStartValue(range[offsets[i]]);
offsets[i]++;
}
}
immutable nLoop = subSize - (!explicitSeed);
foreach (i; 0..nLoop)
{
foreach (j; ilpTuple)
{
results[j] = fun(results[j], range[offsets[j]]);
offsets[j]++;
}
}
// Finish the remainder.
foreach (i; nILP * subSize + lowerBound..upperBound)
{
results[$ - 1] = fun(results[$ - 1], range[i]);
}
foreach (i; ilpTuple[1..$])
{
results[0] = finishFun(results[0], results[i]);
}
return results[0];
}
immutable len = range.length;
if (len == 0)
{
return seed;
}
if (this.size == 0)
{
return finishFun(seed, reduceOnRange(range, 0, len));
}
// Unlike the rest of the functions here, I can't use the Task object
// recycling trick here because this has to work on non-commutative
// operations. After all the tasks are done executing, fun() has to
// be applied on the results of these to get a final result, but
// it can't be evaluated out of order.
if (workUnitSize > len)
{
workUnitSize = len;
}
immutable size_t nWorkUnits = (len / workUnitSize) + ((len % workUnitSize == 0) ? 0 : 1);
assert(nWorkUnits * workUnitSize >= len);
alias RTask = Task!(run, typeof(&reduceOnRange), R, size_t, size_t);
RTask[] tasks;
// Can't use alloca() due to Bug 3753. Use a fixed buffer
// backed by malloc().
enum maxStack = 2_048;
byte[maxStack] buf = void;
immutable size_t nBytesNeeded = nWorkUnits * RTask.sizeof;
import core.stdc.stdlib : malloc, free;
if (nBytesNeeded < maxStack)
{
tasks = (cast(RTask*) buf.ptr)[0..nWorkUnits];
}
else
{
auto ptr = cast(RTask*) malloc(nBytesNeeded);
if (!ptr)
{
throw new OutOfMemoryError(
"Out of memory in std.parallelism."
);
}
tasks = ptr[0..nWorkUnits];
}
scope(exit)
{
if (nBytesNeeded > maxStack)
{
free(tasks.ptr);
}
}
foreach (ref t; tasks[])
emplaceRef(t, RTask());
// Hack to take the address of a nested function w/o
// making a closure.
static auto scopedAddress(D)(scope D del) @system
{
auto tmp = del;
return tmp;
}
size_t curPos = 0;
void useTask(ref RTask task)
{
task.pool = this;
task._args[0] = scopedAddress(&reduceOnRange);
task._args[3] = min(len, curPos + workUnitSize); // upper bound.
task._args[1] = range; // range
task._args[2] = curPos; // lower bound.
curPos += workUnitSize;
}
foreach (ref task; tasks)
{
useTask(task);
}
foreach (i; 1..tasks.length - 1)
{
tasks[i].next = tasks[i + 1].basePtr;
tasks[i + 1].prev = tasks[i].basePtr;
}
if (tasks.length > 1)
{
queueLock();
scope(exit) queueUnlock();
abstractPutGroupNoSync(
tasks[1].basePtr,
tasks[$ - 1].basePtr
);
}
if (tasks.length > 0)
{
try
{
tasks[0].job();
}
catch (Throwable e)
{
tasks[0].exception = e;
}
tasks[0].taskStatus = TaskStatus.done;
// Try to execute each of these in the current thread
foreach (ref task; tasks[1..$])
{
tryDeleteExecute(task.basePtr);
}
}
// Now that we've tried to execute every task, they're all either
// done or in progress. Force all of them.
E result = seed;
Throwable firstException, lastException;
foreach (ref task; tasks)
{
try
{
task.yieldForce;
}
catch (Throwable e)
{
addToChain(e, firstException, lastException);
continue;
}
if (!firstException) result = finishFun(result, task.returnVal);
}
if (firstException) throw firstException;
return result;
}
}
/**
Gets the index of the current thread relative to this $(D TaskPool). Any
thread not in this pool will receive an index of 0. The worker threads in
this pool receive unique indices of 1 through $(D this.size).
This function is useful for maintaining worker-local resources.
Example:
---
// Execute a loop that computes the greatest common
// divisor of every number from 0 through 999 with
// 42 in parallel. Write the results out to
// a set of files, one for each thread. This allows
// results to be written out without any synchronization.
import std.conv, std.range, std.numeric, std.stdio;
void main()
{
auto filesHandles = new File[taskPool.size + 1];
scope(exit) {
foreach (ref handle; fileHandles)
{
handle.close();
}
}
foreach (i, ref handle; fileHandles)
{
handle = File("workerResults" ~ to!string(i) ~ ".txt");
}
foreach (num; parallel(iota(1_000)))
{
auto outHandle = fileHandles[taskPool.workerIndex];
outHandle.writeln(num, '\t', gcd(num, 42));
}
}
---
*/
size_t workerIndex() @property @safe const nothrow
{
immutable rawInd = threadIndex;
return (rawInd >= instanceStartIndex && rawInd < instanceStartIndex + size) ?
(rawInd - instanceStartIndex + 1) : 0;
}
/**
Struct for creating worker-local storage. Worker-local storage is
thread-local storage that exists only for worker threads in a given
$(D TaskPool) plus a single thread outside the pool. It is allocated on the
garbage collected heap in a way that avoids _false sharing, and doesn't
necessarily have global scope within any thread. It can be accessed from
any worker thread in the $(D TaskPool) that created it, and one thread
outside this $(D TaskPool). All threads outside the pool that created a
given instance of worker-local storage share a single slot.
Since the underlying data for this struct is heap-allocated, this struct
has reference semantics when passed between functions.
The main uses cases for $(D WorkerLocalStorageStorage) are:
1. Performing parallel reductions with an imperative, as opposed to
functional, programming style. In this case, it's useful to treat
$(D WorkerLocalStorageStorage) as local to each thread for only the parallel
portion of an algorithm.
2. Recycling temporary buffers across iterations of a parallel foreach loop.
Example:
---
// Calculate pi as in our synopsis example, but
// use an imperative instead of a functional style.
immutable n = 1_000_000_000;
immutable delta = 1.0L / n;
auto sums = taskPool.workerLocalStorage(0.0L);
foreach (i; parallel(iota(n)))
{
immutable x = ( i - 0.5L ) * delta;
immutable toAdd = delta / ( 1.0 + x * x );
sums.get += toAdd;
}
// Add up the results from each worker thread.
real pi = 0;
foreach (threadResult; sums.toRange)
{
pi += 4.0L * threadResult;
}
---
*/
static struct WorkerLocalStorage(T)
{
private:
TaskPool pool;
size_t size;
size_t elemSize;
bool* stillThreadLocal;
static size_t roundToLine(size_t num) pure nothrow
{
if (num % cacheLineSize == 0)
{
return num;
}
else
{
return ((num / cacheLineSize) + 1) * cacheLineSize;
}
}
void* data;
void initialize(TaskPool pool)
{
this.pool = pool;
size = pool.size + 1;
stillThreadLocal = new bool;
*stillThreadLocal = true;
// Determines whether the GC should scan the array.
auto blkInfo = (typeid(T).flags & 1) ?
cast(GC.BlkAttr) 0 :
GC.BlkAttr.NO_SCAN;
immutable nElem = pool.size + 1;
elemSize = roundToLine(T.sizeof);
// The + 3 is to pad one full cache line worth of space on either side
// of the data structure to make sure false sharing with completely
// unrelated heap data is prevented, and to provide enough padding to
// make sure that data is cache line-aligned.
data = GC.malloc(elemSize * (nElem + 3), blkInfo) + elemSize;
// Cache line align data ptr.
data = cast(void*) roundToLine(cast(size_t) data);
foreach (i; 0..nElem)
{
this.opIndex(i) = T.init;
}
}
ref T opIndex(size_t index)
{
assert(index < size, text(index, '\t', uint.max));
return *(cast(T*) (data + elemSize * index));
}
void opIndexAssign(T val, size_t index)
{
assert(index < size);
*(cast(T*) (data + elemSize * index)) = val;
}
public:
/**
Get the current thread's instance. Returns by ref.
Note that calling $(D get) from any thread
outside the $(D TaskPool) that created this instance will return the
same reference, so an instance of worker-local storage should only be
accessed from one thread outside the pool that created it. If this
rule is violated, undefined behavior will result.
If assertions are enabled and $(D toRange) has been called, then this
WorkerLocalStorage instance is no longer worker-local and an assertion
failure will result when calling this method. This is not checked
when assertions are disabled for performance reasons.
*/
ref T get() @property
{
assert(*stillThreadLocal,
"Cannot call get() on this instance of WorkerLocalStorage " ~
"because it is no longer worker-local."
);
return opIndex(pool.workerIndex);
}
/**
Assign a value to the current thread's instance. This function has
the same caveats as its overload.
*/
void get(T val) @property
{
assert(*stillThreadLocal,
"Cannot call get() on this instance of WorkerLocalStorage " ~
"because it is no longer worker-local."
);
opIndexAssign(val, pool.workerIndex);
}
/**
Returns a range view of the values for all threads, which can be used
to further process the results of each thread after running the parallel
part of your algorithm. Do not use this method in the parallel portion
of your algorithm.
Calling this function sets a flag indicating that this struct is no
longer worker-local, and attempting to use the $(D get) method again
will result in an assertion failure if assertions are enabled.
*/
WorkerLocalStorageRange!T toRange() @property
{
if (*stillThreadLocal)
{
*stillThreadLocal = false;
// Make absolutely sure results are visible to all threads.
// This is probably not necessary since some other
// synchronization primitive will be used to signal that the
// parallel part of the algorithm is done, but the
// performance impact should be negligible, so it's better
// to be safe.
ubyte barrierDummy;
atomicSetUbyte(barrierDummy, 1);
}
return WorkerLocalStorageRange!T(this);
}
}
/**
Range primitives for worker-local storage. The purpose of this is to
access results produced by each worker thread from a single thread once you
are no longer using the worker-local storage from multiple threads.
Do not use this struct in the parallel portion of your algorithm.
The proper way to instantiate this object is to call
$(D WorkerLocalStorage.toRange). Once instantiated, this object behaves
as a finite random-access range with assignable, lvalue elements and
a length equal to the number of worker threads in the $(D TaskPool) that
created it plus 1.
*/
static struct WorkerLocalStorageRange(T)
{
private:
WorkerLocalStorage!T workerLocalStorage;
size_t _length;
size_t beginOffset;
this(WorkerLocalStorage!T wl)
{
this.workerLocalStorage = wl;
_length = wl.size;
}
public:
ref T front() @property
{
return this[0];
}
ref T back() @property
{
return this[_length - 1];
}
void popFront()
{
if (_length > 0)
{
beginOffset++;
_length--;
}
}
void popBack()
{
if (_length > 0)
{
_length--;
}
}
typeof(this) save() @property
{
return this;
}
ref T opIndex(size_t index)
{
assert(index < _length);
return workerLocalStorage[index + beginOffset];
}
void opIndexAssign(T val, size_t index)
{
assert(index < _length);
workerLocalStorage[index] = val;
}
typeof(this) opSlice(size_t lower, size_t upper)
{
assert(upper <= _length);
auto newWl = this.workerLocalStorage;
newWl.data += lower * newWl.elemSize;
newWl.size = upper - lower;
return typeof(this)(newWl);
}
bool empty() @property
{
return length == 0;
}
size_t length() @property
{
return _length;
}
}
/**
Creates an instance of worker-local storage, initialized with a given
value. The value is $(D lazy) so that you can, for example, easily
create one instance of a class for each worker. For usage example,
see the $(D WorkerLocalStorage) struct.
*/
WorkerLocalStorage!T workerLocalStorage(T)(lazy T initialVal = T.init)
{
WorkerLocalStorage!T ret;
ret.initialize(this);
foreach (i; 0..size + 1)
{
ret[i] = initialVal;
}
// Memory barrier to make absolutely sure that what we wrote is
// visible to worker threads.
ubyte barrierDummy;
atomicSetUbyte(barrierDummy, 0);
return ret;
}
/**
Signals to all worker threads to terminate as soon as they are finished
with their current $(D Task), or immediately if they are not executing a
$(D Task). $(D Task)s that were in queue will not be executed unless
a call to $(D Task.workForce), $(D Task.yieldForce) or $(D Task.spinForce)
causes them to be executed.
Use only if you have waited on every $(D Task) and therefore know the
queue is empty, or if you speculatively executed some tasks and no longer
need the results.
*/
void stop() @trusted
{
queueLock();
scope(exit) queueUnlock();
atomicSetUbyte(status, PoolState.stopNow);
notifyAll();
}
/**
Signals worker threads to terminate when the queue becomes empty.
If blocking argument is true, wait for all worker threads to terminate
before returning. This option might be used in applications where
task results are never consumed-- e.g. when $(D TaskPool) is employed as a
rudimentary scheduler for tasks which communicate by means other than
return values.
Warning: Calling this function with $(D blocking = true) from a worker
thread that is a member of the same $(D TaskPool) that
$(D finish) is being called on will result in a deadlock.
*/
void finish(bool blocking = false) @trusted
{
{
queueLock();
scope(exit) queueUnlock();
atomicCasUbyte(status, PoolState.running, PoolState.finishing);
notifyAll();
}
if (blocking)
{
// Use this thread as a worker until everything is finished.
executeWorkLoop();
foreach (t; pool)
{
// Maybe there should be something here to prevent a thread
// from calling join() on itself if this function is called
// from a worker thread in the same pool, but:
//
// 1. Using an if statement to skip join() would result in
// finish() returning without all tasks being finished.
//
// 2. If an exception were thrown, it would bubble up to the
// Task from which finish() was called and likely be
// swallowed.
t.join();
}
}
}
/// Returns the number of worker threads in the pool.
@property size_t size() @safe const pure nothrow
{
return pool.length;
}
/**
Put a $(D Task) object on the back of the task queue. The $(D Task)
object may be passed by pointer or reference.
Example:
---
import std.file;
// Create a task.
auto t = task!read("foo.txt");
// Add it to the queue to be executed.
taskPool.put(t);
---
Notes:
@trusted overloads of this function are called for $(D Task)s if
$(REF hasUnsharedAliasing, std,traits) is false for the $(D Task)'s
return type or the function the $(D Task) executes is $(D pure).
$(D Task) objects that meet all other requirements specified in the
$(D @trusted) overloads of $(D task) and $(D scopedTask) may be created
and executed from $(D @safe) code via $(D Task.executeInNewThread) but
not via $(D TaskPool).
While this function takes the address of variables that may
be on the stack, some overloads are marked as @trusted.
$(D Task) includes a destructor that waits for the task to complete
before destroying the stack frame it is allocated on. Therefore,
it is impossible for the stack frame to be destroyed before the task is
complete and no longer referenced by a $(D TaskPool).
*/
void put(alias fun, Args...)(ref Task!(fun, Args) task)
if (!isSafeReturn!(typeof(task)))
{
task.pool = this;
abstractPut(task.basePtr);
}
/// Ditto
void put(alias fun, Args...)(Task!(fun, Args)* task)
if (!isSafeReturn!(typeof(*task)))
{
enforce(task !is null, "Cannot put a null Task on a TaskPool queue.");
put(*task);
}
@trusted void put(alias fun, Args...)(ref Task!(fun, Args) task)
if (isSafeReturn!(typeof(task)))
{
task.pool = this;
abstractPut(task.basePtr);
}
@trusted void put(alias fun, Args...)(Task!(fun, Args)* task)
if (isSafeReturn!(typeof(*task)))
{
enforce(task !is null, "Cannot put a null Task on a TaskPool queue.");
put(*task);
}
/**
These properties control whether the worker threads are daemon threads.
A daemon thread is automatically terminated when all non-daemon threads
have terminated. A non-daemon thread will prevent a program from
terminating as long as it has not terminated.
If any $(D TaskPool) with non-daemon threads is active, either $(D stop)
or $(D finish) must be called on it before the program can terminate.
The worker treads in the $(D TaskPool) instance returned by the
$(D taskPool) property are daemon by default. The worker threads of
manually instantiated task pools are non-daemon by default.
Note: For a size zero pool, the getter arbitrarily returns true and the
setter has no effect.
*/
bool isDaemon() @property @trusted
{
queueLock();
scope(exit) queueUnlock();
return (size == 0) ? true : pool[0].isDaemon;
}
/// Ditto
void isDaemon(bool newVal) @property @trusted
{
queueLock();
scope(exit) queueUnlock();
foreach (thread; pool)
{
thread.isDaemon = newVal;
}
}
/**
These functions allow getting and setting the OS scheduling priority of
the worker threads in this $(D TaskPool). They forward to
$(D core.thread.Thread.priority), so a given priority value here means the
same thing as an identical priority value in $(D core.thread).
Note: For a size zero pool, the getter arbitrarily returns
$(D core.thread.Thread.PRIORITY_MIN) and the setter has no effect.
*/
int priority() @property @trusted
{
return (size == 0) ? core.thread.Thread.PRIORITY_MIN :
pool[0].priority;
}
/// Ditto
void priority(int newPriority) @property @trusted
{
if (size > 0)
{
foreach (t; pool)
{
t.priority = newPriority;
}
}
}
}
/**
Returns a lazily initialized global instantiation of $(D TaskPool).
This function can safely be called concurrently from multiple non-worker
threads. The worker threads in this pool are daemon threads, meaning that it
is not necessary to call $(D TaskPool.stop) or $(D TaskPool.finish) before
terminating the main thread.
*/
@property TaskPool taskPool() @trusted
{
import std.concurrency : initOnce;
__gshared TaskPool pool;
return initOnce!pool({
auto p = new TaskPool(defaultPoolThreads);
p.isDaemon = true;
return p;
}());
}
private shared uint _defaultPoolThreads;
shared static this()
{
atomicStore(_defaultPoolThreads, totalCPUs - 1);
}
/**
These properties get and set the number of worker threads in the $(D TaskPool)
instance returned by $(D taskPool). The default value is $(D totalCPUs) - 1.
Calling the setter after the first call to $(D taskPool) does not changes
number of worker threads in the instance returned by $(D taskPool).
*/
@property uint defaultPoolThreads() @trusted
{
return atomicLoad(_defaultPoolThreads);
}
/// Ditto
@property void defaultPoolThreads(uint newVal) @trusted
{
atomicStore(_defaultPoolThreads, newVal);
}
/**
Convenience functions that forwards to $(D taskPool.parallel). The
purpose of these is to make parallel foreach less verbose and more
readable.
Example:
---
// Find the logarithm of every number from
// 1 to 1_000_000 in parallel, using the
// default TaskPool instance.
auto logs = new double[1_000_000];
foreach (i, ref elem; parallel(logs))
{
elem = log(i + 1.0);
}
---
*/
ParallelForeach!R parallel(R)(R range)
{
return taskPool.parallel(range);
}
/// Ditto
ParallelForeach!R parallel(R)(R range, size_t workUnitSize)
{
return taskPool.parallel(range, workUnitSize);
}
// Thrown when a parallel foreach loop is broken from.
class ParallelForeachError : Error
{
this()
{
super("Cannot break from a parallel foreach loop using break, return, "
~ "labeled break/continue or goto statements.");
}
}
/*------Structs that implement opApply for parallel foreach.------------------*/
private template randLen(R)
{
enum randLen = isRandomAccessRange!R && hasLength!R;
}
private void submitAndExecute(
TaskPool pool,
scope void delegate() doIt
)
{
immutable nThreads = pool.size + 1;
alias PTask = typeof(scopedTask(doIt));
import core.stdc.stdlib : malloc, free;
import core.stdc.string : memcpy;
// The logical thing to do would be to just use alloca() here, but that
// causes problems on Windows for reasons that I don't understand
// (tentatively a compiler bug) and definitely doesn't work on Posix due
// to Bug 3753. Therefore, allocate a fixed buffer and fall back to
// malloc() if someone's using a ridiculous amount of threads. Also,
// the using a byte array instead of a PTask array as the fixed buffer
// is to prevent d'tors from being called on uninitialized excess PTask
// instances.
enum nBuf = 64;
byte[nBuf * PTask.sizeof] buf = void;
PTask[] tasks;
if (nThreads <= nBuf)
{
tasks = (cast(PTask*) buf.ptr)[0..nThreads];
}
else
{
auto ptr = cast(PTask*) malloc(nThreads * PTask.sizeof);
if (!ptr) throw new OutOfMemoryError("Out of memory in std.parallelism.");
tasks = ptr[0..nThreads];
}
scope(exit)
{
if (nThreads > nBuf)
{
free(tasks.ptr);
}
}
foreach (ref t; tasks)
{
import core.stdc.string : memcpy;
// This silly looking code is necessary to prevent d'tors from being
// called on uninitialized objects.
auto temp = scopedTask(doIt);
memcpy(&t, &temp, PTask.sizeof);
// This has to be done to t after copying, not temp before copying.
// Otherwise, temp's destructor will sit here and wait for the
// task to finish.
t.pool = pool;
}
foreach (i; 1..tasks.length - 1)
{
tasks[i].next = tasks[i + 1].basePtr;
tasks[i + 1].prev = tasks[i].basePtr;
}
if (tasks.length > 1)
{
pool.queueLock();
scope(exit) pool.queueUnlock();
pool.abstractPutGroupNoSync(
tasks[1].basePtr,
tasks[$ - 1].basePtr
);
}
if (tasks.length > 0)
{
try
{
tasks[0].job();
}
catch (Throwable e)
{
tasks[0].exception = e;
}
tasks[0].taskStatus = TaskStatus.done;
// Try to execute each of these in the current thread
foreach (ref task; tasks[1..$])
{
pool.tryDeleteExecute(task.basePtr);
}
}
Throwable firstException, lastException;
foreach (i, ref task; tasks)
{
try
{
task.yieldForce;
}
catch (Throwable e)
{
addToChain(e, firstException, lastException);
continue;
}
}
if (firstException) throw firstException;
}
void foreachErr()
{
throw new ParallelForeachError();
}
int doSizeZeroCase(R, Delegate)(ref ParallelForeach!R p, Delegate dg)
{
with(p)
{
int res = 0;
size_t index = 0;
// The explicit ElementType!R in the foreach loops is necessary for
// correct behavior when iterating over strings.
static if (hasLvalueElements!R)
{
foreach (ref ElementType!R elem; range)
{
static if (Parameters!dg.length == 2)
{
res = dg(index, elem);
}
else
{
res = dg(elem);
}
if (res) foreachErr();
index++;
}
}
else
{
foreach (ElementType!R elem; range)
{
static if (Parameters!dg.length == 2)
{
res = dg(index, elem);
}
else
{
res = dg(elem);
}
if (res) foreachErr();
index++;
}
}
return res;
}
}
private enum string parallelApplyMixinRandomAccess = q{
// Handle empty thread pool as special case.
if (pool.size == 0)
{
return doSizeZeroCase(this, dg);
}
// Whether iteration is with or without an index variable.
enum withIndex = Parameters!(typeof(dg)).length == 2;
shared size_t workUnitIndex = size_t.max; // Effectively -1: chunkIndex + 1 == 0
immutable len = range.length;
if (!len) return 0;
shared bool shouldContinue = true;
void doIt()
{
scope(failure)
{
// If an exception is thrown, all threads should bail.
atomicStore(shouldContinue, false);
}
while (atomicLoad(shouldContinue))
{
immutable myUnitIndex = atomicOp!"+="(workUnitIndex, 1);
immutable start = workUnitSize * myUnitIndex;
if (start >= len)
{
atomicStore(shouldContinue, false);
break;
}
immutable end = min(len, start + workUnitSize);
foreach (i; start..end)
{
static if (withIndex)
{
if (dg(i, range[i])) foreachErr();
}
else
{
if (dg(range[i])) foreachErr();
}
}
}
}
submitAndExecute(pool, &doIt);
return 0;
};
enum string parallelApplyMixinInputRange = q{
// Handle empty thread pool as special case.
if (pool.size == 0)
{
return doSizeZeroCase(this, dg);
}
// Whether iteration is with or without an index variable.
enum withIndex = Parameters!(typeof(dg)).length == 2;
// This protects the range while copying it.
auto rangeMutex = new Mutex();
shared bool shouldContinue = true;
// The total number of elements that have been popped off range.
// This is updated only while protected by rangeMutex;
size_t nPopped = 0;
static if (
is(typeof(range.buf1)) &&
is(typeof(range.bufPos)) &&
is(typeof(range.doBufSwap()))
)
{
// Make sure we don't have the buffer recycling overload of
// asyncBuf.
static if (
is(typeof(range.source)) &&
isRoundRobin!(typeof(range.source))
)
{
static assert(0, "Cannot execute a parallel foreach loop on " ~
"the buffer recycling overload of asyncBuf.");
}
enum bool bufferTrick = true;
}
else
{
enum bool bufferTrick = false;
}
void doIt()
{
scope(failure)
{
// If an exception is thrown, all threads should bail.
atomicStore(shouldContinue, false);
}
static if (hasLvalueElements!R)
{
alias Temp = ElementType!R*[];
Temp temp;
// Returns: The previous value of nPopped.
size_t makeTemp()
{
import std.algorithm.internal : addressOf;
if (temp is null)
{
temp = uninitializedArray!Temp(workUnitSize);
}
rangeMutex.lock();
scope(exit) rangeMutex.unlock();
size_t i = 0;
for (; i < workUnitSize && !range.empty; range.popFront(), i++)
{
temp[i] = addressOf(range.front);
}
temp = temp[0..i];
auto ret = nPopped;
nPopped += temp.length;
return ret;
}
}
else
{
alias Temp = ElementType!R[];
Temp temp;
// Returns: The previous value of nPopped.
static if (!bufferTrick) size_t makeTemp()
{
if (temp is null)
{
temp = uninitializedArray!Temp(workUnitSize);
}
rangeMutex.lock();
scope(exit) rangeMutex.unlock();
size_t i = 0;
for (; i < workUnitSize && !range.empty; range.popFront(), i++)
{
temp[i] = range.front;
}
temp = temp[0..i];
auto ret = nPopped;
nPopped += temp.length;
return ret;
}
static if (bufferTrick) size_t makeTemp()
{
rangeMutex.lock();
scope(exit) rangeMutex.unlock();
// Elide copying by just swapping buffers.
temp.length = range.buf1.length;
swap(range.buf1, temp);
// This is necessary in case popFront() has been called on
// range before entering the parallel foreach loop.
temp = temp[range.bufPos..$];
static if (is(typeof(range._length)))
{
range._length -= (temp.length - range.bufPos);
}
range.doBufSwap();
auto ret = nPopped;
nPopped += temp.length;
return ret;
}
}
while (atomicLoad(shouldContinue))
{
auto overallIndex = makeTemp();
if (temp.empty)
{
atomicStore(shouldContinue, false);
break;
}
foreach (i; 0..temp.length)
{
scope(success) overallIndex++;
static if (hasLvalueElements!R)
{
static if (withIndex)
{
if (dg(overallIndex, *temp[i])) foreachErr();
}
else
{
if (dg(*temp[i])) foreachErr();
}
}
else
{
static if (withIndex)
{
if (dg(overallIndex, temp[i])) foreachErr();
}
else
{
if (dg(temp[i])) foreachErr();
}
}
}
}
}
submitAndExecute(pool, &doIt);
return 0;
};
// Calls e.next until the end of the chain is found.
private Throwable findLastException(Throwable e) pure nothrow
{
if (e is null) return null;
while (e.next)
{
e = e.next;
}
return e;
}
// Adds e to the exception chain.
private void addToChain(
Throwable e,
ref Throwable firstException,
ref Throwable lastException
) pure nothrow
{
if (firstException)
{
assert(lastException);
lastException.next = e;
lastException = findLastException(e);
}
else
{
firstException = e;
lastException = findLastException(e);
}
}
private struct ParallelForeach(R)
{
TaskPool pool;
R range;
size_t workUnitSize;
alias E = ElementType!R;
static if (hasLvalueElements!R)
{
alias NoIndexDg = int delegate(ref E);
alias IndexDg = int delegate(size_t, ref E);
}
else
{
alias NoIndexDg = int delegate(E);
alias IndexDg = int delegate(size_t, E);
}
int opApply(scope NoIndexDg dg)
{
static if (randLen!R)
{
mixin(parallelApplyMixinRandomAccess);
}
else
{
mixin(parallelApplyMixinInputRange);
}
}
int opApply(scope IndexDg dg)
{
static if (randLen!R)
{
mixin(parallelApplyMixinRandomAccess);
}
else
{
mixin(parallelApplyMixinInputRange);
}
}
}
/*
This struct buffers the output of a callable that outputs data into a
user-supplied buffer into a set of buffers of some fixed size. It allows these
buffers to be accessed with an input range interface. This is used internally
in the buffer-recycling overload of TaskPool.asyncBuf, which creates an
instance and forwards it to the input range overload of asyncBuf.
*/
private struct RoundRobinBuffer(C1, C2)
{
// No need for constraints because they're already checked for in asyncBuf.
alias Array = Parameters!(C1.init)[0];
alias T = typeof(Array.init[0]);
T[][] bufs;
size_t index;
C1 nextDel;
C2 emptyDel;
bool _empty;
bool primed;
this(
C1 nextDel,
C2 emptyDel,
size_t initialBufSize,
size_t nBuffers
) {
this.nextDel = nextDel;
this.emptyDel = emptyDel;
bufs.length = nBuffers;
foreach (ref buf; bufs)
{
buf.length = initialBufSize;
}
}
void prime()
in
{
assert(!empty);
}
do
{
scope(success) primed = true;
nextDel(bufs[index]);
}
T[] front() @property
in
{
assert(!empty);
}
do
{
if (!primed) prime();
return bufs[index];
}
void popFront()
{
if (empty || emptyDel())
{
_empty = true;
return;
}
index = (index + 1) % bufs.length;
primed = false;
}
bool empty() @property const @safe pure nothrow
{
return _empty;
}
}
version(unittest)
{
// This was the only way I could get nested maps to work.
__gshared TaskPool poolInstance;
import std.stdio;
}
// These test basic functionality but don't stress test for threading bugs.
// These are the tests that should be run every time Phobos is compiled.
unittest
{
poolInstance = new TaskPool(2);
scope(exit) poolInstance.stop();
// The only way this can be verified is manually.
debug(std_parallelism) stderr.writeln("totalCPUs = ", totalCPUs);
auto oldPriority = poolInstance.priority;
poolInstance.priority = Thread.PRIORITY_MAX;
assert(poolInstance.priority == Thread.PRIORITY_MAX);
poolInstance.priority = Thread.PRIORITY_MIN;
assert(poolInstance.priority == Thread.PRIORITY_MIN);
poolInstance.priority = oldPriority;
assert(poolInstance.priority == oldPriority);
static void refFun(ref uint num)
{
num++;
}
uint x;
// Test task().
auto t = task!refFun(x);
poolInstance.put(t);
t.yieldForce;
assert(t.args[0] == 1);
auto t2 = task(&refFun, x);
poolInstance.put(t2);
t2.yieldForce;
assert(t2.args[0] == 1);
// Test scopedTask().
auto st = scopedTask!refFun(x);
poolInstance.put(st);
st.yieldForce;
assert(st.args[0] == 1);
auto st2 = scopedTask(&refFun, x);
poolInstance.put(st2);
st2.yieldForce;
assert(st2.args[0] == 1);
// Test executeInNewThread().
auto ct = scopedTask!refFun(x);
ct.executeInNewThread(Thread.PRIORITY_MAX);
ct.yieldForce;
assert(ct.args[0] == 1);
// Test ref return.
uint toInc = 0;
static ref T makeRef(T)(ref T num)
{
return num;
}
auto t3 = task!makeRef(toInc);
taskPool.put(t3);
assert(t3.args[0] == 0);
t3.spinForce++;
assert(t3.args[0] == 1);
static void testSafe() @safe {
static int bump(int num)
{
return num + 1;
}
auto safePool = new TaskPool(0);
auto t = task(&bump, 1);
taskPool.put(t);
assert(t.yieldForce == 2);
auto st = scopedTask(&bump, 1);
taskPool.put(st);
assert(st.yieldForce == 2);
safePool.stop();
}
auto arr = [1,2,3,4,5];
auto nums = new uint[5];
auto nums2 = new uint[5];
foreach (i, ref elem; poolInstance.parallel(arr))
{
elem++;
nums[i] = cast(uint) i + 2;
nums2[i] = elem;
}
assert(nums == [2,3,4,5,6], text(nums));
assert(nums2 == nums, text(nums2));
assert(arr == nums, text(arr));
// Test const/immutable arguments.
static int add(int lhs, int rhs)
{
return lhs + rhs;
}
immutable addLhs = 1;
immutable addRhs = 2;
auto addTask = task(&add, addLhs, addRhs);
auto addScopedTask = scopedTask(&add, addLhs, addRhs);
poolInstance.put(addTask);
poolInstance.put(addScopedTask);
assert(addTask.yieldForce == 3);
assert(addScopedTask.yieldForce == 3);
// Test parallel foreach with non-random access range.
auto range = filter!"a != 666"([0, 1, 2, 3, 4]);
foreach (i, elem; poolInstance.parallel(range))
{
nums[i] = cast(uint) i;
}
assert(nums == [0,1,2,3,4]);
auto logs = new double[1_000_000];
foreach (i, ref elem; poolInstance.parallel(logs))
{
elem = log(i + 1.0);
}
foreach (i, elem; logs)
{
assert(approxEqual(elem, cast(double) log(i + 1)));
}
assert(poolInstance.amap!"a * a"([1,2,3,4,5]) == [1,4,9,16,25]);
assert(poolInstance.amap!"a * a"([1,2,3,4,5], new long[5]) == [1,4,9,16,25]);
assert(poolInstance.amap!("a * a", "-a")([1,2,3]) ==
[tuple(1, -1), tuple(4, -2), tuple(9, -3)]);
auto tupleBuf = new Tuple!(int, int)[3];
poolInstance.amap!("a * a", "-a")([1,2,3], tupleBuf);
assert(tupleBuf == [tuple(1, -1), tuple(4, -2), tuple(9, -3)]);
poolInstance.amap!("a * a", "-a")([1,2,3], 5, tupleBuf);
assert(tupleBuf == [tuple(1, -1), tuple(4, -2), tuple(9, -3)]);
// Test amap with a non-array buffer.
auto toIndex = new int[5];
auto indexed = std.range.indexed(toIndex, [3, 1, 4, 0, 2]);
poolInstance.amap!"a * 2"([1, 2, 3, 4, 5], indexed);
assert(equal(indexed, [2, 4, 6, 8, 10]));
assert(equal(toIndex, [8, 4, 10, 2, 6]));
poolInstance.amap!"a / 2"(indexed, indexed);
assert(equal(indexed, [1, 2, 3, 4, 5]));
assert(equal(toIndex, [4, 2, 5, 1, 3]));
auto buf = new int[5];
poolInstance.amap!"a * a"([1,2,3,4,5], buf);
assert(buf == [1,4,9,16,25]);
poolInstance.amap!"a * a"([1,2,3,4,5], 4, buf);
assert(buf == [1,4,9,16,25]);
assert(poolInstance.reduce!"a + b"([1]) == 1);
assert(poolInstance.reduce!"a + b"([1,2,3,4]) == 10);
assert(poolInstance.reduce!"a + b"(0.0, [1,2,3,4]) == 10);
assert(poolInstance.reduce!"a + b"(0.0, [1,2,3,4], 1) == 10);
assert(poolInstance.reduce!(min, max)([1,2,3,4]) == tuple(1, 4));
assert(poolInstance.reduce!("a + b", "a * b")(tuple(0, 1), [1,2,3,4]) ==
tuple(10, 24));
immutable serialAns = std.algorithm.reduce!"a + b"(iota(1000));
assert(poolInstance.reduce!"a + b"(0, iota(1000)) == serialAns);
assert(poolInstance.reduce!"a + b"(iota(1000)) == serialAns);
// Test worker-local storage.
auto wl = poolInstance.workerLocalStorage(0);
foreach (i; poolInstance.parallel(iota(1000), 1))
{
wl.get = wl.get + i;
}
auto wlRange = wl.toRange;
auto parallelSum = poolInstance.reduce!"a + b"(wlRange);
assert(parallelSum == 499500);
assert(wlRange[0..1][0] == wlRange[0]);
assert(wlRange[1..2][0] == wlRange[1]);
// Test finish()
{
static void slowFun() { Thread.sleep(dur!"msecs"(1)); }
auto pool1 = new TaskPool();
auto tSlow = task!slowFun();
pool1.put(tSlow);
pool1.finish();
tSlow.yieldForce;
// Can't assert that pool1.status == PoolState.stopNow because status
// doesn't change until after the "done" flag is set and the waiting
// thread is woken up.
auto pool2 = new TaskPool();
auto tSlow2 = task!slowFun();
pool2.put(tSlow2);
pool2.finish(true); // blocking
assert(tSlow2.done);
// Test fix for Bug 8582 by making pool size zero.
auto pool3 = new TaskPool(0);
auto tSlow3 = task!slowFun();
pool3.put(tSlow3);
pool3.finish(true); // blocking
assert(tSlow3.done);
// This is correct because no thread will terminate unless pool2.status
// and pool3.status have already been set to stopNow.
assert(pool2.status == TaskPool.PoolState.stopNow);
assert(pool3.status == TaskPool.PoolState.stopNow);
}
// Test default pool stuff.
assert(taskPool.size == totalCPUs - 1);
nums = new uint[1000];
foreach (i; parallel(iota(1000)))
{
nums[i] = cast(uint) i;
}
assert(equal(nums, iota(1000)));
assert(equal(
poolInstance.map!"a * a"(iota(30_000_001), 10_000),
std.algorithm.map!"a * a"(iota(30_000_001))
));
// The filter is to kill random access and test the non-random access
// branch.
assert(equal(
poolInstance.map!"a * a"(
filter!"a == a"(iota(30_000_001)
), 10_000, 1000),
std.algorithm.map!"a * a"(iota(30_000_001))
));
assert(
reduce!"a + b"(0UL,
poolInstance.map!"a * a"(iota(3_000_001), 10_000)
) ==
reduce!"a + b"(0UL,
std.algorithm.map!"a * a"(iota(3_000_001))
)
);
assert(equal(
iota(1_000_002),
poolInstance.asyncBuf(filter!"a == a"(iota(1_000_002)))
));
{
import std.file : deleteme;
string temp_file = deleteme ~ "-tempDelMe.txt";
auto file = File(temp_file, "wb");
scope(exit)
{
file.close();
import std.file;
remove(temp_file);
}
auto written = [[1.0, 2, 3], [4.0, 5, 6], [7.0, 8, 9]];
foreach (row; written)
{
file.writeln(join(to!(string[])(row), "\t"));
}
file = File(temp_file);
void next(ref char[] buf)
{
file.readln(buf);
import std.string : chomp;
buf = chomp(buf);
}
double[][] read;
auto asyncReader = taskPool.asyncBuf(&next, &file.eof);
foreach (line; asyncReader)
{
if (line.length == 0) continue;
auto ls = line.split("\t");
read ~= to!(double[])(ls);
}
assert(read == written);
file.close();
}
// Test Map/AsyncBuf chaining.
auto abuf = poolInstance.asyncBuf(iota(-1.0, 3_000_000), 100);
auto temp = poolInstance.map!sqrt(
abuf, 100, 5
);
auto lmchain = poolInstance.map!"a * a"(temp, 100, 5);
lmchain.popFront();
int ii;
foreach ( elem; (lmchain))
{
if (!approxEqual(elem, ii))
{
stderr.writeln(ii, '\t', elem);
}
ii++;
}
// Test buffer trick in parallel foreach.
abuf = poolInstance.asyncBuf(iota(-1.0, 1_000_000), 100);
abuf.popFront();
auto bufTrickTest = new size_t[abuf.length];
foreach (i, elem; parallel(abuf))
{
bufTrickTest[i] = i;
}
assert(equal(iota(1_000_000), bufTrickTest));
auto myTask = task!(std.math.abs)(-1);
taskPool.put(myTask);
assert(myTask.spinForce == 1);
// Test that worker local storage from one pool receives an index of 0
// when the index is queried w.r.t. another pool. The only way to do this
// is non-deterministically.
foreach (i; parallel(iota(1000), 1))
{
assert(poolInstance.workerIndex == 0);
}
foreach (i; poolInstance.parallel(iota(1000), 1))
{
assert(taskPool.workerIndex == 0);
}
// Test exception handling.
static void parallelForeachThrow()
{
foreach (elem; parallel(iota(10)))
{
throw new Exception("");
}
}
assertThrown!Exception(parallelForeachThrow());
static int reduceException(int a, int b)
{
throw new Exception("");
}
assertThrown!Exception(
poolInstance.reduce!reduceException(iota(3))
);
static int mapException(int a)
{
throw new Exception("");
}
assertThrown!Exception(
poolInstance.amap!mapException(iota(3))
);
static void mapThrow()
{
auto m = poolInstance.map!mapException(iota(3));
m.popFront();
}
assertThrown!Exception(mapThrow());
struct ThrowingRange
{
@property int front()
{
return 1;
}
void popFront()
{
throw new Exception("");
}
enum bool empty = false;
}
assertThrown!Exception(poolInstance.asyncBuf(ThrowingRange.init));
}
//version = parallelismStressTest;
// These are more like stress tests than real unit tests. They print out
// tons of stuff and should not be run every time make unittest is run.
version(parallelismStressTest)
{
unittest
{
size_t attempt;
for (; attempt < 10; attempt++)
foreach (poolSize; [0, 4])
{
poolInstance = new TaskPool(poolSize);
uint[] numbers = new uint[1_000];
foreach (i; poolInstance.parallel( iota(0, numbers.length)) )
{
numbers[i] = cast(uint) i;
}
// Make sure it works.
foreach (i; 0..numbers.length)
{
assert(numbers[i] == i);
}
stderr.writeln("Done creating nums.");
auto myNumbers = filter!"a % 7 > 0"( iota(0, 1000));
foreach (num; poolInstance.parallel(myNumbers))
{
assert(num % 7 > 0 && num < 1000);
}
stderr.writeln("Done modulus test.");
uint[] squares = poolInstance.amap!"a * a"(numbers, 100);
assert(squares.length == numbers.length);
foreach (i, number; numbers)
{
assert(squares[i] == number * number);
}
stderr.writeln("Done squares.");
auto sumFuture = task!( reduce!"a + b" )(numbers);
poolInstance.put(sumFuture);
ulong sumSquares = 0;
foreach (elem; numbers)
{
sumSquares += elem * elem;
}
uint mySum = sumFuture.spinForce();
assert(mySum == 999 * 1000 / 2);
auto mySumParallel = poolInstance.reduce!"a + b"(numbers);
assert(mySum == mySumParallel);
stderr.writeln("Done sums.");
auto myTask = task(
{
synchronized writeln("Our lives are parallel...Our lives are parallel.");
});
poolInstance.put(myTask);
auto nestedOuter = "abcd";
auto nestedInner = iota(0, 10, 2);
foreach (i, letter; poolInstance.parallel(nestedOuter, 1))
{
foreach (j, number; poolInstance.parallel(nestedInner, 1))
{
synchronized writeln(i, ": ", letter, " ", j, ": ", number);
}
}
poolInstance.stop();
}
assert(attempt == 10);
writeln("Press enter to go to next round of unittests.");
readln();
}
// These unittests are intended more for actual testing and not so much
// as examples.
unittest
{
foreach (attempt; 0..10)
foreach (poolSize; [0, 4])
{
poolInstance = new TaskPool(poolSize);
// Test indexing.
stderr.writeln("Creator Raw Index: ", poolInstance.threadIndex);
assert(poolInstance.workerIndex() == 0);
// Test worker-local storage.
auto workerLocalStorage = poolInstance.workerLocalStorage!uint(1);
foreach (i; poolInstance.parallel(iota(0U, 1_000_000)))
{
workerLocalStorage.get++;
}
assert(reduce!"a + b"(workerLocalStorage.toRange) ==
1_000_000 + poolInstance.size + 1);
// Make sure work is reasonably balanced among threads. This test is
// non-deterministic and is more of a sanity check than something that
// has an absolute pass/fail.
shared(uint)[void*] nJobsByThread;
foreach (thread; poolInstance.pool)
{
nJobsByThread[cast(void*) thread] = 0;
}
nJobsByThread[ cast(void*) Thread.getThis()] = 0;
foreach (i; poolInstance.parallel( iota(0, 1_000_000), 100 ))
{
atomicOp!"+="( nJobsByThread[ cast(void*) Thread.getThis() ], 1);
}
stderr.writeln("\nCurrent thread is: ",
cast(void*) Thread.getThis());
stderr.writeln("Workload distribution: ");
foreach (k, v; nJobsByThread)
{
stderr.writeln(k, '\t', v);
}
// Test whether amap can be nested.
real[][] matrix = new real[][](1000, 1000);
foreach (i; poolInstance.parallel( iota(0, matrix.length) ))
{
foreach (j; poolInstance.parallel( iota(0, matrix[0].length) ))
{
matrix[i][j] = i * j;
}
}
// Get around weird bugs having to do w/ sqrt being an intrinsic:
static real mySqrt(real num)
{
return sqrt(num);
}
static real[] parallelSqrt(real[] nums)
{
return poolInstance.amap!mySqrt(nums);
}
real[][] sqrtMatrix = poolInstance.amap!parallelSqrt(matrix);
foreach (i, row; sqrtMatrix)
{
foreach (j, elem; row)
{
real shouldBe = sqrt( cast(real) i * j);
assert(approxEqual(shouldBe, elem));
sqrtMatrix[i][j] = shouldBe;
}
}
auto saySuccess = task(
{
stderr.writeln(
"Success doing matrix stuff that involves nested pool use.");
});
poolInstance.put(saySuccess);
saySuccess.workForce();
// A more thorough test of amap, reduce: Find the sum of the square roots of
// matrix.
static real parallelSum(real[] input)
{
return poolInstance.reduce!"a + b"(input);
}
auto sumSqrt = poolInstance.reduce!"a + b"(
poolInstance.amap!parallelSum(
sqrtMatrix
)
);
assert(approxEqual(sumSqrt, 4.437e8));
stderr.writeln("Done sum of square roots.");
// Test whether tasks work with function pointers.
auto nanTask = task(&isNaN, 1.0L);
poolInstance.put(nanTask);
assert(nanTask.spinForce == false);
if (poolInstance.size > 0)
{
// Test work waiting.
static void uselessFun()
{
foreach (i; 0..1_000_000) {}
}
auto uselessTasks = new typeof(task(&uselessFun))[1000];
foreach (ref uselessTask; uselessTasks)
{
uselessTask = task(&uselessFun);
}
foreach (ref uselessTask; uselessTasks)
{
poolInstance.put(uselessTask);
}
foreach (ref uselessTask; uselessTasks)
{
uselessTask.workForce();
}
}
// Test the case of non-random access + ref returns.
int[] nums = [1,2,3,4,5];
static struct RemoveRandom
{
int[] arr;
ref int front()
{
return arr.front;
}
void popFront()
{
arr.popFront();
}
bool empty()
{
return arr.empty;
}
}
auto refRange = RemoveRandom(nums);
foreach (ref elem; poolInstance.parallel(refRange))
{
elem++;
}
assert(nums == [2,3,4,5,6], text(nums));
stderr.writeln("Nums: ", nums);
poolInstance.stop();
}
}
}
version(unittest)
{
struct __S_12733
{
invariant() { assert(checksum == 1234567890); }
this(ulong u){n = u;}
void opAssign(__S_12733 s){this.n = s.n;}
ulong n;
ulong checksum = 1234567890;
}
static auto __genPair_12733(ulong n) { return __S_12733(n); }
}
unittest
{
immutable ulong[] data = [ 2UL^^59-1, 2UL^^59-1, 2UL^^59-1, 112_272_537_195_293UL ];
auto result = taskPool.amap!__genPair_12733(data);
}
unittest
{
// this test was in std.range, but caused cycles.
assert(__traits(compiles, { foreach (i; iota(0, 100UL).parallel) {} }));
}
unittest
{
long[] arr;
static assert(is(typeof({
arr.parallel.each!"a++";
})));
}
|
D
|
module db.driver.postgresql;
version (USE_POSTGRESQL):
import db.core;
import derelict.pq.pq;
import std.algorithm;
import std.datetime;
import std.array;
import std.conv;
import std.string;
import std.regex;
import std.uuid;
shared static this()
{
DerelictPQ.load();
if (DerelictPQ.isLoaded)
{
Database.regDriver(new PostgreSQLDriverCreator);
}
}
final class PostgreSQLDriverCreator: DbDriverCreator
{
mixin DbDriverCreatorMixin!("postgresql", ["psql", "pgsql", "postgres"], PostgreSQLDriver);
}
final class PostgreSQLDriver: DbDriver
{
mixin DbDriverMixin!(PGconn*, PostgreSQLResult);
bool hasFeature(Database.Feature f)
{
switch (f)
{
case Database.Feature.blob:
case Database.Feature.cursors:
case Database.Feature.transactions:
case Database.Feature.resultSize:
case Database.Feature.lastInsertId:
case Database.Feature.preparedQueries:
return true;
default:
}
return false;
}
@property bool isOpen() const
{
return _handle !is null && PQstatus(cast(PGconn*)_handle) == ConnStatusType.CONNECTION_OK;
}
bool open(URI u)
{
if (isOpen)
{
close();
}
_uri = u;
auto conStr = toStringz(_uri.to!string);
_handle = PQconnectdb(conStr);
auto result = isOpen;
if (result)
{
exec("SET CLIENT_ENCODING TO 'UNICODE'");
exec("SET DATESTYLE TO 'ISO'");
}
else
{
errorTake(DbError.Type.connection);
close();
}
dbDebug("%s.open(%s) -> %s [%s]", typeid(this), _uri, result, _handle);
return result;
}
void close()
{
dbDebug("%s.close [%s]", typeid(this), _handle);
// foreach(r; _results)
// {
// r.clear();
// }
if (_handle !is null)
{
PQfinish(_handle);
_handle = null;
}
}
private bool exec(string query)
{
if (!isOpen)
{
return false;
}
errorClear();
dbDebug("%s.exec: %s", typeid(this), query);
auto result = PQexec(_handle, toStringz(query));
switch(PQresultStatus(result))
{
case ExecStatusType.PGRES_COMMAND_OK:
case ExecStatusType.PGRES_TUPLES_OK:
PQclear(result);
return true;
default:
}
errorTake(DbError.Type.statement);
PQclear(result);
return false;
}
private void errorTake(DbError.Type t)
{
_error = DbError(t, to!string(PQerrorMessage(_handle)));
}
}
final class PostgreSQLResult: DbResult
{
mixin DbResultMixin!(PGresult*, PostgreSQLDriver);
private
{
bool _fetch;
Oid[] _fieldsTypes;
}
@property Variant lastInsertId()
{
if (isActive)
{
Oid id = PQoidValue(_handle);
if (id) // not InvalidOid
{
return Variant(id);
}
}
return Variant(null);
}
@property ulong affectedRowsLength()
{
if (isActive)
{
return to!ulong(to!string(PQcmdTuples(_handle)));
}
return 0;
}
bool prepare(string query)
{
_isPrepared = false;
clear();
if (!_driver.isOpen)
{
return false;
}
errorClear();
queryIdClear();
queryIdGen();
_query = query;
// bool hasIndexes = false;
// bool hasStrings = false;
foreach(c; match(query, regexDbParam)) {
auto token = c[0], key = c[1];
if (!_paramsTokens.count(token)) {
_paramsTokens ~= token;
_paramsKeys ~= key;
}
query = query.replace(token, "$" ~ to!string(_paramsTokens.countUntil(token) + 1));
}
auto pgResult = PQprepare(
_driver._handle,
cast(char*)toStringz(_queryId),
cast(char*)toStringz(query),
cast(int)(_paramsTokens.length),
cast(Oid*)(null)
);
_isPrepared = (PQresultStatus(pgResult) == ExecStatusType.PGRES_COMMAND_OK);
if (!_isPrepared)
{
clear();
errorTake(DbError.Type.statement);
}
dbDebug("%s.prepare: %s\nReal query: %s\nQueryID: %s\nPrepared: %s", typeid(this), _query, query, _queryId, _isPrepared);
PQclear(pgResult);
return _isPrepared;
}
bool exec(string query, Variant[string] params = null)
{
_isPrepared = false;
clear();
if (!_driver.isOpen)
{
return false;
}
errorClear();
if (!params.length)
{
dbDebug("%s.exec: %s", typeid(this), query);
_query = query;
_handle = PQexec(_driver._handle, toStringz(query));
}
else
{
return prepare(query) && execPrepared(params);
}
return takeResult();
}
bool execPrepared(Variant[string] params = null)
{
if (!_driver.isOpen || !isPrepared)
{
return false;
}
clear();
errorClear();
if (_paramsTokens.length != params.length)
{
throw new DbException(DbError.Type.statement, "Invalid parameters count");
}
char*[] values;
int[] lengths;
int[] formats;
int nParams = cast(int)(_paramsKeys.length);
foreach (k; _paramsKeys)
{
auto ptr = k in params;
if (ptr == null) {
throw new DbException(DbError.Type.statement, "Param key '" ~ k ~ "' not found");
}
string tmp = formatValue(*ptr);
if (ptr.type == typeid(null)) {
values ~= null;
lengths ~= 0;
} else {
values ~= cast(char*)(toStringz(tmp));
lengths ~= cast(int)(tmp.length);
}
formats ~= 0;
}
dbDebug("%s.execPrepared QueryID: %s, Params: %s", typeid(this), _queryId, params);
_handle = PQexecPrepared(_driver._handle,
cast(char*)toStringz(_queryId),
nParams,
values.ptr,
lengths.ptr,
formats.ptr,
0);
return takeResult();
}
bool fetch()
{
_fieldsValues = null;
if (!isActive)
{
return false;
}
if (_row >= _length)
{
return false;
}
foreach(i, t; _fieldsTypes)
{
if (PQgetisnull(_handle, cast(int)(_row), cast(int)(i)))
{
_fieldsValues ~= Variant(null);
continue;
}
auto str = to!string(cast(char*)(PQgetvalue(_handle, cast(int)(_row), cast(int)(i))));
switch (t)
{
case Type.BOOLOID:
_fieldsValues ~= Variant(str == "t");
continue;
case Type.INT2OID:
case Type.INT4OID:
_fieldsValues ~= Variant(to!int(str));
continue;
case Type.INT8OID:
_fieldsValues ~= Variant(to!int(str));
continue;
case Type.FLOAT4OID:
case Type.FLOAT8OID:
_fieldsValues ~= Variant(to!double(str));
continue;
case Type.NUMERICOID:
_fieldsValues ~= Variant(to!real(str));
continue;
case Type.DATEOID:
_fieldsValues ~= Variant(Date.fromISOExtString(str));
continue;
case Type.TIMESTAMPOID:
_fieldsValues ~= Variant(SysTime.fromISOExtString(str.replace(" ", "T")));
continue;
case Type.TIMESTAMPTZOID:
_fieldsValues ~= Variant(SysTime.fromISOExtString(str.replace(" ", "T")));
continue;
case 1015:
_fieldsValues ~= Variant(str[1 .. $ - 1].split(","));
continue;
case Type.CHAROID:
case Type.VARCHAROID:
case Type.TEXTOID:
default:
_fieldsValues ~= Variant(str);
}
}
return true;
}
void clear()
{
if (_handle !is null)
{
PQclear(_handle);
_handle = null;
}
cleanup(isPrepared);
}
private bool takeResult()
{
if (!isActive)
{
return false;
}
switch(PQresultStatus(_handle))
{
case ExecStatusType.PGRES_COMMAND_OK:
return true;
case ExecStatusType.PGRES_TUPLES_OK:
_length = PQntuples(_handle);
_fieldsCount = PQnfields(_handle);
for (ulong i = 0; i < _fieldsCount; ++i)
{
auto fName = to!string(PQfname(_handle, cast(int) i));
_fieldsTypes ~= PQftype(_handle, cast(int) i);
_fieldsNames ~= fName;
_fieldsMap[fName] = i;
}
if (_length)
{
fetch();
// _firstFetched = false;
}
return true;
default:
}
errorTake(DbError.Type.statement);
return false;
}
private void errorTake(DbError.Type t)
{
_error = DbError(t, to!string(PQerrorMessage(_driver._handle)));
}
private void queryIdClear()
{
if (!_queryId.length)
{
return;
}
_driver.exec("DEALLOCATE " ~ _queryId);
_queryId.length = 0;
}
private void queryIdGen()
{
_queryId = "qid_" ~ to!string(randomUUID())[0 .. 8];
}
private string formatValue(Variant v)
{
if (v.type == typeid(null))
{
return "NULL";
}
if (v.type == typeid(bool))
{
return v.get!bool ? "TRUE" : "FALSE";
}
return to!string(v);
}
}
enum Type {
BOOLOID = 16,
BYTEAOID = 17,
CHAROID = 18,
// NAMEOID 19
INT8OID = 20,
INT2OID = 21,
INT2VECTOROID = 22,
INT4OID = 23,
// REGPROCOID 24
TEXTOID = 25,
// OIDOID 26
// TIDOID 27
// XIDOID 28
// CIDOID 29
// OIDVECTOROID 30
JSONOID = 114,
// XMLOID 142
// PGNODETREEOID 194
// POINTOID 600
// LSEGOID 601
// PATHOID 602
// BOXOID 603
// POLYGONOID 604
// LINEOID 628
FLOAT4OID = 700,
FLOAT8OID = 701,
// ABSTIMEOID 702
// RELTIMEOID 703
// TINTERVALOID 704
// UNKNOWNOID 705
// CIRCLEOID 718
// CASHOID 790
// MACADDROID 829
// INETOID 869
// CIDROID 650
INT2ARRAYOID = 1005,
INT4ARRAYOID = 1007,
TEXTARRAYOID = 1009,
// OIDARRAYOID 1028
FLOAT4ARRAYOID = 1021,
// ACLITEMOID 1033
// CSTRINGARRAYOID 1263
// BPCHAROID 1042
VARCHAROID = 1043,
DATEOID = 1082,
TIMEOID = 1083,
TIMESTAMPOID = 1114,
TIMESTAMPTZOID = 1184,
// INTERVALOID 1186
// TIMETZOID 1266
// BITOID 1560
// VARBITOID 1562
NUMERICOID = 1700,
// REFCURSOROID 1790
// REGPROCEDUREOID 2202
// REGOPEROID 2203
// REGOPERATOROID 2204
// REGCLASSOID 2205
// REGTYPEOID 2206
// REGTYPEARRAYOID 2211
// UUIDOID 2950
// LSNOID 3220
// TSVECTOROID 3614
// GTSVECTOROID 3642
// TSQUERYOID 3615
// REGCONFIGOID 3734
// REGDICTIONARYOID 3769
JSONBOID = 3802,
// INT4RANGEOID 3904
// RECORDOID 2249
// RECORDARRAYOID 2287
// CSTRINGOID 2275
// ANYOID 2276
// ANYARRAYOID 2277
// VOIDOID 2278
// TRIGGEROID 2279
// EVTTRIGGEROID 3838
// LANGUAGE_HANDLEROID 2280
// INTERNALOID 2281
// OPAQUEOID 2282
// ANYELEMENTOID 2283
// ANYNONARRAYOID 2776
// ANYENUMOID 3500
// FDW_HANDLEROID 3115
// ANYRANGEOID 3831
}
|
D
|
/***********************************************************************\
* winuser.d *
* *
* Windows API header module *
* *
* Translated from MinGW Windows headers *
* *
* Placed into public domain *
\***********************************************************************/
module win32.winuser;
//pragma(lib, "user32.lib");
pragma(lib, "dinrus.lib");
// Conversion Notes:
// The following macros were for win16 only, and are not included in this file:
//#define EnumTaskWindows(h, f, p) EnumThreadWindows((DWORD)h, f, p)
//#define PostAppMessageA(t, m, w, l) PostThreadMessageA((DWORD)t, m, w, l)
//#define PostAppMessageW(t, m, w, l) PostThreadMessageW((DWORD)t, m, w, l)
//#define GetSysModalWindow() (NULL)
//#define SetSysModalWindow(h) (NULL)
//#define GetWindowTask(hWnd) ((HANDLE)GetWindowThreadProcessId(hWnd, NULL))
//#define DefHookProc(c, p, lp, h) CallNextHookEx((HHOOK)*h, c, p, lp)
private import win32.w32api, win32.winbase, win32.wingdi;
private import win32.windef; // for HMONITOR
// FIXME: clean up Windows version support
template MAKEINTATOM_T(int i) {
const LPTSTR MAKEINTATOM_T = cast(LPTSTR) i;
}
const WC_DIALOG = MAKEINTATOM_T!(0x8002);
const FVIRTKEY = 1;
const FNOINVERT = 2;
const FШИФТ = 4;
const FCONTROL = 8;
const FALT = 16;
const ATF_TIMEOUTON = 1;
const ATF_ONOFFFEEDBACK = 2;
const ATF_AVAILABLE = 4; // May be obsolete. Not in recent MS docs.
const WH_MIN = -1;
const WH_MSGFILTER = -1;
const WH_JOURNALRECORD = 0;
const WH_JOURNALPLAYBACK = 1;
const WH_KEYBOARD = 2;
const WH_GETMESSAGE = 3;
const WH_CALLWNDPROC = 4;
const WH_CBT = 5;
const WH_SYSMSGFILTER = 6;
const WH_MOUSE = 7;
const WH_HARDWARE = 8;
const WH_DEBUG = 9;
const WH_SHELL = 10;
const WH_FOREGROUNDIDLE = 11;
const WH_CALLWNDPROCRET = 12;
const WH_KEYBOARD_LL = 13;
const WH_MOUSE_LL = 14;
const WH_MAX = 14;
const WH_MINHOOK = WH_MIN;
const WH_MAXHOOK = WH_MAX;
enum {
HC_ACTION = 0,
HC_GETNEXT,
HC_SKIP,
HC_NOREMOVE, // = 3
HC_NOREM = HC_NOREMOVE,
HC_SYSMODALON,
HC_SYSMODALOFF
}
enum {
HCBT_MOVESIZE = 0,
HCBT_MINMAX,
HCBT_QS,
HCBT_CREATEWND,
HCBT_DESTROYWND,
HCBT_ACTIVATE,
HCBT_CLICKSKIPPED,
HCBT_KEYSKIPPED,
HCBT_SYSCOMMAND,
HCBT_SETFOCUS // = 9
}
enum {
CF_TEXT = 1,
CF_BITMAP,
CF_METAFILEPICT,
CF_SYLK,
CF_DIF,
CF_TIFF,
CF_OEMTEXT,
CF_DIB,
CF_PALETTE,
CF_PENDATA,
CF_RIFF,
CF_WAVE,
CF_UNICODETEXT,
CF_ENHMETAFILE,
CF_HDROP,
CF_LOCALE,
CF_MAX, // = 17
CF_OWNERDISPLAY = 128,
CF_DSPTEXT,
CF_DSPBITMAP,
CF_DSPMETAFILEPICT, // = 131
CF_DSPENHMETAFILE = 142,
CF_PRIVATEFIRST = 512,
CF_PRIVATELAST = 767,
CF_GDIOBJFIRST = 768,
CF_GDIOBJLAST = 1023
}
const HKL_PREV = 0;
const HKL_NEXT = 1;
const KLF_ACTIVATE = 1;
const KLF_SUBSTITUTE_OK = 2;
const KLF_UNLOADPREVIOUS = 4;
const KLF_REORDER = 8;
const KLF_REPLACELANG = 16;
const KLF_NOTELLSHELL = 128;
const KLF_SETFORPROCESS = 256;
const KL_NAMELENGTH = 9;
const MF_ENABLED = 0;
const MF_GRAYED = 1;
const MF_DISABLED = 2;
const MF_BITMAP = 4;
const MF_CHECKED = 8;
const MF_MENUBARBREAK = 32;
const MF_MENUBREAK = 64;
const MF_OWNERDRAW = 256;
const MF_POPUP = 16;
const MF_SEPARATOR = 0x800;
const MF_STRING = 0;
const MF_UNCHECKED = 0;
const MF_DEFAULT = 4096;
const MF_SYSMENU = 0x2000;
const MF_HELP = 0x4000;
const MF_END = 128;
const MF_RIGHTJUSTIFY = 0x4000;
const MF_MOUSESELECT = 0x8000;
const MF_INSERT = 0;
const MF_CHANGE = 128;
const MF_APPEND = 256;
const MF_DELETE = 512;
const MF_REMOVE = 4096;
const MF_USECHECKBITMAPS = 512;
const MF_UNHILITE = 0;
const MF_HILITE = 128;
// Also defined in dbt.h
const BSM_ALLCOMPONENTS = 0;
const BSM_VXDS = 1;
const BSM_NETDRIVER = 2;
const BSM_INSTALLABLEDRIVERS = 4;
const BSM_APPLICATIONS = 8;
const BSM_ALLDESKTOPS = 16;
const BSF_QUERY = 0x00000001;
const BSF_IGNORECURRENTTASK = 0x00000002;
const BSF_FLUSHDISK = 0x00000004;
const BSF_NOHANG = 0x00000008;
const BSF_POSTMESSAGE = 0x00000010;
const BSF_FORCEIFHUNG = 0x00000020;
const BSF_NOTIMEOUTIFNOTHUNG = 0x00000040;
static if (_WIN32_WINNT >= 0x500) {
const BSF_ALLOWSFW = 0x00000080;
const BSF_SENDNOTIFYMESSAGE = 0x00000100;
}
static if (_WIN32_WINNT >= 0x501) {
const BSF_RETURNHDESK = 0x00000200;
const BSF_LUID = 0x00000400;
}
const BROADCAST_QUERY_DENY = 1112363332;
const DWORD ENUM_CURRENT_SETTINGS = -1;
const DWORD ENUM_REGISTRY_SETTINGS = -2;
const CDS_UPDATEREGISTRY = 1;
const CDS_TEST = 2;
const CDS_FULLSCREEN = 4;
const CDS_GLOBAL = 8;
const CDS_SET_PRIMARY = 16;
const CDS_NORESET = 0x10000000;
const CDS_SETRECT = 0x20000000;
const CDS_RESET = 0x40000000;
const DISP_CHANGE_RESTART = 1;
const DISP_CHANGE_SUCCESSFUL = 0;
const DISP_CHANGE_FAILED = -1;
const DISP_CHANGE_BADMODE = -2;
const DISP_CHANGE_NOTUPDATED = -3;
const DISP_CHANGE_BADFLAGS = -4;
const DISP_CHANGE_BADPARAM = -5;
const BST_UNCHECKED = 0;
const BST_CHECKED = 1;
const BST_INDETERMINATE = 2;
const BST_PUSHED = 4;
const BST_FOCUS = 8;
const MF_BYCOMMAND = 0;
const MF_BYPOSITION = 1024;
// [Redefined] MF_UNCHECKED=0
// [Redefined] MF_HILITE=128
// [Redefined] MF_UNHILITE=0
const CWP_ALL = 0;
const CWP_SKIPINVISIBLE = 1;
const CWP_SKIPDISABLED = 2;
const CWP_SKIPTRANSPARENT = 4;
const IMAGE_BITMAP=0;
const IMAGE_ICON=1;
const IMAGE_CURSOR=2;
const IMAGE_ENHMETAFILE=3;
const DF_ALLOWOTHERACCOUNTHOOK = 1;
const DESKTOP_READOBJECTS = 1;
const DESKTOP_CREATEWINDOW = 2;
const DESKTOP_CREATEMENU = 4;
const DESKTOP_HOOKCONTROL = 8;
const DESKTOP_JOURNALRECORD = 16;
const DESKTOP_JOURNALPLAYBACK = 32;
const DESKTOP_ENUMERATE = 64;
const DESKTOP_WRITEOBJECTS = 128;
const DESKTOP_SWITCHDESKTOP = 256;
const CW_USEDEFAULT = 0x80000000;
enum {
WS_OVERLAPPED = 0,
WS_TILED = WS_OVERLAPPED,
WS_MAXIMIZEBOX = 0x00010000,
WS_MINIMIZEBOX = 0x00020000,
WS_TABSTOP = 0x00010000,
WS_GROUP = 0x00020000,
WS_THICKFRAME = 0x00040000,
WS_SIZEBOX = WS_THICKFRAME,
WS_SYSMENU = 0x00080000,
WS_HSCROLL = 0x00100000,
WS_VSCROLL = 0x00200000,
WS_DLGFRAME = 0x00400000,
WS_BORDER = 0x00800000,
WS_CAPTION = 0x00c00000,
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX,
WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
WS_MAXIMIZE = 0x01000000,
WS_CLIPCHILDREN = 0x02000000,
WS_CLIPSIBLINGS = 0x04000000,
WS_DISABLED = 0x08000000,
WS_VISIBLE = 0x10000000,
WS_MINIMIZE = 0x20000000,
WS_ICONIC = WS_MINIMIZE,
WS_CHILD = 0x40000000,
WS_CHILDWINDOW = 0x40000000,
WS_POPUP = 0x80000000,
WS_POPUPWINDOW = WS_POPUP|WS_BORDER|WS_SYSMENU,
}
const MDIS_ALLCHILDSTYLES = 1;
const BS_3STATE = 5;
const BS_AUTO3STATE = 6;
const BS_AUTOCHECKBOX = 3;
const BS_AUTORADIOBUTTON = 9;
const BS_BITMAP = 128;
const BS_BOTTOM = 0x800;
const BS_CENTER = 0x300;
const BS_CHECKBOX = 2;
const BS_DEFPUSHBUTTON = 1;
const BS_GROUPBOX = 7;
const BS_ICON = 64;
const BS_LEFT = 256;
const BS_LEFTTEXT = 32;
const BS_MULTILINE = 0x2000;
const BS_NOTIFY = 0x4000;
const BS_OWNERDRAW = 0xb;
const BS_PUSHBUTTON = 0;
const BS_PUSHLIKE = 4096;
const BS_RADIOBUTTON = 4;
const BS_RIGHT = 512;
const BS_RIGHTBUTTON = 32;
const BS_TEXT = 0;
const BS_TOP = 0x400;
const BS_USERBUTTON = 8;
const BS_VCENTER = 0xc00;
const BS_FLAT = 0x8000;
const CBS_AUTOHSCROLL = 64;
const CBS_DISABLENOSCROLL = 0x800;
const CBS_DROPDOWN = 2;
const CBS_DROPDOWNLIST = 3;
const CBS_HASSTRINGS = 512;
const CBS_LOWERCASE = 0x4000;
const CBS_NOINTEGRALHEIGHT = 0x400;
const CBS_OEMCONVERT = 128;
const CBS_OWNERDRAWFIXED = 16;
const CBS_OWNERDRAWVARIABLE = 32;
const CBS_SIMPLE = 1;
const CBS_SORT = 256;
const CBS_UPPERCASE = 0x2000;
const ES_AUTOHSCROLL = 128;
const ES_AUTOVSCROLL = 64;
const ES_CENTER = 1;
const ES_LEFT = 0;
const ES_LOWERCASE = 16;
const ES_MULTILINE = 4;
const ES_NOHIDESEL = 256;
const ES_NUMBER = 0x2000;
const ES_OEMCONVERT = 0x400;
const ES_PASSWORD = 32;
const ES_READONLY = 0x800;
const ES_RIGHT = 2;
const ES_UPPERCASE = 8;
const ES_WANTRETURN = 4096;
const LBS_DISABLENOSCROLL = 4096;
const LBS_EXTENDEDSEL = 0x800;
const LBS_HASSTRINGS = 64;
const LBS_MULTICOLUMN = 512;
const LBS_MULTIPLESEL = 8;
const LBS_NODATA = 0x2000;
const LBS_NOINTEGRALHEIGHT = 256;
const LBS_NOREDRAW = 4;
const LBS_NOSEL = 0x4000;
const LBS_NOTIFY = 1;
const LBS_OWNERDRAWFIXED = 16;
const LBS_OWNERDRAWVARIABLE = 32;
const LBS_SORT = 2;
const LBS_STANDARD = 0xa00003;
const LBS_USETABSTOPS = 128;
const LBS_WANTKEYBOARDINPUT = 0x400;
const SBS_BOTTOMALIGN = 4;
const SBS_HORZ = 0;
const SBS_LEFTALIGN = 2;
const SBS_RIGHTALIGN = 4;
const SBS_SIZEBOX = 8;
const SBS_SIZEBOXBOTTOMRIGHTALIGN = 4;
const SBS_SIZEBOXTOPLEFTALIGN = 2;
const SBS_SIZEGRIP = 16;
const SBS_TOPALIGN = 2;
const SBS_VERT = 1;
const SS_BITMAP = 14;
const SS_BLACKFRAME = 7;
const SS_BLACKRECT = 4;
const SS_CENTER = 1;
const SS_CENTERIMAGE = 512;
const SS_ENHMETAFILE = 15;
const SS_ETCHEDFRAME = 18;
const SS_ETCHEDHORZ = 16;
const SS_ETCHEDVERT = 17;
const SS_GRAYFRAME = 8;
const SS_GRAYRECT = 5;
const SS_ICON = 3;
const SS_LEFT = 0;
const SS_LEFTNOWORDWRAP = 0xc;
const SS_NOPREFIX = 128;
const SS_NOTIFY = 256;
const SS_OWNERDRAW = 0xd;
const SS_REALSIZEIMAGE = 0x800;
const SS_RIGHT = 2;
const SS_RIGHTJUST = 0x400;
const SS_SIMPLE = 11;
const SS_SUNKEN = 4096;
const SS_WHITEFRAME = 9;
const SS_WHITERECT = 6;
const SS_USERITEM = 10;
const SS_TYPEMASK = 0x0000001FL;
const SS_ENDELLIPSIS = 0x00004000L;
const SS_PATHELLIPSIS = 0x00008000L;
const SS_WORDELLIPSIS = 0x0000C000L;
const SS_ELLIPSISMASK = 0x0000C000L;
const DS_ABSALIGN = 0x0001;
const DS_3DLOOK = 0x0004;
const DS_SYSMODAL = 0x0002;
const DS_FIXEDSYS = 0x0008;
const DS_NOFAILCREATE = 0x0010;
const DS_LOCALEDIT = 0x0020;
const DS_SETFONT = 0x0040;
const DS_MODALFRAME = 0x0080;
const DS_NOIDLEMSG = 0x0100;
const DS_SETFOREGROUND = 0x0200;
const DS_CONTROL = 0x0400;
const DS_CENTER = 0x0800;
const DS_CENTERMOUSE = 0x1000;
const DS_CONTEXTHELP = 0x2000;
const DS_SHELLFONT = DS_SETFONT | DS_FIXEDSYS;
const WS_EX_ACCEPTFILES = 16;
const WS_EX_APPWINDOW = 0x40000;
const WS_EX_CLIENTEDGE = 512;
const WS_EX_COMPOSITED = 0x2000000; // XP
const WS_EX_CONTEXTHELP = 0x400;
const WS_EX_CONTROLPARENT = 0x10000;
const WS_EX_DLGMODALFRAME = 1;
const WS_EX_LAYERED = 0x80000; // w2k
const WS_EX_LAYOUTRTL = 0x400000; // w98, w2k
const WS_EX_LEFT = 0;
const WS_EX_LEFTSCROLLBAR = 0x4000;
const WS_EX_LTRREADING = 0;
const WS_EX_MDICHILD = 64;
const WS_EX_NOACTIVATE = 0x8000000; // w2k
const WS_EX_NOINHERITLAYOUT = 0x100000; // w2k
const WS_EX_NOPARENTNOTIFY = 4;
const WS_EX_OVERLAPPEDWINDOW = 0x300;
const WS_EX_PALETTEWINDOW = 0x188;
const WS_EX_RIGHT = 0x1000;
const WS_EX_RIGHTSCROLLBAR = 0;
const WS_EX_RTLREADING = 0x2000;
const WS_EX_STATICEDGE = 0x20000;
const WS_EX_TOOLWINDOW = 128;
const WS_EX_TOPMOST = 8;
const WS_EX_TRANSPARENT = 32;
const WS_EX_WINDOWEDGE = 256;
const WINSTA_ENUMDESKTOPS = 1;
const WINSTA_READATTRIBUTES = 2;
const WINSTA_ACCESSCLIPBOARD = 4;
const WINSTA_CREATEDESKTOP = 8;
const WINSTA_WRITEATTRIBUTES = 16;
const WINSTA_ACCESSGLOBALATOMS = 32;
const WINSTA_EXITWINDOWS = 64;
const WINSTA_ENUMERATE = 256;
const WINSTA_READSCREEN = 512;
const DDL_READWRITE = 0;
const DDL_READONLY = 1;
const DDL_HIDDEN = 2;
const DDL_SYSTEM = 4;
const DDL_DIRECTORY = 16;
const DDL_ARCHIVE = 32;
const DDL_POSTMSGS = 8192;
const DDL_DRIVES = 16384;
const DDL_EXCLUSIVE = 32768;
const DC_ACTIVE = 0x00000001;
const DC_SMALLCAP = 0x00000002;
const DC_ICON = 0x00000004;
const DC_TEXT = 0x00000008;
const DC_INBUTTON = 0x00000010;
static if (WINVER >= 0x500) {
const DC_GRADIENT=0x00000020;
}
static if (_WIN32_WINNT >= 0x501) {
const DC_BUTTONS=0x00001000;
}
// Where are these documented?
//const DC_CAPTION = DC_ICON|DC_TEXT|DC_BUTTONS;
//const DC_NC = DC_CAPTION|DC_FRAME;
const BDR_RAISEDOUTER = 1;
const BDR_SUNKENOUTER = 2;
const BDR_RAISEDINNER = 4;
const BDR_SUNKENINNER = 8;
const BDR_OUTER = 3;
const BDR_INNER = 0xc;
const BDR_RAISED = 5;
const BDR_SUNKEN = 10;
const EDGE_RAISED = BDR_RAISEDOUTER|BDR_RAISEDINNER;
const EDGE_SUNKEN = BDR_SUNKENOUTER|BDR_SUNKENINNER;
const EDGE_ETCHED = BDR_SUNKENOUTER|BDR_RAISEDINNER;
const EDGE_BUMP = BDR_RAISEDOUTER|BDR_SUNKENINNER;
const BF_LEFT = 1;
const BF_TOP = 2;
const BF_RIGHT = 4;
const BF_BOTTOM = 8;
const BF_TOPLEFT = BF_TOP|BF_LEFT;
const BF_TOPRIGHT = BF_TOP|BF_RIGHT;
const BF_BOTTOMLEFT = BF_BOTTOM|BF_LEFT;
const BF_BOTTOMRIGHT = BF_BOTTOM|BF_RIGHT;
const BF_RECT = BF_LEFT|BF_TOP|BF_RIGHT|BF_BOTTOM ;
const BF_DIAGONAL = 16;
const BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL|BF_TOP|BF_RIGHT;
const BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL|BF_TOP|BF_LEFT;
const BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL|BF_BOTTOM|BF_LEFT;
const BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL|BF_BOTTOM|BF_RIGHT;
const BF_MIDDLE = 0x800;
const BF_SOFT = 0x1000;
const BF_ADJUST = 0x2000;
const BF_FLAT = 0x4000;
const BF_MONO = 0x8000;
const DFC_CAPTION=1;
const DFC_MENU=2;
const DFC_SCROLL=3;
const DFC_BUTTON=4;
static if (WINVER >= 0x500) {
const DFC_POPUPMENU=5;
}// WINVER >= 0x500
const DFCS_CAPTIONCLOSE = 0;
const DFCS_CAPTIONMIN = 1;
const DFCS_CAPTIONMAX = 2;
const DFCS_CAPTIONRESTORE = 3;
const DFCS_CAPTIONHELP = 4;
const DFCS_MENUARROW = 0;
const DFCS_MENUCHECK = 1;
const DFCS_MENUBULLET = 2;
const DFCS_MENUARROWRIGHT = 4;
const DFCS_SCROLLUP = 0;
const DFCS_SCROLLDOWN = 1;
const DFCS_SCROLLLEFT = 2;
const DFCS_SCROLLRIGHT = 3;
const DFCS_SCROLLCOMBOBOX = 5;
const DFCS_SCROLLSIZEGRIP = 8;
const DFCS_SCROLLSIZEGRIPRIGHT = 16;
const DFCS_BUTTONCHECK = 0;
const DFCS_BUTTONRADIOIMAGE = 1;
const DFCS_BUTTONRADIOMASK = 2;
const DFCS_BUTTONRADIO = 4;
const DFCS_BUTTON3STATE = 8;
const DFCS_BUTTONPUSH = 16;
const DFCS_INACTIVE = 256;
const DFCS_PUSHED = 512;
const DFCS_CHECKED = 1024;
static if (WINVER >= 0x500) {
const DFCS_TRANSPARENT = 0x800;
const DFCS_HOT = 0x1000;
}
const DFCS_ADJUSTRECT = 0x2000;
const DFCS_FLAT = 0x4000;
const DFCS_MONO = 0x8000;
enum {
DST_COMPLEX = 0,
DST_TEXT,
DST_PREFIXTEXT,
DST_ICON,
DST_BITMAP // = 4
}
const DSS_NORMAL = 0;
const DSS_UNION = 16;
const DSS_DISABLED = 32;
const DSS_MONO = 128;
const DSS_RIGHT = 0x8000;
const DT_BOTTOM = 8;
const DT_CALCRECT = 1024;
const DT_CENTER = 1;
const DT_EDITCONTROL = 8192;
const DT_END_ELLIPSIS = 32768;
const DT_PATH_ELLIPSIS = 16384;
const DT_WORD_ELLIPSIS = 0x40000;
const DT_EXPANDTABS = 64;
const DT_EXTERNALLEADING = 512;
const DT_LEFT = 0;
const DT_MODIFYSTRING = 65536;
const DT_NOCLIP = 256;
const DT_NOPREFIX = 2048;
const DT_RIGHT = 2;
const DT_RTLREADING = 131072;
const DT_SINGLELINE = 32;
const DT_TABSTOP = 128;
const DT_TOP = 0;
const DT_VCENTER = 4;
const DT_WORDBREAK = 16;
const DT_INTERNAL = 4096;
const WB_ISDELIMITER = 2;
const WB_LEFT = 0;
const WB_RIGHT = 1;
const SB_HORZ = 0;
const SB_VERT = 1;
const SB_CTL = 2;
const SB_BOTH = 3;
const ESB_DISABLE_BOTH = 3;
const ESB_DISABLE_DOWN = 2;
const ESB_DISABLE_LEFT = 1;
const ESB_DISABLE_LTUP = 1;
const ESB_DISABLE_RIGHT = 2;
const ESB_DISABLE_RTDN = 2;
const ESB_DISABLE_UP = 1;
const ESB_ENABLE_BOTH = 0;
const SB_LINEUP = 0;
const SB_LINEDOWN = 1;
const SB_LINELEFT = 0;
const SB_LINERIGHT = 1;
const SB_PAGEUP = 2;
const SB_PAGEDOWN = 3;
const SB_PAGELEFT = 2;
const SB_PAGERIGHT = 3;
const SB_THUMBPOSITION = 4;
const SB_THUMBTRACK = 5;
const SB_ENDSCROLL = 8;
const SB_LEFT = 6;
const SB_RIGHT = 7;
const SB_BOTTOM = 7;
const SB_TOP = 6;
//MACRO #define IS_INTRESOURCE(i) (((ULONG_PTR)(i) >> 16) == 0)
template MAKEINTRESOURCE_T (WORD i)
{
const LPTSTR MAKEINTRESOURCE_T = cast(LPTSTR)(i);
}
LPSTR MAKEINTRESOURCEA(WORD i)
{
return cast(LPSTR)(i);
}
LPWSTR MAKEINTRESOURCEW(WORD i)
{
return cast(LPWSTR)(i);
}
const RT_CURSOR = MAKEINTRESOURCE_T!(1);
const RT_BITMAP = MAKEINTRESOURCE_T!(2);
const RT_ICON = MAKEINTRESOURCE_T!(3);
const RT_MENU = MAKEINTRESOURCE_T!(4);
const RT_DIALOG = MAKEINTRESOURCE_T!(5);
const RT_STRING = MAKEINTRESOURCE_T!(6);
const RT_FONTDIR = MAKEINTRESOURCE_T!(7);
const RT_FONT = MAKEINTRESOURCE_T!(8);
const RT_ACCELERATOR = MAKEINTRESOURCE_T!(9);
const RT_RCDATA = MAKEINTRESOURCE_T!(10);
const RT_MESSAGETABLE = MAKEINTRESOURCE_T!(11);
const RT_GROUP_CURSOR = MAKEINTRESOURCE_T!(12);
const RT_GROUP_ICON = MAKEINTRESOURCE_T!(14);
const RT_VERSION = MAKEINTRESOURCE_T!(16);
const RT_DLGINCLUDE = MAKEINTRESOURCE_T!(17);
const RT_PLUGPLAY = MAKEINTRESOURCE_T!(19);
const RT_VXD = MAKEINTRESOURCE_T!(20);
const RT_ANICURSOR = MAKEINTRESOURCE_T!(21);
const RT_ANIICON = MAKEINTRESOURCE_T!(22);
const RT_HTML = MAKEINTRESOURCE_T!(23);
const RT_MANIFEST = MAKEINTRESOURCE_T!(24);
const CREATEPROCESS_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE_T!(1);
const ISOLATIONAWARE_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE_T!(2);
const ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE_T!(3);
const EWX_LOGOFF = 0;
const EWX_SHUTDOWN = 1;
const EWX_REBOOT = 2;
const EWX_FORCE = 4;
const EWX_POWEROFF = 8;
static if (_WIN32_WINNT >= 0x500) {
const EWX_FORCEIFHUNG = 16;
}
const CS_BYTEALIGNCLIENT = 4096;
const CS_BYTEALIGNWINDOW = 8192;
const CS_KEYCVTWINDOW = 4;
const CS_NOKEYCVT = 256;
const CS_CLASSDC = 64;
const CS_DBLCLKS = 8;
const CS_GLOBALCLASS = 16384;
const CS_HREDRAW = 2;
const CS_NOCLOSE = 512;
const CS_OWNDC = 32;
const CS_PARENTDC = 128;
const CS_SAVEBITS = 2048;
const CS_VREDRAW = 1;
const CS_IME = 0x10000;
const GCW_ATOM = -32;
const GCL_CBCLSEXTRA = -20;
const GCL_CBWNDEXTRA = -18;
const GCL_HBRBACKGROUND = -10;
const GCL_HCURSOR = -12;
const GCL_HICON = -14;
const GCL_HICONSM = -34;
const GCL_HMODULE = -16;
const GCL_MENUNAME = -8;
const GCL_STYLE = -26;
const GCL_WNDPROC = -24;
alias GCL_HICONSM GCLP_HICONSM;
alias GCL_HICON GCLP_HICON;
alias GCL_HCURSOR GCLP_HCURSOR;
alias GCL_HBRBACKGROUND GCLP_HBRBACKGROUND;
alias GCL_HMODULE GCLP_HMODULE;
alias GCL_MENUNAME GCLP_MENUNAME;
alias GCL_WNDPROC GCLP_WNDPROC;
const IDC_ARROW = MAKEINTRESOURCE_T!(32512);
const IDC_IBEAM = MAKEINTRESOURCE_T!(32513);
const IDC_WAIT = MAKEINTRESOURCE_T!(32514);
const IDC_CROSS = MAKEINTRESOURCE_T!(32515);
const IDC_UPARROW = MAKEINTRESOURCE_T!(32516);
const IDC_SIZENWSE = MAKEINTRESOURCE_T!(32642);
const IDC_SIZENESW = MAKEINTRESOURCE_T!(32643);
const IDC_SIZEWE = MAKEINTRESOURCE_T!(32644);
const IDC_SIZENS = MAKEINTRESOURCE_T!(32645);
const IDC_SIZEALL = MAKEINTRESOURCE_T!(32646);
const IDC_NO = MAKEINTRESOURCE_T!(32648);
const IDC_HAND = MAKEINTRESOURCE_T!(32649);
const IDC_APPSTARTING = MAKEINTRESOURCE_T!(32650);
const IDC_HELP = MAKEINTRESOURCE_T!(32651);
const IDC_ICON = MAKEINTRESOURCE_T!(32641);
const IDC_SIZE = MAKEINTRESOURCE_T!(32640);
const IDI_APPLICATION = MAKEINTRESOURCE_T!(32512);
const IDI_HAND = MAKEINTRESOURCE_T!(32513);
const IDI_QUESTION = MAKEINTRESOURCE_T!(32514);
const IDI_EXCLAMATION = MAKEINTRESOURCE_T!(32515);
const IDI_ASTERISK = MAKEINTRESOURCE_T!(32516);
const IDI_WINLOGO = MAKEINTRESOURCE_T!(32517);
const IDI_WARNING = IDI_EXCLAMATION;
const IDI_ERROR = IDI_HAND;
const IDI_INFORMATION = IDI_ASTERISK;
const MIIM_STATE = 1;
const MIIM_ID = 2;
const MIIM_SUBMENU = 4;
const MIIM_CHECKMARKS = 8;
const MIIM_TYPE = 16;
const MIIM_DATA = 32;
const MIIM_STRING = 64;
const MIIM_BITMAP = 128;
const MIIM_FTYPE = 256;
static if (WINVER >= 0x500) {
const MIM_MAXHEIGHT = 1;
const MIM_BACKGROUND = 2;
const MIM_HELPID = 4;
const MIM_MENUDATA = 8;
const MIM_STYLE = 16;
const MIM_APPLYTOSUBMENUS = 0x80000000L;
const MNS_NOCHECK = 0x80000000;
const MNS_MODELESS = 0x40000000;
const MNS_DRAGDROP = 0x20000000;
const MNS_AUTODISMISS = 0x10000000;
const MNS_NOTIFYBYPOS = 0x08000000;
const MNS_CHECKORBMP = 0x04000000;
}
const MFT_BITMAP = 4;
const MFT_MENUBARBREAK = 32;
const MFT_MENUBREAK = 64;
const MFT_OWNERDRAW = 256;
const MFT_RADIOCHECK = 512;
const MFT_RIGHTJUSTIFY = 0x4000;
const MFT_SEPARATOR = 0x800;
const MFT_RIGHTORDER = 0x2000L;
const MFT_STRING = 0;
const MFS_CHECKED = 8;
const MFS_DEFAULT = 4096;
const MFS_DISABLED = 3;
const MFS_ENABLED = 0;
const MFS_GRAYED = 3;
const MFS_HILITE = 128;
const MFS_UNCHECKED = 0;
const MFS_UNHILITE = 0;
const GW_HWNDNEXT = 2;
const GW_HWNDPREV = 3;
const GW_CHILD = 5;
const GW_HWNDFIRST = 0;
const GW_HWNDLAST = 1;
const GW_OWNER = 4;
const SW_HIDE = 0;
const SW_NORMAL = 1;
const SW_SHOWNORMAL = 1;
const SW_SHOWMINIMIZED = 2;
const SW_MAXIMIZE = 3;
const SW_SHOWMAXIMIZED = 3;
const SW_SHOWNOACTIVATE = 4;
const SW_SHOW = 5;
const SW_MINIMIZE = 6;
const SW_SHOWMINNOACTIVE = 7;
const SW_SHOWNA = 8;
const SW_RESTORE = 9;
const SW_SHOWDEFAULT = 10;
const SW_FORCEMINIMIZE = 11;
const SW_MAX = 11;
const MB_USERICON = 128;
const MB_ICONASTERISK = 64;
const MB_ICONEXCLAMATION = 0x30;
const MB_ICONWARNING = 0x30;
const MB_ICONERROR = 16;
const MB_ICONHAND = 16;
const MB_ICONQUESTION = 32;
const MB_OK = 0;
const MB_ABORTRETRYIGNORE = 2;
const MB_APPLMODAL = 0;
const MB_DEFAULT_DESKTOP_ONLY = 0x20000;
const MB_HELP = 0x4000;
const MB_RIGHT = 0x80000;
const MB_RTLREADING = 0x100000;
const MB_TOPMOST = 0x40000;
const MB_DEFBUTTON1 = 0;
const MB_DEFBUTTON2 = 256;
const MB_DEFBUTTON3 = 512;
const MB_DEFBUTTON4 = 0x300;
const MB_ICONINFORMATION = 64;
const MB_ICONSTOP = 16;
const MB_OKCANCEL = 1;
const MB_RETRYCANCEL = 5;
static if (_WIN32_WINNT_ONLY) {
static if (_WIN32_WINNT >= 0x400) {
const MB_SERVICE_NOTIFICATION = 0x00200000;
} else {
const MB_SERVICE_NOTIFICATION = 0x00040000;
}
const MB_SERVICE_NOTIFICATION_NT3X = 0x00040000;
}
const MB_SETFOREGROUND = 0x10000;
const MB_SYSTEMMODAL = 4096;
const MB_TASKMODAL = 0x2000;
const MB_YESNO = 4;
const MB_YESNOCANCEL = 3;
const MB_ICONMASK = 240;
const MB_DEFMASK = 3840;
const MB_MODEMASK = 0x00003000;
const MB_MISCMASK = 0x0000C000;
const MB_NOFOCUS = 0x00008000;
const MB_TYPEMASK = 15;
// [Redefined] MB_TOPMOST=0x40000
static if (WINVER >= 0x500) {
const MB_CANCELTRYCONTINUE=6;
}
const IDOK = 1;
const IDCANCEL = 2;
const IDABORT = 3;
const IDRETRY = 4;
const IDIGNORE = 5;
const IDYES = 6;
const IDNO = 7;
static if (WINVER >= 0x400) {
const IDCLOSE = 8;
const IDHELP = 9;
}
static if (WINVER >= 0x500) {
const IDTRYAGAIN = 10;
const IDCONTINUE = 11;
}
const GWL_EXSTYLE = -20;
const GWL_STYLE = -16;
const GWL_WNDPROC = -4;
const GWLP_WNDPROC = -4;
const GWL_HINSTANCE = -6;
const GWLP_HINSTANCE = -6;
const GWL_HWNDPARENT = -8;
const GWLP_HWNDPARENT = -8;
const GWL_ID = -12;
const GWLP_ID = -12;
const GWL_USERDATA = -21;
const GWLP_USERDATA = -21;
const DWL_DLGPROC = 4;
const DWLP_DLGPROC = 4;
const DWL_MSGRESULT = 0;
const DWLP_MSGRESULT = 0;
const DWL_USER = 8;
const DWLP_USER = 8;
const QS_KEY = 1;
const QS_MOUSEMOVE = 2;
const QS_MOUSEBUTTON = 4;
const QS_MOUSE = 6;
const QS_POSTMESSAGE = 8;
const QS_TIMER = 16;
const QS_PAINT = 32;
const QS_SENDMESSAGE = 64;
const QS_HOTKEY = 128;
const QS_ALLPOSTMESSAGE = 256;
static if (_WIN32_WINNT >= 0x501) {
const QS_RAWINPUT = 1024;
const QS_INPUT = 1031;
const QS_ALLEVENTS = 1215;
const QS_ALLINPUT = 1279;
} else {
const QS_INPUT = 7;
const QS_ALLEVENTS = 191;
const QS_ALLINPUT = 255;
}
const MWMO_WAITALL = 1;
const MWMO_ALERTABLE = 2;
const MWMO_INPUTAVAILABLE = 4;
const COLOR_3DDKSHADOW=21;
const COLOR_3DFACE=15;
const COLOR_3DHILIGHT=20;
const COLOR_3DHIGHLIGHT=20;
const COLOR_3DLIGHT=22;
const COLOR_BTNHILIGHT=20;
const COLOR_3DSHADOW=16;
const COLOR_ACTIVEBORDER=10;
const COLOR_ACTIVECAPTION=2;
const COLOR_APPWORKSPACE=12;
const COLOR_BACKGROUND=1;
const COLOR_DESKTOP=1;
const COLOR_BTNFACE=15;
const COLOR_BTNHIGHLIGHT=20;
const COLOR_BTNSHADOW=16;
const COLOR_BTNTEXT=18;
const COLOR_CAPTIONTEXT=9;
const COLOR_GRAYTEXT=17;
const COLOR_HIGHLIGHT=13;
const COLOR_HIGHLIGHTTEXT=14;
const COLOR_INACTIVEBORDER=11;
const COLOR_INACTIVECAPTION=3;
const COLOR_INACTIVECAPTIONTEXT=19;
const COLOR_INFOBK=24;
const COLOR_INFOTEXT=23;
const COLOR_MENU=4;
const COLOR_MENUTEXT=7;
const COLOR_SCROLLBAR=0;
const COLOR_WINDOW=5;
const COLOR_WINDOWFRAME=6;
const COLOR_WINDOWTEXT=8;
const COLOR_HOTLIGHT=26;
const COLOR_GRADIENTACTIVECAPTION=27;
const COLOR_GRADIENTINACTIVECAPTION=28;
const CTLCOLOR_MSGBOX=0;
const CTLCOLOR_EDIT=1;
const CTLCOLOR_LISTBOX=2;
const CTLCOLOR_BTN=3;
const CTLCOLOR_DLG=4;
const CTLCOLOR_SCROLLBAR=5;
const CTLCOLOR_STATIC=6;
const CTLCOLOR_MAX=7;
// For GetSystemMetrics()
enum : int {
SM_CXSCREEN = 0,
SM_CYSCREEN,
SM_CXVSCROLL,
SM_CYHSCROLL,
SM_CYCAPTION,
SM_CXBORDER,
SM_CYBORDER,
SM_CXDLGFRAME, // = 7,
SM_CXFIXEDFRAME = SM_CXDLGFRAME,
SM_CYDLGFRAME, // =8,
SM_CYFIXEDFRAME = SM_CYDLGFRAME,
SM_CYVTHUMB = 9,
SM_CXHTHUMB,
SM_CXICON,
SM_CYICON,
SM_CXCURSOR,
SM_CYCURSOR,
SM_CYMENU,
SM_CXFULLSCREEN,
SM_CYFULLSCREEN,
SM_CYKANJIWINDOW,
SM_MOUSEPRESENT,
SM_CYVSCROLL,
SM_CXHSCROLL,
SM_DEBUG,
SM_SWAPBUTTON,
SM_RESERVED1,
SM_RESERVED2,
SM_RESERVED3,
SM_RESERVED4,
SM_CXMIN,
SM_CYMIN,
SM_CXSIZE,
SM_CYSIZE,
SM_CXSIZEFRAME, // = 32,
SM_CXFRAME = SM_CXSIZEFRAME,
SM_CYSIZEFRAME, // = 33
SM_CYFRAME = SM_CYSIZEFRAME,
SM_CXMINTRACK,
SM_CYMINTRACK,
SM_CXDOUBLECLK,
SM_CYDOUBLECLK,
SM_CXICONSPACING,
SM_CYICONSPACING,
SM_MENUDROPALIGNMENT,
SM_PENWINDOWS,
SM_DBCSENABLED,
SM_CMOUSEBUTTONS,
SM_SECURE,
SM_CXEDGE,
SM_CYEDGE,
SM_CXMINSPACING,
SM_CYMINSPACING,
SM_CXSMICON,
SM_CYSMICON,
SM_CYSMCAPTION,
SM_CXSMSIZE,
SM_CYSMSIZE,
SM_CXMENUSIZE,
SM_CYMENUSIZE,
SM_ARRANGE,
SM_CXMINIMIZED,
SM_CYMINIMIZED,
SM_CXMAXTRACK,
SM_CYMAXTRACK,
SM_CXMAXIMIZED,
SM_CYMAXIMIZED,
SM_NETWORK, // = 63
SM_CLEANBOOT = 67,
SM_CXDRAG,
SM_CYDRAG,
SM_SHOWSOUNDS,
SM_CXMENUCHECK,
SM_CYMENUCHECK,
SM_SLOWMACHINE,
SM_MIDEASTENABLED,
// The next values aren't supported in Win95.
SM_MOUSEWHEELPRESENT,
SM_XVIRTUALSCREEN,
SM_YVIRTUALSCREEN,
SM_CXVIRTUALSCREEN,
SM_CYVIRTUALSCREEN,
SM_CMONITORS,
SM_SAMEDISPLAYFORMAT,
SM_IMMENABLED,
SM_CXFOCUSBORDER,
SM_CYFOCUSBORDER, // = 84
SM_TABLETPC = 86,
SM_MEDIACENTER = 87,
SM_REMOTESESSION = 0x1000,
// These are only for WinXP and later
SM_SHUTTINGDOWN = 0x2000,
SM_REMOTECONTROL = 0x2001
}
const ARW_BOTTOMLEFT=0;
const ARW_BOTTOMRIGHT=1;
const ARW_HIDE=8;
const ARW_TOPLEFT=2;
const ARW_TOPRIGHT=3;
const ARW_DOWN=4;
const ARW_LEFT=0;
const ARW_RIGHT=0;
const ARW_UP=4;
const UOI_FLAGS=1;
const UOI_NAME=2;
const UOI_TYPE=3;
const UOI_USER_SID=4;
// For the fuLoad parameter of LoadImage()
enum : UINT {
LR_DEFAULTCOLOR = 0,
LR_MONOCHROME = 1,
LR_COLOR = 2,
LR_COPYRETURNORG = 4,
LR_COPYDELETEORG = 8,
LR_LOADFROMFILE = 16,
LR_LOADTRANSPARENT = 32,
LR_DEFAULTSIZE = 64,
LR_LOADREALSIZE = 128,
LR_LOADMAP3DCOLORS = 4096,
LR_CREATEDIBSECTION = 8192,
LR_COPYFROMRESOURCE = 16384,
LR_SHARED = 32768
}
const KEYEVENTF_EXTENDEDKEY = 0x00000001;
const KEYEVENTF_KEYUP = 00000002;
static if (_WIN32_WINNT >= 0x500) {
const KEYEVENTF_UNICODE = 0x00000004;
const KEYEVENTF_SCANCODE = 0x00000008;
}
const OBM_BTNCORNERS = 32758;
const OBM_BTSIZE = 32761;
const OBM_CHECK = 32760;
const OBM_CHECKBOXES = 32759;
const OBM_CLOSE = 32754;
const OBM_COMBO = 32738;
const OBM_DNARROW = 32752;
const OBM_DNARROWD = 32742;
const OBM_DNARROWI = 32736;
const OBM_LFARROW = 32750;
const OBM_LFARROWI = 32734;
const OBM_LFARROWD = 32740;
const OBM_MNARROW = 32739;
const OBM_OLD_CLOSE = 32767;
const OBM_OLD_DNARROW = 32764;
const OBM_OLD_LFARROW = 32762;
const OBM_OLD_REDUCE = 32757;
const OBM_OLD_RESTORE = 32755;
const OBM_OLD_RGARROW = 32763;
const OBM_OLD_UPARROW = 32765;
const OBM_OLD_ZOOM = 32756;
const OBM_REDUCE = 32749;
const OBM_REDUCED = 32746;
const OBM_RESTORE = 32747;
const OBM_RESTORED = 32744;
const OBM_RGARROW = 32751;
const OBM_RGARROWD = 32741;
const OBM_RGARROWI = 32735;
const OBM_SIZE = 32766;
const OBM_UPARROW = 32753;
const OBM_UPARROWD = 32743;
const OBM_UPARROWI = 32737;
const OBM_ZOOM = 32748;
const OBM_ZOOMD = 32745;
const OCR_NORMAL = 32512;
const OCR_IBEAM = 32513;
const OCR_WAIT = 32514;
const OCR_CROSS = 32515;
const OCR_UP = 32516;
const OCR_SIZE = 32640;
const OCR_ICON = 32641;
const OCR_SIZENWSE = 32642;
const OCR_SIZENESW = 32643;
const OCR_SIZEWE = 32644;
const OCR_SIZENS = 32645;
const OCR_SIZEALL = 32646;
const OCR_NO = 32648;
const OCR_APPSTARTING = 32650;
const OIC_SAMPLE = 32512;
const OIC_HAND = 32513;
const OIC_QUES = 32514;
const OIC_BANG = 32515;
const OIC_NOTE = 32516;
const OIC_WINLOGO = 32517;
const OIC_WARNING = OIC_BANG;
const OIC_ERROR = OIC_HAND;
const OIC_INFORMATION = OIC_NOTE;
const HELPINFO_MENUITEM = 2;
const HELPINFO_WINDOW = 1;
const MSGF_DIALOGBOX = 0;
const MSGF_MESSAGEBOX = 1;
const MSGF_MENU = 2;
const MSGF_MOVE = 3;
const MSGF_SIZE = 4;
const MSGF_SCROLLBAR = 5;
const MSGF_NEXTWINDOW = 6;
const MSGF_MAINLOOP = 8;
const MSGF_USER = 4096;
const MOUSEEVENTF_MOVE = 1;
const MOUSEEVENTF_LEFTDOWN = 2;
const MOUSEEVENTF_LEFTUP = 4;
const MOUSEEVENTF_RIGHTDOWN = 8;
const MOUSEEVENTF_RIGHTUP = 16;
const MOUSEEVENTF_MIDDLEDOWN = 32;
const MOUSEEVENTF_MIDDLEUP = 64;
const MOUSEEVENTF_WHEEL = 0x0800;
const MOUSEEVENTF_ABSOLUTE = 32768;
const PM_NOREMOVE = 0;
const PM_REMOVE = 1;
const PM_NOYIELD = 2;
static if (WINVER >= 0x500) {
const PM_QS_INPUT = (QS_INPUT << 16);
const PM_QS_POSTMESSAGE = ((QS_POSTMESSAGE|QS_HOTKEY|QS_TIMER) << 16);
const PM_QS_PAINT = (QS_PAINT << 16);
const PM_QS_SENDMESSAGE = (QS_SENDMESSAGE << 16);
}
const HWND
HWND_BROADCAST = cast(HWND)0xffff,
HWND_BOTTOM = cast(HWND)1,
HWND_NOTOPMOST = cast(HWND)(-2),
HWND_TOP = cast(HWND)0,
HWND_TOPMOST = cast(HWND)(-1),
HWND_DESKTOP = cast(HWND)0,
HWND_MESSAGE = cast(HWND)(-3);// w2k
const RDW_INVALIDATE = 1;
const RDW_INTERNALPAINT = 2;
const RDW_ERASE = 4;
const RDW_VALIDATE = 8;
const RDW_NOINTERNALPAINT = 16;
const RDW_NOERASE = 32;
const RDW_NOCHILDREN = 64;
const RDW_ALLCHILDREN = 128;
const RDW_UPDATENOW = 256;
const RDW_ERASENOW = 512;
const RDW_FRAME = 1024;
const RDW_NOFRAME = 2048;
const SMTO_NORMAL = 0;
const SMTO_BLOCK = 1;
const SMTO_ABORTIFHUNG = 2;
const SIF_ALL = 23;
const SIF_PAGE = 2;
const SIF_POS = 4;
const SIF_RANGE = 1;
const SIF_DISABLENOSCROLL = 8;
const SIF_TRACKPOS = 16;
const SWP_DRAWFRAME = 32;
const SWP_FRAMECHANGED = 32;
const SWP_HIDEWINDOW = 128;
const SWP_NOACTIVATE = 16;
const SWP_NOCOPYBITS = 256;
const SWP_NOMOVE = 2;
const SWP_NOSIZE = 1;
const SWP_NOREDRAW = 8;
const SWP_NOZORDER = 4;
const SWP_SHOWWINDOW = 64;
const SWP_NOOWNERZORDER = 512;
const SWP_NOREPOSITION = 512;
const SWP_NOSENDCHANGING = 1024;
const SWP_DEFERERASE = 8192;
const SWP_ASYNCWINDOWPOS = 16384;
const HSHELL_ACTIVATESHELLWINDOW = 3;
const HSHELL_GETMINRECT = 5;
const HSHELL_LANGUAGE = 8;
const HSHELL_REDRAW = 6;
const HSHELL_TASKMAN = 7;
const HSHELL_WINDOWACTIVATED = 4;
const HSHELL_WINDOWCREATED = 1;
const HSHELL_WINDOWDESTROYED = 2;
const HSHELL_FLASH = 32774;
static if (WINVER >= 0x500) {
const SPI_SETFOREGROUNDLOCKTIMEOUT=0x2001;
const SPI_GETFOREGROUNDLOCKTIMEOUT=0x2000;
}
const SPI_GETACCESSTIMEOUT=60;
const SPI_GETACTIVEWNDTRKTIMEOUT=8194;
const SPI_GETANIMATION=72;
const SPI_GETBEEP=1;
const SPI_GETBORDER=5;
const SPI_GETDEFAULTINPUTLANG=89;
const SPI_GETDRAGFULLWINDOWS=38;
const SPI_GETFASTTASKSWITCH=35;
const SPI_GETFILTERKEYS=50;
const SPI_GETFONTSMOOTHING=74;
const SPI_GETGRIDGRANULARITY=18;
const SPI_GETHIGHCONTRAST=66;
const SPI_GETICONMETRICS=45;
const SPI_GETICONTITLELOGFONT=31;
const SPI_GETICONTITLEWRAP=25;
const SPI_GETKEYBOARDDELAY=22;
const SPI_GETKEYBOARDPREF=68;
const SPI_GETKEYBOARDSPEED=10;
const SPI_GETLOWPOWERACTIVE=83;
const SPI_GETLOWPOWERTIMEOUT=79;
const SPI_GETMENUDROPALIGNMENT=27;
const SPI_GETMINIMIZEDMETRICS=43;
const SPI_GETMOUSE=3;
const SPI_GETMOUSEKEYS=54;
const SPI_GETMOUSETRAILS=94;
const SPI_GETNONCLIENTMETRICS=41;
const SPI_GETPOWEROFFACTIVE=84;
const SPI_GETPOWEROFFTIMEOUT=80;
const SPI_GETSCREENREADER=70;
const SPI_GETSCREENSAVEACTIVE=16;
const SPI_GETSCREENSAVETIMEOUT=14;
const SPI_GETSERIALKEYS=62;
const SPI_GETSHOWSOUNDS=56;
const SPI_GETSOUNDSENTRY=64;
const SPI_GETSTICKYKEYS=58;
const SPI_GETTOGGLEKEYS=52;
const SPI_GETWHEELSCROLLLINES=104;
const SPI_GETWINDOWSEXTENSION=92;
const SPI_GETWORKAREA=48;
const SPI_ICONHORIZONTALSPACING=13;
const SPI_ICONVERTICALSPACING=24;
const SPI_LANGDRIVER=12;
const SPI_SCREENSAVERRUNNING=97;
const SPI_SETACCESSTIMEOUT=61;
const SPI_SETACTIVEWNDTRKTIMEOUT=8195;
const SPI_SETANIMATION=73;
const SPI_SETBEEP=2;
const SPI_SETBORDER=6;
const SPI_SETDEFAULTINPUTLANG=90;
const SPI_SETDESKPATTERN=21;
const SPI_SETDESKWALLPAPER=20;
const SPI_SETDOUBLECLICKTIME=32;
const SPI_SETDOUBLECLKHEIGHT=30;
const SPI_SETDOUBLECLKWIDTH=29;
const SPI_SETDRAGFULLWINDOWS=37;
const SPI_SETDRAGHEIGHT=77;
const SPI_SETDRAGWIDTH=76;
const SPI_SETFASTTASKSWITCH=36;
const SPI_SETFILTERKEYS=51;
const SPI_SETFONTSMOOTHING=75;
const SPI_SETGRIDGRANULARITY=19;
const SPI_SETHANDHELD=78;
const SPI_SETHIGHCONTRAST=67;
const SPI_SETICONMETRICS=46;
const SPI_SETICONTITLELOGFONT=34;
const SPI_SETICONTITLEWRAP=26;
const SPI_SETKEYBOARDDELAY=23;
const SPI_SETKEYBOARDPREF=69;
const SPI_SETKEYBOARDSPEED=11;
const SPI_SETLANGTOGGLE=91;
const SPI_SETLOWPOWERACTIVE=85;
const SPI_SETLOWPOWERTIMEOUT=81;
const SPI_SETMENUDROPALIGNMENT=28;
const SPI_SETMINIMIZEDMETRICS=44;
const SPI_SETMOUSE=4;
const SPI_SETMOUSEBUTTONSWAP=33;
const SPI_SETMOUSEKEYS=55;
const SPI_SETMOUSETRAILS=93;
const SPI_SETNONCLIENTMETRICS=42;
const SPI_SETPENWINDOWS=49;
const SPI_SETPOWEROFFACTIVE=86;
const SPI_SETPOWEROFFTIMEOUT=82;
const SPI_SETSCREENREADER=71;
const SPI_SETSCREENSAVEACTIVE=17;
const SPI_SETSCREENSAVERRUNNING=97;
const SPI_SETSCREENSAVETIMEOUT=15;
const SPI_SETSERIALKEYS=63;
const SPI_SETSHOWSOUNDS=57;
const SPI_SETSOUNDSENTRY=65;
const SPI_SETSTICKYKEYS=59;
const SPI_SETTOGGLEKEYS=53;
const SPI_SETWHEELSCROLLLINES=105;
const SPI_SETWORKAREA=47;
static if (WINVER >= 0x500) {
const SPI_GETDESKWALLPAPER=115;
const SPI_GETMOUSESPEED=112;
const SPI_GETSCREENSAVERRUNNING=114;
const SPI_GETACTIVEWINDOWTRACKING=0x1000;
const SPI_GETACTIVEWNDTRKZORDER=0x100C;
const SPI_GETCOMBOBOXANIMATION=0x1004;
const SPI_GETCURSORSHADOW=0x101A;
const SPI_GETGRADIENTCAPTIONS=0x1008;
const SPI_GETHOTTRACKING=0x100E;
const SPI_GETKEYBOARDCUES=0x100A;
const SPI_GETLISTBOXSMOOTHSCROLLING=0x1006;
const SPI_GETMENUANIMATION=0x1002;
const SPI_GETMENUFADE=0x1012;
const SPI_GETMENUUNDERLINES=0x100A;
const SPI_GETSELECTIONFADE=0x1014;
const SPI_GETTOOLTIPANIMATION=0x1016;
const SPI_GETTOOLTIPFADE=0x1018;
const SPI_SETACTIVEWINDOWTRACKING=0x1001;
const SPI_SETACTIVEWNDTRKZORDER=0x100D;
const SPI_SETCOMBOBOXANIMATION=0x1005;
const SPI_SETCURSORSHADOW=0x101B;
const SPI_SETGRADIENTCAPTIONS=0x1009;
const SPI_SETHOTTRACKING=0x100F;
const SPI_SETKEYBOARDCUES=0x100B;
const SPI_SETLISTBOXSMOOTHSCROLLING=0x1007;
const SPI_SETMENUANIMATION=0x1003;
const SPI_SETMENUFADE=0x1013;
const SPI_SETMENUUNDERLINES=0x100B;
const SPI_SETMOUSESPEED=113;
const SPI_SETSELECTIONFADE=0x1015;
const SPI_SETTOOLTIPANIMATION=0x1017;
const SPI_SETTOOLTIPFADE=0x1019;
}
const SPIF_UPDATEINIFILE=1;
const SPIF_SENDWININICHANGE=2;
const SPIF_SENDCHANGE=2;
// [Redefined] ATF_ONOFFFEEDBACK=2
// [Redefined] ATF_TIMEOUTON=1
const WM_APP=32768;
const WM_ACTIVATE=6;
const WM_ACTIVATEAPP=28;
// FIXME/CHECK: Are WM_AFX {FIRST, LAST} valid for WINVER < 0x400?
const WM_AFXFIRST=864;
const WM_AFXLAST=895;
const WM_ASKCBFORMATNAME=780;
const WM_CANCELJOURNAL=75;
const WM_CANCELMODE=31;
const WM_CAPTURECHANGED=533;
const WM_CHANGECBCHAIN=781;
const WM_CHAR=258;
const WM_CHARTOITEM=47;
const WM_CHILDACTIVATE=34;
const WM_CLEAR=771;
const WM_CLOSE=16;
const WM_COMMAND=273;
const WM_COMMNOTIFY=68; // obsolete
const WM_COMPACTING=65;
const WM_COMPAREITEM=57;
const WM_CONTEXTMENU=123;
const WM_COPY=769;
const WM_COPYDATA=74;
const WM_CREATE=1;
const WM_CTLCOLORBTN=309;
const WM_CTLCOLORDLG=310;
const WM_CTLCOLOREDIT=307;
const WM_CTLCOLORLISTBOX=308;
const WM_CTLCOLORMSGBOX=306;
const WM_CTLCOLORSCROLLBAR=311;
const WM_CTLCOLORSTATIC=312;
const WM_CUT=768;
const WM_DEADCHAR=259;
const WM_DELETEITEM=45;
const WM_DESTROY=2;
const WM_DESTROYCLIPBOARD=775;
const WM_DEVICECHANGE=537;
const WM_DEVMODECHANGE=27;
const WM_DISPLAYCHANGE=126;
const WM_DRAWCLIPBOARD=776;
const WM_DRAWITEM=43;
const WM_DROPFILES=563;
const WM_ENABLE=10;
const WM_ENDSESSION=22;
const WM_ENTERIDLE=289;
const WM_ENTERMENULOOP=529;
const WM_ENTERSIZEMOVE=561;
const WM_ERASEBKGND=20;
const WM_EXITMENULOOP=530;
const WM_EXITSIZEMOVE=562;
const WM_FONTCHANGE=29;
const WM_GETDLGCODE=135;
const WM_GETFONT=49;
const WM_GETHOTKEY=51;
const WM_GETICON=127;
const WM_GETMINMAXINFO=36;
const WM_GETTEXT=13;
const WM_GETTEXTLENGTH=14;
const WM_HANDHELDFIRST=856;
const WM_HANDHELDLAST=863;
const WM_HELP=83;
const WM_HOTKEY=786;
const WM_HSCROLL=276;
const WM_HSCROLLCLIPBOARD=782;
const WM_ICONERASEBKGND=39;
const WM_INITDIALOG=272;
const WM_INITMENU=278;
const WM_INITMENUPOPUP=279;
const WM_INPUTLANGCHANGE=81;
const WM_INPUTLANGCHANGEREQUEST=80;
const WM_KEYDOWN=256;
const WM_KEYUP=257;
const WM_KILLFOCUS=8;
const WM_MDIACTIVATE=546;
const WM_MDICASCADE=551;
const WM_MDICREATE=544;
const WM_MDIDESTROY=545;
const WM_MDIGETACTIVE=553;
const WM_MDIICONARRANGE=552;
const WM_MDIMAXIMIZE=549;
const WM_MDINEXT=548;
const WM_MDIREFRESHMENU=564;
const WM_MDIRESTORE=547;
const WM_MDISETMENU=560;
const WM_MDITILE=550;
const WM_MEASUREITEM=44;
static if (WINVER >= 0x500) {
const WM_UNINITMENUPOPUP=0x0125;
const WM_MENURBUTTONUP=290;
const WM_MENUCOMMAND=0x0126;
const WM_MENUGETOBJECT=0x0124;
const WM_MENUDRAG=0x0123;
}
static if (_WIN32_WINNT >= 0x500) {
enum {
WM_CHANGEUISTATE = 0x0127,
WM_UPDATEUISTATE = 0x0128,
WM_QUERYUISTATE = 0x0129
}
// LOWORD(wParam) values in WM_*UISTATE*
enum {
UIS_SET = 1,
UIS_CLEAR = 2,
UIS_INITIALIZE = 3
}
// HIWORD(wParam) values in WM_*UISTATE*
enum {
UISF_HIDEFOCUS = 0x1,
UISF_HIDEACCEL = 0x2
}
}
static if (_WIN32_WINNT >= 0x501) {
// HIWORD(wParam) values in WM_*UISTATE*
enum {
UISF_ACTIVE = 0x4
}
}
const WM_MENUCHAR=288;
const WM_MENUSELECT=287;
const WM_MOVE=3;
const WM_MOVING=534;
const WM_NCACTIVATE=134;
const WM_NCCALCSIZE=131;
const WM_NCCREATE=129;
const WM_NCDESTROY=130;
const WM_NCHITTEST=132;
const WM_NCLBUTTONDBLCLK=163;
const WM_NCLBUTTONDOWN=161;
const WM_NCLBUTTONUP=162;
const WM_NCMBUTTONDBLCLK=169;
const WM_NCMBUTTONDOWN=167;
const WM_NCMBUTTONUP=168;
static if (_WIN32_WINNT >= 0x500) {
const WM_NCXBUTTONDOWN=171;
const WM_NCXBUTTONUP=172;
const WM_NCXBUTTONDBLCLK=173;
const WM_NCMOUSEHOVER=0x02A0;
const WM_NCMOUSELEAVE=0x02A2;
}
const WM_NCMOUSEMOVE=160;
const WM_NCPAINT=133;
const WM_NCRBUTTONDBLCLK=166;
const WM_NCRBUTTONDOWN=164;
const WM_NCRBUTTONUP=165;
const WM_NEXTDLGCTL=40;
const WM_NEXTMENU=531;
const WM_NOTIFY=78;
const WM_NOTIFYFORMAT=85;
const WM_NULL=0;
const WM_PAINT=15;
const WM_PAINTCLIPBOARD=777;
const WM_PAINTICON=38;
const WM_PALETTECHANGED=785;
const WM_PALETTEISCHANGING=784;
const WM_PARENTNOTIFY=528;
const WM_PASTE=770;
const WM_PENWINFIRST=896;
const WM_PENWINLAST=911;
const WM_POWER=72;
const WM_POWERBROADCAST=536;
const WM_PRINT=791;
const WM_PRINTCLIENT=792;
const WM_APPCOMMAND = 0x0319;
const WM_QUERYDRAGICON=55;
const WM_QUERYENDSESSION=17;
const WM_QUERYNEWPALETTE=783;
const WM_QUERYOPEN=19;
const WM_QUEUESYNC=35;
const WM_QUIT=18;
const WM_RENDERALLFORMATS=774;
const WM_RENDERFORMAT=773;
const WM_SETCURSOR=32;
const WM_SETFOCUS=7;
const WM_SETFONT=48;
const WM_SETHOTKEY=50;
const WM_SETICON=128;
const WM_SETREDRAW=11;
const WM_SETTEXT=12;
const WM_SETTINGCHANGE=26;
const WM_SHOWWINDOW=24;
const WM_SIZE=5;
const WM_SIZECLIPBOARD=779;
const WM_SIZING=532;
const WM_SPOOLERSTATUS=42;
const WM_STYLECHANGED=125;
const WM_STYLECHANGING=124;
const WM_SYSCHAR=262;
const WM_SYSCOLORCHANGE=21;
const WM_SYSCOMMAND=274;
const WM_SYSDEADCHAR=263;
const WM_SYSKEYDOWN=260;
const WM_SYSKEYUP=261;
const WM_TCARD=82;
const WM_THEMECHANGED=794;
const WM_TIMECHANGE=30;
const WM_TIMER=275;
const WM_UNDO=772;
const WM_USER=1024;
const WM_USERCHANGED=84;
const WM_VKEYTOITEM=46;
const WM_VSCROLL=277;
const WM_VSCROLLCLIPBOARD=778;
const WM_WINDOWPOSCHANGED=71;
const WM_WINDOWPOSCHANGING=70;
const WM_WININICHANGE=26;
const WM_INPUT=255;
const WM_KEYFIRST=256;
const WM_KEYLAST=264;
const WM_SYNCPAINT=136;
const WM_MOUSEACTIVATE=33;
const WM_MOUSEMOVE=512;
const WM_LBUTTONDOWN=513;
const WM_LBUTTONUP=514;
const WM_LBUTTONDBLCLK=515;
const WM_RBUTTONDOWN=516;
const WM_RBUTTONUP=517;
const WM_RBUTTONDBLCLK=518;
const WM_MBUTTONDOWN=519;
const WM_MBUTTONUP=520;
const WM_MBUTTONDBLCLK=521;
const WM_MOUSEWHEEL=522;
const WM_MOUSEFIRST=512;
static if (_WIN32_WINNT >= 0x500) {
const WM_XBUTTONDOWN=523;
const WM_XBUTTONUP=524;
const WM_XBUTTONDBLCLK=525;
const WM_MOUSELAST=525;
} else {
const WM_MOUSELAST=522;
}
const WM_MOUSEHOVER=0x2A1;
const WM_MOUSELEAVE=0x2A3;
static if (_WIN32_WINNT >= 0x400) {
const WHEEL_DELTA=120;
SHORT GET_WHEEL_DELTA_WPARAM(WPARAM wparam)
{
return cast(SHORT) HIWORD(wparam);
}
const WHEEL_PAGESCROLL = uint.max;
}
const BM_CLICK=245;
const BM_GETCHECK=240;
const BM_GETIMAGE=246;
const BM_GETSTATE=242;
const BM_SETCHECK=241;
const BM_SETIMAGE=247;
const BM_SETSTATE=243;
const BM_SETSTYLE=244;
const BN_CLICKED=0;
const BN_DBLCLK=5;
const BN_DISABLE=4;
const BN_DOUBLECLICKED=5;
const BN_HILITE=2;
const BN_KILLFOCUS=7;
const BN_PAINT=1;
const BN_PUSHED=2;
const BN_SETFOCUS=6;
const BN_UNHILITE=3;
const BN_UNPUSHED=3;
const CB_ADDSTRING=323;
const CB_DELETESTRING=324;
const CB_DIR=325;
const CB_FINDSTRING=332;
const CB_FINDSTRINGEXACT=344;
const CB_GETCOUNT=326;
const CB_GETCURSEL=327;
const CB_GETDROPPEDCONTROLRECT=338;
const CB_GETDROPPEDSTATE=343;
const CB_GETDROPPEDWIDTH=351;
const CB_GETEDITSEL=320;
const CB_GETEXTENDEDUI=342;
const CB_GETHORIZONTALEXTENT=349;
const CB_GETITEMDATA=336;
const CB_GETITEMHEIGHT=340;
const CB_GETLBTEXT=328;
const CB_GETLBTEXTLEN=329;
const CB_GETLOCALE=346;
const CB_GETTOPINDEX=347;
const CB_INITSTORAGE=353;
const CB_INSERTSTRING=330;
const CB_LIMITTEXT=321;
const CB_RESETCONTENT=331;
const CB_SELECTSTRING=333;
const CB_SETCURSEL=334;
const CB_SETDROPPEDWIDTH=352;
const CB_SETEDITSEL=322;
const CB_SETEXTENDEDUI=341;
const CB_SETHORIZONTALEXTENT=350;
const CB_SETITEMDATA=337;
const CB_SETITEMHEIGHT=339;
const CB_SETLOCALE=345;
const CB_SETTOPINDEX=348;
const CB_SHOWDROPDOWN=335;
const CBN_CLOSEUP=8;
const CBN_DBLCLK=2;
const CBN_DROPDOWN=7;
const CBN_EDITCHANGE=5;
const CBN_EDITUPDATE=6;
const CBN_ERRSPACE=(-1);
const CBN_KILLFOCUS=4;
const CBN_SELCHANGE=1;
const CBN_SELENDCANCEL=10;
const CBN_SELENDOK=9;
const CBN_SETFOCUS=3;
const EM_CANUNDO=198;
const EM_CHARFROMPOS=215;
const EM_EMPTYUNDOBUFFER=205;
const EM_FMTLINES=200;
const EM_GETFIRSTVISIBLELINE=206;
const EM_GETHANDLE=189;
const EM_GETLIMITTEXT=213;
const EM_GETLINE=196;
const EM_GETLINECOUNT=186;
const EM_GETMARGINS=212;
const EM_GETMODIFY=184;
const EM_GETPASSWORDCHAR=210;
const EM_GETRECT=178;
const EM_GETSEL=176;
const EM_GETTHUMB=190;
const EM_GETWORDBREAKPROC=209;
const EM_LIMITTEXT=197;
const EM_LINEFROMCHAR=201;
const EM_LINEINDEX=187;
const EM_LINELENGTH=193;
const EM_LINESCROLL=182;
const EM_POSFROMCHAR=214;
const EM_REPLACESEL=194;
const EM_SCROLL=181;
const EM_SCROLLCARET=183;
const EM_SETHANDLE=188;
const EM_SETLIMITTEXT=197;
const EM_SETMARGINS=211;
const EM_SETMODIFY=185;
const EM_SETPASSWORDCHAR=204;
const EM_SETREADONLY=207;
const EM_SETRECT=179;
const EM_SETRECTNP=180;
const EM_SETSEL=177;
const EM_SETTABSTOPS=203;
const EM_SETWORDBREAKPROC=208;
const EM_UNDO=199;
const EN_CHANGE=768;
const EN_ERRSPACE=1280;
const EN_HSCROLL=1537;
const EN_KILLFOCUS=512;
const EN_MAXTEXT=1281;
const EN_SETFOCUS=256;
const EN_UPDATE=1024;
const EN_VSCROLL=1538;
const LB_ADDFILE=406;
const LB_ADDSTRING=384;
const LB_DELETESTRING=386;
const LB_DIR=397;
const LB_FINDSTRING=399;
const LB_FINDSTRINGEXACT=418;
const LB_GETANCHORINDEX=413;
const LB_GETCARETINDEX=415;
const LB_GETCOUNT=395;
const LB_GETCURSEL=392;
const LB_GETHORIZONTALEXTENT=403;
const LB_GETITEMDATA=409;
const LB_GETITEMHEIGHT=417;
const LB_GETITEMRECT=408;
const LB_GETLOCALE=422;
const LB_GETSEL=391;
const LB_GETSELCOUNT=400;
const LB_GETSELITEMS=401;
const LB_GETTEXT=393;
const LB_GETTEXTLEN=394;
const LB_GETTOPINDEX=398;
const LB_INITSTORAGE=424;
const LB_INSERTSTRING=385;
const LB_ITEMFROMPOINT=425;
const LB_RESETCONTENT=388;
const LB_SELECTSTRING=396;
const LB_SELITEMRANGE=411;
const LB_SELITEMRANGEEX=387;
const LB_SETANCHORINDEX=412;
const LB_SETCARETINDEX=414;
const LB_SETCOLUMNWIDTH=405;
const LB_SETCOUNT=423;
const LB_SETCURSEL=390;
const LB_SETHORIZONTALEXTENT=404;
const LB_SETITEMDATA=410;
const LB_SETITEMHEIGHT=416;
const LB_SETLOCALE=421;
const LB_SETSEL=389;
const LB_SETTABSTOPS=402;
const LB_SETTOPINDEX=407;
const LBN_DBLCLK=2;
const LBN_ERRSPACE=-2;
const LBN_KILLFOCUS=5;
const LBN_SELCANCEL=3;
const LBN_SELCHANGE=1;
const LBN_SETFOCUS=4;
const SBM_ENABLE_ARROWS=228;
const SBM_GETPOS=225;
const SBM_GETRANGE=227;
const SBM_GETSCROLLINFO=234;
const SBM_SETPOS=224;
const SBM_SETRANGE=226;
const SBM_SETRANGEREDRAW=230;
const SBM_SETSCROLLINFO=233;
const STM_GETICON=369;
const STM_GETIMAGE=371;
const STM_SETICON=368;
const STM_SETIMAGE=370;
const STN_CLICKED=0;
const STN_DBLCLK=1;
const STN_DISABLE=3;
const STN_ENABLE=2;
const DM_GETDEFID = WM_USER;
const DM_SETDEFID = WM_USER+1;
const DM_REPOSITION = WM_USER+2;
const PSM_PAGEINFO = WM_USER+100;
const PSM_SHEETINFO = WM_USER+101;
const PSI_SETACTIVE=1;
const PSI_KILLACTIVE=2;
const PSI_APPLY=3;
const PSI_RESET=4;
const PSI_HASHELP=5;
const PSI_HELP=6;
const PSI_CHANGED=1;
const PSI_GUISTART=2;
const PSI_REBOOT=3;
const PSI_GETSIBLINGS=4;
const DCX_WINDOW=1;
const DCX_CACHE=2;
const DCX_PARENTCLIP=32;
const DCX_CLIPSIBLINGS=16;
const DCX_CLIPCHILDREN=8;
const DCX_NORESETATTRS=4;
const DCX_INTERSECTUPDATE=0x200;
const DCX_LOCKWINDOWUPDATE=0x400;
const DCX_EXCLUDERGN=64;
const DCX_INTERSECTRGN=128;
const DCX_VALIDATE=0x200000;
const GMDI_GOINTOPOPUPS=2;
const GMDI_USEDISABLED=1;
const FKF_AVAILABLE=2;
const FKF_CLICKON=64;
const FKF_FILTERKEYSON=1;
const FKF_HOTKEYACTIVE=4;
const FKF_HOTKEYSOUND=16;
const FKF_CONFIRMHOTKEY=8;
const FKF_INDICATOR=32;
const HCF_HIGHCONTRASTON=1;
const HCF_AVAILABLE=2;
const HCF_HOTKEYACTIVE=4;
const HCF_CONFIRMHOTKEY=8;
const HCF_HOTKEYSOUND=16;
const HCF_INDICATOR=32;
const HCF_HOTKEYAVAILABLE=64;
const MKF_AVAILABLE=2;
const MKF_CONFIRMHOTKEY=8;
const MKF_HOTKEYACTIVE=4;
const MKF_HOTKEYSOUND=16;
const MKF_INDICATOR=32;
const MKF_MOUSEKEYSON=1;
const MKF_MODIFIERS=64;
const MKF_REPLACENUMBERS=128;
const SERKF_ACTIVE=8; // May be obsolete. Not in recent MS docs.
const SERKF_AVAILABLE=2;
const SERKF_INDICATOR=4;
const SERKF_SERIALKEYSON=1;
const SSF_AVAILABLE=2;
const SSF_SOUNDSENTRYON=1;
const SSTF_BORDER=2;
const SSTF_CHARS=1;
const SSTF_DISPLAY=3;
const SSTF_NONE=0;
const SSGF_DISPLAY=3;
const SSGF_NONE=0;
const SSWF_CUSTOM=4;
const SSWF_DISPLAY=3;
const SSWF_NONE=0;
const SSWF_TITLE=1;
const SSWF_WINDOW=2;
const SKF_AUDIBLEFEEDBACK=64;
const SKF_AVAILABLE=2;
const SKF_CONFIRMHOTKEY=8;
const SKF_HOTKEYACTIVE=4;
const SKF_HOTKEYSOUND=16;
const SKF_INDICATOR=32;
const SKF_STICKYKEYSON=1;
const SKF_TRISTATE=128;
const SKF_TWOKEYSOFF=256;
const TKF_AVAILABLE=2;
const TKF_CONFIRMHOTKEY=8;
const TKF_HOTKEYACTIVE=4;
const TKF_HOTKEYSOUND=16;
const TKF_TOGGLEKEYSON=1;
const MDITILE_SKIPDISABLED=2;
const MDITILE_HORIZONTAL=1;
const MDITILE_VERTICAL=0;
enum {
VK_LBUTTON = 0x01,
VK_RBUTTON = 0x02,
VK_CANCEL = 0x03,
VK_MBUTTON = 0x04,
//static if (_WIN32_WINNT > = 0x500) {
VK_XBUTTON1 = 0x05,
VK_XBUTTON2 = 0x06,
//}
VK_BACK = 0x08,
VK_TAB = 0x09,
VK_CLEAR = 0x0C,
VK_RETURN = 0x0D,
VK_ШИФТ = 0x10,
VK_CONTROL = 0x11,
VK_MENU = 0x12,
VK_PAUSE = 0x13,
VK_CAPITAL = 0x14,
VK_KANA = 0x15,
VK_HANGEUL = 0x15,
VK_HANGUL = 0x15,
VK_JUNJA = 0x17,
VK_FINAL = 0x18,
VK_HANJA = 0x19,
VK_KANJI = 0x19,
VK_ESCAPE = 0x1B,
VK_CONVERT = 0x1C,
VK_NONCONVERT = 0x1D,
VK_ACCEPT = 0x1E,
VK_MODECHANGE = 0x1F,
VK_SPACE = 0x20,
VK_PRIOR = 0x21,
VK_NEXT = 0x22,
VK_END = 0x23,
VK_HOME = 0x24,
VK_LEFT = 0x25,
VK_UP = 0x26,
VK_RIGHT = 0x27,
VK_DOWN = 0x28,
VK_SELECT = 0x29,
VK_PRINT = 0x2A,
VK_EXECUTE = 0x2B,
VK_SNAPSHOT = 0x2C,
VK_INSERT = 0x2D,
VK_DELETE = 0x2E,
VK_HELP = 0x2F,
VK_LWIN = 0x5B,
VK_RWIN = 0x5C,
VK_APPS = 0x5D,
VK_SLEEP = 0x5F,
VK_NUMPAD0 = 0x60,
VK_NUMPAD1 = 0x61,
VK_NUMPAD2 = 0x62,
VK_NUMPAD3 = 0x63,
VK_NUMPAD4 = 0x64,
VK_NUMPAD5 = 0x65,
VK_NUMPAD6 = 0x66,
VK_NUMPAD7 = 0x67,
VK_NUMPAD8 = 0x68,
VK_NUMPAD9 = 0x69,
VK_MULTIPLY = 0x6A,
VK_ADD = 0x6B,
VK_SEPARATOR = 0x6C,
VK_SUBTRACT = 0x6D,
VK_DECIMAL = 0x6E,
VK_DIVIDE = 0x6F,
VK_F1 = 0x70,
VK_F2 = 0x71,
VK_F3 = 0x72,
VK_F4 = 0x73,
VK_F5 = 0x74,
VK_F6 = 0x75,
VK_F7 = 0x76,
VK_F8 = 0x77,
VK_F9 = 0x78,
VK_F10 = 0x79,
VK_F11 = 0x7A,
VK_F12 = 0x7B,
VK_F13 = 0x7C,
VK_F14 = 0x7D,
VK_F15 = 0x7E,
VK_F16 = 0x7F,
VK_F17 = 0x80,
VK_F18 = 0x81,
VK_F19 = 0x82,
VK_F20 = 0x83,
VK_F21 = 0x84,
VK_F22 = 0x85,
VK_F23 = 0x86,
VK_F24 = 0x87,
VK_NUMLOCK = 0x90,
VK_SCROLL = 0x91,
VK_LШИФТ = 0xA0,
VK_RШИФТ = 0xA1,
VK_LCONTROL = 0xA2,
VK_RCONTROL = 0xA3,
VK_LMENU = 0xA4,
VK_RMENU = 0xA5,
//static if (_WIN32_WINNT > = 0x500) {
VK_BROWSER_BACK = 0xA6,
VK_BROWSER_FORWARD = 0xA7,
VK_BROWSER_REFRESH = 0xA8,
VK_BROWSER_STOP = 0xA9,
VK_BROWSER_SEARCH = 0xAA,
VK_BROWSER_FAVORITES = 0xAB,
VK_BROWSER_HOME = 0xAC,
VK_VOLUME_MUTE = 0xAD,
VK_VOLUME_DOWN = 0xAE,
VK_VOLUME_UP = 0xAF,
VK_MEDIA_NEXT_TRACK = 0xB0,
VK_MEDIA_PREV_TRACK = 0xB1,
VK_MEDIA_STOP = 0xB2,
VK_MEDIA_PLAY_PAUSE = 0xB3,
VK_LAUNCH_MAIL = 0xB4,
VK_LAUNCH_MEDIA_SELECT = 0xB5,
VK_LAUNCH_APP1 = 0xB6,
VK_LAUNCH_APP2 = 0xB7,
//}
VK_OEM_1 = 0xBA,
//static if (_WIN32_WINNT > = 0x500) {
VK_OEM_PLUS = 0xBB,
VK_OEM_COMMA = 0xBC,
VK_OEM_MINUS = 0xBD,
VK_OEM_PERIOD = 0xBE,
//}
VK_OEM_2 = 0xBF,
VK_OEM_3 = 0xC0,
VK_OEM_4 = 0xDB,
VK_OEM_5 = 0xDC,
VK_OEM_6 = 0xDD,
VK_OEM_7 = 0xDE,
VK_OEM_8 = 0xDF,
//static if (_WIN32_WINNT > = 0x500) {
VK_OEM_102 = 0xE2,
//}
VK_PROCESSKEY = 0xE5,
//static if (_WIN32_WINNT > = 0x500) {
VK_PACKET = 0xE7,
//}
VK_ATTN = 0xF6,
VK_CRSEL = 0xF7,
VK_EXSEL = 0xF8,
VK_EREOF = 0xF9,
VK_PLAY = 0xFA,
VK_ZOOM = 0xFB,
VK_NONAME = 0xFC,
VK_PA1 = 0xFD,
VK_OEM_CLEAR = 0xFE,
}
const TME_HOVER=1;
const TME_LEAVE=2;
const TME_QUERY=0x40000000;
const TME_CANCEL=0x80000000;
const HOVER_DEFAULT=0xFFFFFFFF;
const MK_LBUTTON=1;
const MK_RBUTTON=2;
const MK_ШИФТ=4;
const MK_CONTROL=8;
const MK_MBUTTON=16;
static if (_WIN32_WINNT >= 0x500) {
const MK_XBUTTON1=32;
const MK_XBUTTON2=64;
}
const TPM_CENTERALIGN=4;
const TPM_LEFTALIGN=0;
const TPM_RIGHTALIGN=8;
const TPM_LEFTBUTTON=0;
const TPM_RIGHTBUTTON=2;
const TPM_HORIZONTAL=0;
const TPM_VERTICAL=64;
const TPM_TOPALIGN=0;
const TPM_VCENTERALIGN=16;
const TPM_BOTTOMALIGN=32;
const TPM_NONOTIFY=128;
const TPM_RETURNCMD=256;
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x410)) {
const TPM_RECURSE=1;
}
const HELP_COMMAND=0x102;
const HELP_CONTENTS=3;
const HELP_CONTEXT=1;
const HELP_CONTEXTPOPUP=8;
const HELP_FORCEFILE=9;
const HELP_HELPONHELP=4;
const HELP_INDEX=3;
const HELP_KEY=0x101;
const HELP_MULTIKEY=0x201;
const HELP_PARTIALKEY=0x105;
const HELP_QUIT=2;
const HELP_SETCONTENTS=5;
const HELP_SETINDEX=5;
const HELP_SETWINPOS=0x203;
const HELP_CONTEXTMENU=0xa;
const HELP_FINDER=0xb;
const HELP_WM_HELP=0xc;
const HELP_TCARD=0x8000;
const HELP_TCARD_DATA=16;
const HELP_TCARD_OTHER_CALLER=0x11;
const IDH_NO_HELP=28440;
const IDH_MISSING_CONTEXT=28441;
const IDH_GENERIC_HELP_BUTTON=28442;
const IDH_OK=28443;
const IDH_CANCEL=28444;
const IDH_HELP=28445;
const LB_CTLCODE=0;
const LB_OKAY=0;
const LB_ERR=-1;
const LB_ERRSPACE=-2;
const CB_OKAY=0;
const CB_ERR=-1;
const CB_ERRSPACE=-2;
const HIDE_WINDOW=0;
const SHOW_OPENWINDOW=1;
const SHOW_ICONWINDOW=2;
const SHOW_FULLSCREEN=3;
const SHOW_OPENNOACTIVATE=4;
const SW_PARENTCLOSING=1;
const SW_OTHERZOOM=2;
const SW_PARENTOPENING=3;
const SW_OTHERUNZOOM=4;
const KF_EXTENDED=256;
const KF_DLGMODE=2048;
const KF_MENUMODE=4096;
const KF_ALTDOWN=8192;
const KF_REPEAT=16384;
const KF_UP=32768;
const WSF_VISIBLE=1;
const PWR_OK=1;
const PWR_FAIL=-1;
const PWR_SUSPENDREQUEST=1;
const PWR_SUSPENDRESUME=2;
const PWR_CRITICALRESUME=3;
const NFR_ANSI=1;
const NFR_UNICODE=2;
const NF_QUERY=3;
const NF_REQUERY=4;
const MENULOOP_WINDOW=0;
const MENULOOP_POPUP=1;
const WMSZ_LEFT=1;
const WMSZ_RIGHT=2;
const WMSZ_TOP=3;
const WMSZ_TOPLEFT=4;
const WMSZ_TOPRIGHT=5;
const WMSZ_BOTTOM=6;
const WMSZ_BOTTOMLEFT=7;
const WMSZ_BOTTOMRIGHT=8;
const HTERROR=-2;
const HTTRANSPARENT=-1;
const HTNOWHERE=0;
const HTCLIENT=1;
const HTCAPTION=2;
const HTSYSMENU=3;
const HTGROWBOX=4;
const HTSIZE=4;
const HTMENU=5;
const HTHSCROLL=6;
const HTVSCROLL=7;
const HTMINBUTTON=8;
const HTMAXBUTTON=9;
const HTREDUCE=8;
const HTZOOM=9;
const HTLEFT=10;
const HTSIZEFIRST=10;
const HTRIGHT=11;
const HTTOP=12;
const HTTOPLEFT=13;
const HTTOPRIGHT=14;
const HTBOTTOM=15;
const HTBOTTOMLEFT=16;
const HTBOTTOMRIGHT=17;
const HTSIZELAST=17;
const HTBORDER=18;
const HTOBJECT=19;
const HTCLOSE=20;
const HTHELP=21;
const MA_ACTIVATE=1;
const MA_ACTIVATEANDEAT=2;
const MA_NOACTIVATE=3;
const MA_NOACTIVATEANDEAT=4;
const SIZE_RESTORED=0;
const SIZE_MINIMIZED=1;
const SIZE_MAXIMIZED=2;
const SIZE_MAXSHOW=3;
const SIZE_MAXHIDE=4;
const SIZENORMAL=0;
const SIZEICONIC=1;
const SIZEFULLSCREEN=2;
const SIZEZOOMSHOW=3;
const SIZEZOOMHIDE=4;
const WVR_ALIGNTOP=16;
const WVR_ALIGNLEFT=32;
const WVR_ALIGNBOTTOM=64;
const WVR_ALIGNRIGHT=128;
const WVR_HREDRAW=256;
const WVR_VREDRAW=512;
const WVR_REDRAW=(WVR_HREDRAW|WVR_VREDRAW);
const WVR_VALIDRECTS=1024;
const PRF_CHECKVISIBLE=1;
const PRF_NONCLIENT=2;
const PRF_CLIENT=4;
const PRF_ERASEBKGND=8;
const PRF_CHILDREN=16;
const PRF_OWNED=32;
const IDANI_OPEN=1;
const IDANI_CLOSE=2;
const IDANI_CAPTION=3;
const WPF_RESTORETOMAXIMIZED=2;
const WPF_SETMINPOSITION=1;
const ODT_MENU=1;
const ODT_LISTBOX=2;
const ODT_COMBOBOX=3;
const ODT_BUTTON=4;
const ODT_STATIC=5;
const ODA_DRAWENTIRE=1;
const ODA_SELECT=2;
const ODA_FOCUS=4;
const ODS_SELECTED=1;
const ODS_GRAYED=2;
const ODS_DISABLED=4;
const ODS_CHECKED=8;
const ODS_FOCUS=16;
const ODS_DEFAULT=32;
const ODS_COMBOBOXEDIT=4096;
const IDHOT_SNAPWINDOW=-1;
const IDHOT_SNAPDESKTOP=-2;
const DBWF_LPARAMPOINTER=0x8000;
const DLGWINDOWEXTRA=30;
const MNC_IGNORE=0;
const MNC_CLOSE=1;
const MNC_EXECUTE=2;
const MNC_SELECT=3;
const DOF_EXECUTABLE=0x8001;
const DOF_DOCUMENT=0x8002;
const DOF_DIRECTORY=0x8003;
const DOF_MULTIPLE=0x8004;
const DOF_PROGMAN=1;
const DOF_SHELLDATA=2;
const DO_DROPFILE=0x454C4946;
const DO_PRINTFILE=0x544E5250;
const SW_SCROLLCHILDREN=1;
const SW_INVALIDATE=2;
const SW_ERASE=4;
const SC_SIZE=0xF000;
const SC_MOVE=0xF010;
const SC_MINIMIZE=0xF020;
const SC_ICON=0xf020;
const SC_MAXIMIZE=0xF030;
const SC_ZOOM=0xF030;
const SC_NEXTWINDOW=0xF040;
const SC_PREVWINDOW=0xF050;
const SC_CLOSE=0xF060;
const SC_VSCROLL=0xF070;
const SC_HSCROLL=0xF080;
const SC_MOUSEMENU=0xF090;
const SC_KEYMENU=0xF100;
const SC_ARRANGE=0xF110;
const SC_RESTORE=0xF120;
const SC_TASKLIST=0xF130;
const SC_SCREENSAVE=0xF140;
const SC_HOTKEY=0xF150;
const SC_DEFAULT=0xF160;
const SC_MONITORPOWER=0xF170;
const SC_CONTEXTHELP=0xF180;
const SC_SEPARATOR=0xF00F;
const EC_LEFTMARGIN=1;
const EC_RIGHTMARGIN=2;
const EC_USEFONTINFO=0xffff;
const DC_HASDEFID=0x534B;
const DLGC_WANTARROWS=1;
const DLGC_WANTTAB=2;
const DLGC_WANTALLKEYS=4;
const DLGC_WANTMESSAGE=4;
const DLGC_HASSETSEL=8;
const DLGC_DEFPUSHBUTTON=16;
const DLGC_UNDEFPUSHBUTTON=32;
const DLGC_RADIOBUTTON=64;
const DLGC_WANTCHARS=128;
const DLGC_STATIC=256;
const DLGC_BUTTON=0x2000;
const WA_INACTIVE=0;
const WA_ACTIVE=1;
const WA_CLICKACTIVE=2;
const ICON_SMALL=0;
const ICON_BIG=1;
static if (_WIN32_WINNT >= 0x501) {
const ICON_SMALL2=2;
}
const HBITMAP
HBMMENU_CALLBACK = cast(HBITMAP)-1,
HBMMENU_SYSTEM = cast(HBITMAP)1,
HBMMENU_MBAR_RESTORE = cast(HBITMAP)2,
HBMMENU_MBAR_MINIMIZE = cast(HBITMAP)3,
HBMMENU_MBAR_CLOSE = cast(HBITMAP)5,
HBMMENU_MBAR_CLOSE_D = cast(HBITMAP)6,
HBMMENU_MBAR_MINIMIZE_D = cast(HBITMAP)7,
HBMMENU_POPUP_CLOSE = cast(HBITMAP)8,
HBMMENU_POPUP_RESTORE = cast(HBITMAP)9,
HBMMENU_POPUP_MAXIMIZE = cast(HBITMAP)10,
HBMMENU_POPUP_MINIMIZE = cast(HBITMAP)11;
const MOD_ALT=1;
const MOD_CONTROL=2;
const MOD_ШИФТ=4;
const MOD_WIN=8;
const MOD_IGNORE_ALL_MODIFIER=1024;
const MOD_ON_KEYUP=2048;
const MOD_RIGHT=16384;
const MOD_LEFT=32768;
const LLKHF_EXTENDED=(KF_EXTENDED >> 8);
const LLKHF_INJECTED=0x00000010;
const LLKHF_ALTDOWN=(KF_ALTDOWN >> 8);
const LLKHF_UP=(KF_UP >> 8);
static if (WINVER >= 0x500) {
const FLASHW_STOP=0;
const FLASHW_CAPTION=1;
const FLASHW_TRAY=2;
const FLASHW_ALL=(FLASHW_CAPTION|FLASHW_TRAY);
const FLASHW_TIMER=4;
const FLASHW_TIMERNOFG=12;
}
const CURSOR_SHOWING=0x00000001;
const WS_ACTIVECAPTION=0x00000001;
static if (_WIN32_WINNT >= 0x403) {
const INPUT_MOUSE=0x00000000;
const INPUT_KEYBOARD=0x00000001;
const INPUT_HARDWARE=0x00000002;
}
static if (WINVER >= 0x400) {
const ENDSESSION_LOGOFF = 0x80000000;
}
static if (WINVER >= 0x500) {
const CHILDID_SELF = 0;
const OBJID_WINDOW = 0x00000000;
const OBJID_SYSMENU = 0xFFFFFFFF;
const OBJID_TITLEBAR = 0xFFFFFFFE;
const OBJID_MENU = 0xFFFFFFFD;
const OBJID_CLIENT = 0xFFFFFFFC;
const OBJID_VSCROLL = 0xFFFFFFFB;
const OBJID_HSCROLL = 0xFFFFFFFA;
const OBJID_SIZEGRIP = 0xFFFFFFF9;
const OBJID_CARET = 0xFFFFFFF8;
const OBJID_CURSOR = 0xFFFFFFF7;
const OBJID_ALERT = 0xFFFFFFF6;
const OBJID_SOUND = 0xFFFFFFF5;
const GUI_CARETBLINKING = 0x00000001;
const GUI_INMOVESIZE = 0x00000002;
const GUI_INMENUMODE = 0x00000004;
const GUI_SYSTEMMENUMODE = 0x00000008;
const GUI_POPUPMENUMODE = 0x00000010;
static if (_WIN32_WINNT >= 0x501) {
const GUI_16BITTASK = 0x00000020;
}
const WINEVENT_OUTOFCONTEXT=0x0000;
const WINEVENT_SKIPOWNTHREAD=0x0001;
const WINEVENT_SKIPOWNPROCESS=0x0002;
const WINEVENT_INCONTEXT=0x0004;
const AW_HOR_POSITIVE=0x00000001;
const AW_HOR_NEGATIVE=0x00000002;
const AW_VER_POSITIVE=0x00000004;
const AW_VER_NEGATIVE=0x00000008;
const AW_CENTER=0x00000010;
const AW_HIDE=0x00010000;
const AW_ACTIVATE=0x00020000;
const AW_SLIDE=0x00040000;
const AW_BLEND=0x00080000;
const DEVICE_NOTIFY_WINDOW_HANDLE=0x00000000;
const DEVICE_NOTIFY_SERVICE_HANDLE=0x00000001;
static if (_WIN32_WINNT >= 0x501) {
const DEVICE_NOTIFY_ALL_INTERFACE_CLASSES=0x00000004;
}
const EVENT_MIN = 0x00000001;
const EVENT_SYSTEM_SOUND = 0x00000001;
const EVENT_SYSTEM_ALERT = 0x00000002;
const EVENT_SYSTEM_FOREGROUND = 0x00000003;
const EVENT_SYSTEM_MENUSTART = 0x00000004;
const EVENT_SYSTEM_MENUEND = 0x00000005;
const EVENT_SYSTEM_MENUPOPUPSTART = 0x00000006;
const EVENT_SYSTEM_MENUPOPUPEND = 0x00000007;
const EVENT_SYSTEM_CAPTURESTART = 0x00000008;
const EVENT_SYSTEM_CAPTUREEND = 0x00000009;
const EVENT_SYSTEM_MOVESIZESTART = 0x0000000a;
const EVENT_SYSTEM_MOVESIZEEND = 0x0000000b;
const EVENT_SYSTEM_CONTEXTHELPSTART = 0x0000000c;
const EVENT_SYSTEM_CONTEXTHELPEND = 0x0000000d;
const EVENT_SYSTEM_DRAGDROPSTART = 0x0000000e;
const EVENT_SYSTEM_DRAGDROPEND = 0x0000000f;
const EVENT_SYSTEM_DIALOGSTART = 0x00000010;
const EVENT_SYSTEM_DIALOGEND = 0x00000011;
const EVENT_SYSTEM_SCROLLINGSTART = 0x00000012;
const EVENT_SYSTEM_SCROLLINGEND = 0x00000013;
const EVENT_SYSTEM_SWITCHSTART = 0x00000014;
const EVENT_SYSTEM_SWITCHEND = 0x00000015;
const EVENT_SYSTEM_MINIMIZESTART = 0x00000016;
const EVENT_SYSTEM_MINIMIZEEND = 0x00000017;
const EVENT_OBJECT_CREATE = 0x00008000;
const EVENT_OBJECT_DESTROY = 0x00008001;
const EVENT_OBJECT_SHOW = 0x00008002;
const EVENT_OBJECT_HIDE = 0x00008003;
const EVENT_OBJECT_REORDER = 0x00008004;
const EVENT_OBJECT_FOCUS = 0x00008005;
const EVENT_OBJECT_SELECTION = 0x00008006;
const EVENT_OBJECT_SELECTIONADD = 0x00008007;
const EVENT_OBJECT_SELECTIONREMOVE = 0x00008008;
const EVENT_OBJECT_SELECTIONWITHIN = 0x00008009;
const EVENT_OBJECT_STATECHANGE = 0x0000800a;
const EVENT_OBJECT_LOCATIONCHANGE = 0x0000800b;
const EVENT_OBJECT_NAMECHANGE = 0x0000800c;
const EVENT_OBJECT_DESCRIPTIONCHANGE = 0x0000800d;
const EVENT_OBJECT_VALUECHANGE = 0x0000800e;
const EVENT_OBJECT_PARENTCHANGE = 0x0000800f;
const EVENT_OBJECT_HELPCHANGE = 0x00008010;
const EVENT_OBJECT_DEFACTIONCHANGE = 0x00008011;
const EVENT_OBJECT_ACCELERATORCHANGE = 0x00008012;
static if (_WIN32_WINNT >= 0x501) {
const EVENT_CONSOLE_CARET = 0x00004001;
const EVENT_CONSOLE_UPDATE_REGION = 0x00004002;
const EVENT_CONSOLE_UPDATE_SIMPLE = 0x00004003;
const EVENT_CONSOLE_UPDATE_SCROLL = 0x00004004;
const EVENT_CONSOLE_LAYOUT = 0x00004005;
const EVENT_CONSOLE_START_APPLICATION = 0x00004006;
const EVENT_CONSOLE_END_APPLICATION = 0x00004007;
const CONSOLE_CARET_SELECTION = 0x00000001;
const CONSOLE_CARET_VISIBLE = 0x00000002;
const CONSOLE_APPLICATION_16BIT = 0x00000001;
}
const EVENT_MAX=0x7fffffff;
}//(WINVER >= 0x500)
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x490)) {
const DWORD ASFW_ANY = -1;
const LSFW_LOCK = 1;
const LSFW_UNLOCK = 2;
}
static if (_WIN32_WINNT >= 0x500) {
const LWA_COLORKEY=0x01;
const LWA_ALPHA=0x02;
const ULW_COLORKEY=0x01;
const ULW_ALPHA=0x02;
const ULW_OPAQUE=0x04;
}
const GA_PARENT = 1;
const GA_ROOT = 2;
const GA_ROOTOWNER = 3;
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x410)) {
const MONITOR_DEFAULTTONULL = 0;
const MONITOR_DEFAULTTOPRIMARY = 1;
const MONITOR_DEFAULTTONEAREST = 2;
const MONITORINFOF_PRIMARY = 1;
const EDS_RAWMODE = 0x00000002;
const ISMEX_NOSEND = 0x00000000;
const ISMEX_SEND = 0x00000001;
const ISMEX_NOTIFY = 0x00000002;
const ISMEX_CALLBACK = 0x00000004;
const ISMEX_REPLIED = 0x00000008;
}
static if (_WIN32_WINNT >= 0x500) {
const GR_GDIOBJECTS = 0;
const GR_USEROBJECTS = 1;
}
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x490)) {
const GMMP_USE_DISPLAY_POINTS = 1;
const GMMP_USE_HIGH_RESOLUTION_POINTS = 2;
}
static if (_WIN32_WINNT >= 0x501) {
const PW_CLIENTONLY = 0x00000001;
const RIM_INPUT = 0x00000000;
const RIM_INPUTSINK = 0x00000001;
const RIM_TYPEMOUSE = 0x00000000;
const RIM_TYPEKEYBOARD = 0x00000001;
const RIM_TYPEHID = 0x00000002;
const MOUSE_MOVE_RELATIVE = 0x00000000;
const MOUSE_MOVE_ABSOLUTE = 0x00000001;
const MOUSE_VIRTUAL_DESKTOP = 0x00000002;
const MOUSE_ATTRIBUTES_CHANGED = 0x00000004;
const RI_MOUSE_LEFT_BUTTON_DOWN = 0x0001;
const RI_MOUSE_LEFT_BUTTON_UP = 0x0002;
const RI_MOUSE_RIGHT_BUTTON_DOWN = 0x0004;
const RI_MOUSE_RIGHT_BUTTON_UP = 0x0008;
const RI_MOUSE_MIDDLE_BUTTON_DOWN = 0x0010;
const RI_MOUSE_MIDDLE_BUTTON_UP = 0x0020;
const RI_MOUSE_BUTTON_1_DOWN = RI_MOUSE_LEFT_BUTTON_DOWN;
const RI_MOUSE_BUTTON_1_UP = RI_MOUSE_LEFT_BUTTON_UP;
const RI_MOUSE_BUTTON_2_DOWN = RI_MOUSE_RIGHT_BUTTON_DOWN;
const RI_MOUSE_BUTTON_2_UP = RI_MOUSE_RIGHT_BUTTON_UP;
const RI_MOUSE_BUTTON_3_DOWN = RI_MOUSE_MIDDLE_BUTTON_DOWN;
const RI_MOUSE_BUTTON_3_UP = RI_MOUSE_MIDDLE_BUTTON_UP;
const RI_MOUSE_BUTTON_4_DOWN = 0x0040;
const RI_MOUSE_BUTTON_4_UP = 0x0080;
const RI_MOUSE_BUTTON_5_DOWN = 0x0100;
const RI_MOUSE_BUTTON_5_UP = 0x0200;
const RI_MOUSE_WHEEL = 0x0400;
const KEYBOARD_OVERRUN_MAKE_CODE = 0x00ff;
const RI_KEY_MAKE = 0x0000;
const RI_KEY_BREAK = 0x0001;
const RI_KEY_E0 = 0x0002;
const RI_KEY_E1 = 0x0004;
const RI_KEY_TERMSRV_SET_LED = 0x0008;
const RI_KEY_TERMSRV_SHADOW = 0x0010;
const RID_INPUT = 0x10000003;
const RID_HEADER = 0x10000005;
const RIDI_PREPARSEDDATA = 0x20000005;
const RIDI_DEVICENAME = 0x20000007;
const RIDI_DEVICEINFO = 0x2000000b;
const RIDEV_REMOVE = 0x00000001;
const RIDEV_EXCLUDE = 0x00000010;
const RIDEV_PAGEONLY = 0x00000020;
const RIDEV_NOLEGACY = 0x00000030;
const RIDEV_INPUTSINK = 0x00000100;
const RIDEV_CAPTUREMOUSE = 0x00000200;
const RIDEV_NOHOTKEYS = 0x00000200;
const RIDEV_APPKEYS = 0x00000400;
}
// Callbacks
// ---------
extern (Windows) {
alias BOOL function (HWND, UINT, WPARAM, LPARAM) DLGPROC;
alias void function (HWND, UINT, UINT, DWORD) TIMERPROC;
alias BOOL function (HDC, LPARAM, int) GRAYSTRINGPROC;
alias LRESULT function (int, WPARAM, LPARAM) HOOKPROC;
alias BOOL function (HWND, LPCSTR, HANDLE) PROPENUMPROCA;
alias BOOL function (HWND, LPCWSTR, HANDLE) PROPENUMPROCW;
alias BOOL function (HWND, LPSTR, HANDLE, DWORD) PROPENUMPROCEXA;
alias BOOL function (HWND, LPWSTR, HANDLE, DWORD) PROPENUMPROCEXW;
alias int function (LPSTR, int, int, int) EDITWORDBREAKPROCA;
alias int function (LPWSTR, int, int, int) EDITWORDBREAKPROCW;
alias LRESULT function (HWND, UINT, WPARAM, LPARAM) WNDPROC;
alias BOOL function (HDC, LPARAM, WPARAM, int, int) DRAWSTATEPROC;
alias BOOL function (HWND, LPARAM) WNDENUMPROC;
alias BOOL function (HWND, LPARAM) ENUMWINDOWSPROC;
alias void function (LPHELPINFO) MSGBOXCALLBACK;
static if (WINVER >= 0x410) {
alias BOOL function (HMONITOR, HDC, LPRECT, LPARAM) MONITORENUMPROC;
}
alias BOOL function (LPSTR, LPARAM) NAMEENUMPROCA;
alias BOOL function (LPWSTR, LPARAM) NAMEENUMPROCW;
alias void function (HWND, UINT, DWORD, LRESULT) SENDASYNCPROC;
alias NAMEENUMPROCA DESKTOPENUMPROCA;
alias NAMEENUMPROCW DESKTOPENUMPROCW;
alias NAMEENUMPROCA WINSTAENUMPROCA;
alias NAMEENUMPROCW WINSTAENUMPROCW;
}
typedef HANDLE HHOOK;
typedef HANDLE HDWP;
typedef HANDLE HDEVNOTIFY;
struct ACCEL {
BYTE fVirt;
WORD key;
WORD cmd;
}
alias ACCEL* LPACCEL;
struct ACCESSTIMEOUT {
UINT cbSize = ACCESSTIMEOUT.sizeof;
DWORD dwFlags;
DWORD iTimeOutMSec;
}
alias ACCESSTIMEOUT* LPACCESSTIMEOUT;
struct ANIMATIONINFO {
UINT cbSize = ANIMATIONINFO.sizeof;
int iMinAnimate;
}
alias ANIMATIONINFO* LPANIMATIONINFO;
struct CREATESTRUCTA {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCSTR lpszName;
LPCSTR lpszClass;
DWORD dwExStyle;
}
alias CREATESTRUCTA* LPCREATESTRUCTA;
struct CREATESTRUCTW {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCWSTR lpszName;
LPCWSTR lpszClass;
DWORD dwExStyle;
}
alias CREATESTRUCTW* LPCREATESTRUCTW;
struct CBT_CREATEWNDA {
LPCREATESTRUCTA lpcs;
HWND hwndInsertAfter;
}
alias CBT_CREATEWNDA* LPCBT_CREATEWNDA;
struct CBT_CREATEWNDW {
LPCREATESTRUCTW lpcs;
HWND hwndInsertAfter;
}
alias CBT_CREATEWNDW* LPCBT_CREATEWNDW;
struct CBTACTIVATESTRUCT {
BOOL fMouse;
HWND hWndActive;
}
alias CBTACTIVATESTRUCT* LPCBTACTIVATESTRUCT;
struct CLIENTCREATESTRUCT {
HANDLE hWindowMenu;
UINT idFirstChild;
}
alias CLIENTCREATESTRUCT* LPCLIENTCREATESTRUCT;
struct COMPAREITEMSTRUCT {
UINT CtlType;
UINT CtlID;
HWND hwndItem;
UINT itemID1;
DWORD itemData1;
UINT itemID2;
DWORD itemData2;
DWORD dwLocaleId;
}
alias COMPAREITEMSTRUCT* LPCOMPAREITEMSTRUCT;
struct COPYDATASTRUCT {
DWORD dwData;
DWORD cbData;
PVOID lpData;
}
alias COPYDATASTRUCT* PCOPYDATASTRUCT;
struct CURSORSHAPE {
int xHotSpot;
int yHotSpot;
int cx;
int cy;
int cbWidth;
BYTE Planes;
BYTE BitsPixel;
}
alias CURSORSHAPE* LPCURSORSHAPE;
struct CWPRETSTRUCT {
LRESULT lResult;
LPARAM lParam;
WPARAM wParam;
DWORD message;
HWND hwnd;
}
struct CWPSTRUCT {
LPARAM lParam;
WPARAM wParam;
UINT message;
HWND hwnd;
}
alias CWPSTRUCT* PCWPSTRUCT;
struct DEBUGHOOKINFO {
DWORD idThread;
DWORD idThreadInstaller;
LPARAM lParam;
WPARAM wParam;
int code;
}
alias DEBUGHOOKINFO* PDEBUGHOOKINFO, LPDEBUGHOOKINFO;
struct DELETEITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
HWND hwndItem;
UINT itemData;
}
alias DELETEITEMSTRUCT* PDELETEITEMSTRUCT, LPDELETEITEMSTRUCT;
align(2):
struct DLGITEMTEMPLATE {
DWORD style;
DWORD dwExtendedStyle;
short x;
short y;
short cx;
short cy;
WORD id;
}
alias DLGITEMTEMPLATE* LPDLGITEMTEMPLATE;
struct DLGTEMPLATE {
DWORD style;
DWORD dwExtendedStyle;
WORD cdit;
short x;
short y;
short cx;
short cy;
}
alias DLGTEMPLATE* LPDLGTEMPLATE, LPDLGTEMPLATEA, LPDLGTEMPLATEW;
alias DLGTEMPLATE* LPCDLGTEMPLATE;
align:
struct DRAWITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemAction;
UINT itemState;
HWND hwndItem;
HDC hDC;
RECT rcItem;
DWORD itemData;
}
alias DRAWITEMSTRUCT* LPDRAWITEMSTRUCT, PDRAWITEMSTRUCT;
struct DRAWTEXTPARAMS {
UINT cbSize = DRAWTEXTPARAMS.sizeof;
int iTabLength;
int iLeftMargin;
int iRightMargin;
UINT uiLengthDrawn;
}
alias DRAWTEXTPARAMS* LPDRAWTEXTPARAMS;
struct PAINTSTRUCT {
HDC hdc;
BOOL fErase;
RECT rcPaint;
BOOL fRestore;
BOOL fIncUpdate;
BYTE[32] rgbReserved;
}
alias PAINTSTRUCT* LPPAINTSTRUCT;
struct MSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
}
alias MSG* LPMSG, PMSG;
struct ICONINFO {
BOOL fIcon;
DWORD xHotspot;
DWORD yHotspot;
HBITMAP hbmMask;
HBITMAP hbmColor;
}
alias ICONINFO* PICONINFO;
struct NMHDR {
HWND hwndFrom;
UINT idFrom;
UINT code;
}
alias NMHDR* LPNMHDR;
struct WNDCLASSA {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
}
alias WNDCLASSA* LPWNDCLASSA, PWNDCLASSA;
struct WNDCLASSW {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
}
alias WNDCLASSW* LPWNDCLASSW, PWNDCLASSW;
struct WNDCLASSEXA {
UINT cbSize = WNDCLASSEXA.sizeof;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
HICON hIconSm;
}
alias WNDCLASSEXA* LPWNDCLASSEXA, PWNDCLASSEXA;
struct WNDCLASSEXW {
UINT cbSize = WNDCLASSEXW.sizeof;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
HICON hIconSm;
}
alias WNDCLASSEXW* LPWNDCLASSEXW, PWNDCLASSEXW;
struct MENUITEMINFOA {
UINT cbSize = MENUITEMINFOA.sizeof;
UINT fMask;
UINT fType;
UINT fState;
UINT wID;
HMENU hSubMenu;
HBITMAP hbmpChecked;
HBITMAP hbmpUnchecked;
DWORD dwItemData;
LPSTR dwTypeData;
UINT cch;
static if (_WIN32_WINNT >= 0x500) {
HBITMAP hbmpItem;
}
}
alias MENUITEMINFOA* LPMENUITEMINFOA;
alias MENUITEMINFOA* LPCMENUITEMINFOA;
struct MENUITEMINFOW {
UINT cbSize = MENUITEMINFOW.sizeof;
UINT fMask;
UINT fType;
UINT fState;
UINT wID;
HMENU hSubMenu;
HBITMAP hbmpChecked;
HBITMAP hbmpUnchecked;
DWORD dwItemData;
LPWSTR dwTypeData;
UINT cch;
static if (_WIN32_WINNT >= 0x500) {
HBITMAP hbmpItem;
}
}
alias MENUITEMINFOW* LPMENUITEMINFOW;
alias MENUITEMINFOW* LPCMENUITEMINFOW;
struct SCROLLINFO {
UINT cbSize = this.sizeof;
UINT fMask;
int nMin;
int nMax;
UINT nPage;
int nPos;
int nTrackPos;
}
alias SCROLLINFO* LPSCROLLINFO;
alias SCROLLINFO* LPCSCROLLINFO;
struct WINDOWPLACEMENT {
UINT length;
UINT flags;
UINT showCmd;
POINT ptMinPosition;
POINT ptMaxPosition;
RECT rcNormalPosition;
}
alias WINDOWPLACEMENT* LPWINDOWPLACEMENT, PWINDOWPLACEMENT;
struct MENUITEMTEMPLATEHEADER {
WORD versionNumber;
WORD offset;
}
struct MENUITEMTEMPLATE {
WORD mtOption;
WORD mtID;
WCHAR mtString[1];
}
alias void MENUTEMPLATE, MENUTEMPLATEA, MENUTEMPLATEW;
alias MENUTEMPLATE* LPMENUTEMPLATEA, LPMENUTEMPLATEW, LPMENUTEMPLATE;
struct HELPINFO {
UINT cbSize = this.sizeof;
int iContextType;
int iCtrlId;
HANDLE hItemHandle;
DWORD dwContextId;
POINT MousePos;
}
alias HELPINFO* LPHELPINFO;
struct MSGBOXPARAMSA {
UINT cbSize = this.sizeof;
HWND hwndOwner;
HINSTANCE hInstance;
LPCSTR lpszText;
LPCSTR lpszCaption;
DWORD dwStyle;
LPCSTR lpszIcon;
DWORD dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
}
alias MSGBOXPARAMSA* PMSGBOXPARAMSA, LPMSGBOXPARAMSA;
struct MSGBOXPARAMSW {
UINT cbSize = this.sizeof;
HWND hwndOwner;
HINSTANCE hInstance;
LPCWSTR lpszText;
LPCWSTR lpszCaption;
DWORD dwStyle;
LPCWSTR lpszIcon;
DWORD dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
}
alias MSGBOXPARAMSW* PMSGBOXPARAMSW, LPMSGBOXPARAMSW;
struct USEROBJECTFLAGS {
BOOL fInherit;
BOOL fReserved;
DWORD dwFlags;
}
struct FILTERKEYS {
UINT cbSize = this.sizeof;
DWORD dwFlags;
DWORD iWaitMSec;
DWORD iDelayMSec;
DWORD iRepeatMSec;
DWORD iBounceMSec;
}
struct HIGHCONTRASTA {
UINT cbSize = this.sizeof;
DWORD dwFlags;
LPSTR lpszDefaultScheme;
}
alias HIGHCONTRASTA* LPHIGHCONTRASTA;
struct HIGHCONTRASTW {
UINT cbSize = this.sizeof;
DWORD dwFlags;
LPWSTR lpszDefaultScheme;
}
alias HIGHCONTRASTW* LPHIGHCONTRASTW;
struct ICONMETRICSA {
UINT cbSize = this.sizeof;
int iHorzSpacing;
int iVertSpacing;
int iTitleWrap;
LOGFONTA lfFont;
}
alias ICONMETRICSA* LPICONMETRICSA;
struct ICONMETRICSW {
UINT cbSize = this.sizeof;
int iHorzSpacing;
int iVertSpacing;
int iTitleWrap;
LOGFONTW lfFont;
}
alias ICONMETRICSW* LPICONMETRICSW;
struct MINIMIZEDMETRICS {
UINT cbSize = this.sizeof;
int iWidth;
int iHorzGap;
int iVertGap;
int iArrange;
}
alias MINIMIZEDMETRICS* LPMINIMIZEDMETRICS;
struct MOUSEKEYS {
UINT cbSize = this.sizeof;
DWORD dwFlags;
DWORD iMaxSpeed;
DWORD iTimeToMaxSpeed;
DWORD iCtrlSpeed;
DWORD dwReserved1;
DWORD dwReserved2;
}
alias MOUSEKEYS* LPMOUSEKEYS;
struct NONCLIENTMETRICSA {
UINT cbSize = this.sizeof;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONTA lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONTA lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONTA lfMenuFont;
LOGFONTA lfStatusFont;
LOGFONTA lfMessageFont;
}
alias NONCLIENTMETRICSA* LPNONCLIENTMETRICSA;
struct NONCLIENTMETRICSW {
UINT cbSize = this.sizeof;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONTW lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONTW lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONTW lfMenuFont;
LOGFONTW lfStatusFont;
LOGFONTW lfMessageFont;
}
alias NONCLIENTMETRICSW* LPNONCLIENTMETRICSW;
struct SERIALKEYSA {
UINT cbSize = this.sizeof;
DWORD dwFlags;
LPSTR lpszActivePort;
LPSTR lpszPort;
UINT iBaudRate;
UINT iPortState;
UINT iActive;
}
alias SERIALKEYSA* LPSERIALKEYSA;
struct SERIALKEYSW {
UINT cbSize = this.sizeof;
DWORD dwFlags;
LPWSTR lpszActivePort;
LPWSTR lpszPort;
UINT iBaudRate;
UINT iPortState;
UINT iActive;
}
alias SERIALKEYSW* LPSERIALKEYSW;
struct SOUNDSENTRYA {
UINT cbSize = this.sizeof;
DWORD dwFlags;
DWORD iFSTextEffect;
DWORD iFSTextEffectMSec;
DWORD iFSTextEffectColorBits;
DWORD iFSGrafEffect;
DWORD iFSGrafEffectMSec;
DWORD iFSGrafEffectColor;
DWORD iWindowsEffect;
DWORD iWindowsEffectMSec;
LPSTR lpszWindowsEffectDLL;
DWORD iWindowsEffectOrdinal;
}
alias SOUNDSENTRYA* LPSOUNDSENTRYA;
struct SOUNDSENTRYW {
UINT cbSize = this.sizeof;
DWORD dwFlags;
DWORD iFSTextEffect;
DWORD iFSTextEffectMSec;
DWORD iFSTextEffectColorBits;
DWORD iFSGrafEffect;
DWORD iFSGrafEffectMSec;
DWORD iFSGrafEffectColor;
DWORD iWindowsEffect;
DWORD iWindowsEffectMSec;
LPWSTR lpszWindowsEffectDLL;
DWORD iWindowsEffectOrdinal;
}
alias SOUNDSENTRYW* LPSOUNDSENTRYW;
struct STICKYKEYS {
DWORD cbSize = this.sizeof;
DWORD dwFlags;
}
alias STICKYKEYS* LPSTICKYKEYS;
struct TOGGLEKEYS {
DWORD cbSize = this.sizeof;
DWORD dwFlags;
}
struct MOUSEHOOKSTRUCT {
POINT pt;
HWND hwnd;
UINT wHitTestCode;
DWORD dwExtraInfo;
}
alias MOUSEHOOKSTRUCT* LPMOUSEHOOKSTRUCT, PMOUSEHOOKSTRUCT;
struct TRACKMOUSEEVENT {
DWORD cbSize = this.sizeof;
DWORD dwFlags;
HWND hwndTrack;
DWORD dwHoverTime;
}
alias TRACKMOUSEEVENT* LPTRACKMOUSEEVENT;
struct TPMPARAMS {
UINT cbSize = this.sizeof;
RECT rcExclude;
}
alias TPMPARAMS* LPTPMPARAMS;
struct EVENTMSG {
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
}
alias EVENTMSG* PEVENTMSGMSG, LPEVENTMSGMSG, PEVENTMSG, LPEVENTMSG;
struct WINDOWPOS {
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;
}
alias WINDOWPOS* PWINDOWPOS, LPWINDOWPOS;
struct NCCALCSIZE_PARAMS {
RECT rgrc[3];
PWINDOWPOS lppos;
}
alias NCCALCSIZE_PARAMS* LPNCCALCSIZE_PARAMS;
struct MDICREATESTRUCTA {
LPCSTR szClass;
LPCSTR szTitle;
HANDLE hOwner;
int x;
int y;
int cx;
int cy;
DWORD style;
LPARAM lParam;
}
alias MDICREATESTRUCTA* LPMDICREATESTRUCTA;
struct MDICREATESTRUCTW {
LPCWSTR szClass;
LPCWSTR szTitle;
HANDLE hOwner;
int x;
int y;
int cx;
int cy;
DWORD style;
LPARAM lParam;
}
alias MDICREATESTRUCTW* LPMDICREATESTRUCTW;
struct MINMAXINFO {
POINT ptReserved;
POINT ptMaxSize;
POINT ptMaxPosition;
POINT ptMinTrackSize;
POINT ptMaxTrackSize;
}
alias MINMAXINFO* PMINMAXINFO, LPMINMAXINFO;
struct MDINEXTMENU {
HMENU hmenuIn;
HMENU hmenuNext;
HWND hwndNext;
}
alias MDINEXTMENU* PMDINEXTMENU, LPMDINEXTMENU;
struct MEASUREITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemWidth;
UINT itemHeight;
DWORD itemData;
}
alias MEASUREITEMSTRUCT* PMEASUREITEMSTRUCT, LPMEASUREITEMSTRUCT;
struct DROPSTRUCT {
HWND hwndSource;
HWND hwndSink;
DWORD wFmt;
DWORD dwData;
POINT ptDrop;
DWORD dwControlData;
}
alias DROPSTRUCT* PDROPSTRUCT, LPDROPSTRUCT;
alias DWORD HELPPOLY;
struct MULTIKEYHELPA {
DWORD mkSize;
CHAR mkKeylist;
CHAR szKeyphrase[1];
}
alias MULTIKEYHELPA* PMULTIKEYHELPA, LPMULTIKEYHELPA;
struct MULTIKEYHELPW {
DWORD mkSize;
WCHAR mkKeylist;
WCHAR szKeyphrase[1];
}
alias MULTIKEYHELPW* PMULTIKEYHELPW, LPMULTIKEYHELPW;
struct HELPWININFOA {
int wStructSize;
int x;
int y;
int dx;
int dy;
int wMax;
CHAR rgchMember[2];
}
alias HELPWININFOA* PHELPWININFOA, LPHELPWININFOA;
struct HELPWININFOW {
int wStructSize;
int x;
int y;
int dx;
int dy;
int wMax;
WCHAR rgchMember[2];
}
alias HELPWININFOW* PHELPWININFOW, LPHELPWININFOW;
struct STYLESTRUCT {
DWORD styleOld;
DWORD styleNew;
}
alias STYLESTRUCT* LPSTYLESTRUCT;
struct ALTTABINFO {
DWORD cbSize = this.sizeof;
int cItems;
int cColumns;
int cRows;
int iColFocus;
int iRowFocus;
int cxItem;
int cyItem;
POINT ptStart;
}
alias ALTTABINFO* PALTTABINFO, LPALTTABINFO;
struct COMBOBOXINFO {
DWORD cbSize = this.sizeof;
RECT rcItem;
RECT rcButton;
DWORD stateButton;
HWND hwndCombo;
HWND hwndItem;
HWND hwndList;
}
alias COMBOBOXINFO* PCOMBOBOXINFO, LPCOMBOBOXINFO;
struct CURSORINFO {
DWORD cbSize = this.sizeof;
DWORD flags;
HCURSOR hCursor;
POINT ptScreenPos;
}
alias CURSORINFO* PCURSORINFO, LPCURSORINFO;
struct MENUBARINFO {
DWORD cbSize = this.sizeof;
RECT rcBar;
HMENU hMenu;
HWND hwndMenu;
byte bf_; // Simulated bitfield
// BOOL fBarFocused:1;
// BOOL fFocused:1;
bool fBarFocused() { return (bf_ & 1) == 1; }
bool fFocused() { return (bf_ & 2) == 2; }
void fBarFocused(bool b) { bf_ = cast(byte)((bf_ & 0xFE) | b); }
void fFocused(bool b) { bf_ = cast(byte)(b ? (bf_ | 2) : bf_ & 0xFD); }
}
alias MENUBARINFO* PMENUBARINFO;
struct MENUINFO {
DWORD cbSize = this.sizeof;
DWORD fMask;
DWORD dwStyle;
UINT cyMax;
HBRUSH hbrBack;
DWORD dwContextHelpID;
ULONG_PTR dwMenuData;
}
alias MENUINFO* LPMENUINFO, LPCMENUINFO;
const CCHILDREN_SCROLLBAR=5;
struct SCROLLBARINFO {
DWORD cbSize = this.sizeof;
RECT rcScrollBar;
int dxyLineButton;
int xyThumbTop;
int xyThumbBottom;
int reserved;
DWORD rgstate[CCHILDREN_SCROLLBAR+1];
}
alias SCROLLBARINFO* PSCROLLBARINFO, LPSCROLLBARINFO;
const CCHILDREN_TITLEBAR=5;
struct TITLEBARINFO {
DWORD cbSize = TITLEBARINFO.sizeof;
RECT rcTitleBar;
DWORD[CCHILDREN_TITLEBAR+1] rgstate;
}
alias TITLEBARINFO* PTITLEBARINFO, LPTITLEBARINFO;
struct WINDOWINFO {
DWORD cbSize = WINDOWINFO.sizeof;
RECT rcWindow;
RECT rcClient;
DWORD dwStyle;
DWORD dwExStyle;
DWORD dwWindowStatus;
UINT cxWindowBorders;
UINT cyWindowBorders;
ATOM atomWindowType;
WORD wCreatorVersion;
}
alias WINDOWINFO* PWINDOWINFO, LPWINDOWINFO;
struct LASTINPUTINFO {
UINT cbSize = this.sizeof;
DWORD dwTime;
}
alias LASTINPUTINFO* PLASTINPUTINFO;
struct MONITORINFO {
DWORD cbSize = this.sizeof;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
}
alias MONITORINFO* LPMONITORINFO;
const CCHDEVICENAME=32;
struct MONITORINFOEXA {
DWORD cbSize = MONITORINFOEXA.sizeof;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
CHAR[CCHDEVICENAME] szDevice;
}
alias MONITORINFOEXA* LPMONITORINFOEXA;
struct MONITORINFOEXW {
DWORD cbSize = MONITORINFOEXW.sizeof;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
WCHAR[CCHDEVICENAME] szDevice;
}
alias MONITORINFOEXW* LPMONITORINFOEXW;
struct KBDLLHOOKSTRUCT {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
DWORD dwExtraInfo;
}
alias KBDLLHOOKSTRUCT* LPKBDLLHOOKSTRUCT, PKBDLLHOOKSTRUCT;
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x410)) {
struct FLASHWINFO {
UINT cbSize = this.sizeof;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
}
alias FLASHWINFO* PFLASHWINFO;
}
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x490)) {
struct MOUSEMOVEPOINT {
int x;
int y;
DWORD time;
ULONG_PTR dwExtraInfo;
}
alias MOUSEMOVEPOINT* PMOUSEMOVEPOINT, LPMOUSEMOVEPOINT;
}
static if (_WIN32_WINNT >= 0x403) {
struct MOUSEINPUT {
LONG dx;
LONG dy;
DWORD mouseData;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
}
alias MOUSEINPUT* PMOUSEINPUT;
struct KEYBDINPUT {
WORD wVk;
WORD wScan;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
}
alias KEYBDINPUT* PKEYBDINPUT;
struct HARDWAREINPUT {
DWORD uMsg;
WORD wParamL;
WORD wParamH;
}
alias HARDWAREINPUT* PHARDWAREINPUT;
struct INPUT {
DWORD type;
union {
MOUSEINPUT mi;
KEYBDINPUT ki;
HARDWAREINPUT hi;
}
}
alias INPUT* PINPUT, LPINPUT;
}// (_WIN32_WINNT >= 0x403)
static if (WINVER >= 0x500) {
struct GUITHREADINFO {
DWORD cbSize = this.sizeof;
DWORD flags;
HWND hwndActive;
HWND hwndFocus;
HWND hwndCapture;
HWND hwndMenuOwner;
HWND hwndMoveSize;
HWND hwndCaret;
RECT rcCaret;
}
alias GUITHREADINFO* PGUITHREADINFO, LPGUITHREADINFO;
extern (Windows) {
alias void function (HWINEVENTHOOK, DWORD, HWND, LONG, LONG, DWORD, DWORD) WINEVENTPROC;
}
}// (WINVER >= 0x500)
static if (_WIN32_WINNT >= 0x501) {
struct BSMINFO {
UINT cbSize = this.sizeof;
HDESK hdesk;
HWND hwnd;
LUID luid;
}
alias BSMINFO* PBSMINFO;
typedef HANDLE HRAWINPUT;
struct RAWINPUTHEADER {
DWORD dwType;
DWORD dwSize;
HANDLE hDevice;
WPARAM wParam;
}
alias RAWINPUTHEADER* PRAWINPUTHEADER;
struct RAWMOUSE {
USHORT usFlags;
union {
ULONG ulButtons;
struct {
USHORT usButtonFlags;
USHORT usButtonData;
}
}
ULONG ulRawButtons;
LONG lLastX;
LONG lLastY;
ULONG ulExtraInformation;
}
alias RAWMOUSE* PRAWMOUSE, LPRAWMOUSE;
struct RAWKEYBOARD {
USHORT MakeCode;
USHORT Flags;
USHORT Reserved;
USHORT VKey;
UINT Message;
ULONG ExtraInformation;
}
alias RAWKEYBOARD* PRAWKEYBOARD, LPRAWKEYBOARD;
struct RAWHID {
DWORD dwSizeHid;
DWORD dwCount;
BYTE bRawData;
}
alias RAWHID* PRAWHID, LPRAWHID;
struct RAWINPUT {
RAWINPUTHEADER header;
union _data {
RAWMOUSE mouse;
RAWKEYBOARD keyboard;
RAWHID hid;
}
_data data;
}
alias RAWINPUT* PRAWINPUT, LPRAWINPUT;
struct RAWINPUTDEVICE {
USHORT usUsagePage;
USHORT usUsage;
DWORD dwFlags;
HWND hwndTarget;
}
alias RAWINPUTDEVICE* PRAWINPUTDEVICE, LPRAWINPUTDEVICE;
alias RAWINPUTDEVICE* PCRAWINPUTDEVICE;
struct RAWINPUTDEVICELIST {
HANDLE hDevice;
DWORD dwType;
}
alias RAWINPUTDEVICELIST* PRAWINPUTDEVICELIST;
struct RID_DEVICE_INFO_MOUSE {
DWORD dwId;
DWORD dwNumberOfButtons;
DWORD dwSampleRate;
BOOL fHasHorizontalWheel;
}
struct RID_DEVICE_INFO_KEYBOARD {
DWORD dwType;
DWORD dwSubType;
DWORD dwKeyboardMode;
DWORD dwNumberOfFunctionKeys;
DWORD dwNumberOfIndicators;
DWORD dwNumberOfKeysTotal;
}
struct RID_DEVICE_INFO_HID {
DWORD dwVendorId;
DWORD dwProductId;
DWORD dwVersionNumber;
USHORT usUsagePage;
USHORT usUsage;
}
struct RID_DEVICE_INFO {
DWORD cbSize = this.sizeof;
DWORD dwType;
union {
RID_DEVICE_INFO_MOUSE mouse;
RID_DEVICE_INFO_KEYBOARD keyboard;
RID_DEVICE_INFO_HID hid;
}
}
}// (_WIN32_WINNT >= 0x501)
struct MSLLHOOKSTRUCT {
POINT pt;
DWORD mouseData;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
}
alias MSLLHOOKSTRUCT* PMSLLHOOKSTRUCT;
alias CharToOemA AnsiToOem;
alias OemToCharA OemToAnsi;
alias CharToOemBuffA AnsiToOemBuff;
alias OemToCharBuffA OemToAnsiBuff;
alias CharUpperA AnsiUpper;
alias CharUpperBuffA AnsiUpperBuff;
alias CharLowerA AnsiLower;
alias CharLowerBuffA AnsiLowerBuff;
alias CharNextA AnsiNext;
alias CharPrevA AnsiPrev;
alias MAKELONG MAKEWPARAM;
alias MAKELONG MAKELPARAM;
alias MAKELONG MAKELRESULT;
//MACRO #define POINTSTOPOINT(p, ps) { (p).x=LOWORD(*(DWORD* )&ps); (p).y=HIWORD(*(DWORD* )&ps); }
//MACRO #define POINTTOPOINTS(p) ((POINTS)MAKELONG((p).x, (p).y))
extern (Windows) {
HKL ActivateKeyboardLayout(HKL, UINT);
BOOL AdjustWindowRect(LPRECT, DWORD, BOOL);
BOOL AdjustWindowRectEx(LPRECT, DWORD, BOOL, DWORD);
BOOL AnyPopup();
BOOL AppendMenuA(HMENU, UINT, UINT_PTR, LPCSTR);
BOOL AppendMenuW(HMENU, UINT, UINT_PTR, LPCWSTR);
UINT ArrangeIconicWindows(HWND);
BOOL AttachThreadInput(DWORD, DWORD, BOOL);
HDWP BeginDeferWindowPos(int);
HDC BeginPaint(HWND, LPPAINTSTRUCT);
BOOL BringWindowToTop(HWND);
BOOL CallMsgFilterA(LPMSG, INT);
BOOL CallMsgFilterW(LPMSG, INT);
LRESULT CallNextHookEx(HHOOK, int, WPARAM, LPARAM);
LRESULT CallWindowProcA(WNDPROC, HWND, UINT, WPARAM, LPARAM);
LRESULT CallWindowProcW(WNDPROC, HWND, UINT, WPARAM, LPARAM);
WORD CascadeWindows(HWND, UINT, LPCRECT, UINT, HWND*);
BOOL ChangeClipboardChain(HWND, HWND);
LONG ChangeDisplaySettingsA(PDEVMODEA, DWORD);
LONG ChangeDisplaySettingsW(PDEVMODEW, DWORD);
LONG ChangeDisplaySettingsExA(LPCSTR, LPDEVMODEA, HWND, DWORD, LPVOID);
LONG ChangeDisplaySettingsExW(LPCWSTR, LPDEVMODEW, HWND, DWORD, LPVOID);
BOOL ChangeMenuA(HMENU, UINT, LPCSTR, UINT, UINT);
BOOL ChangeMenuW(HMENU, UINT, LPCWSTR, UINT, UINT);
LPSTR CharLowerA(LPSTR);
LPWSTR CharLowerW(LPWSTR);
DWORD CharLowerBuffA(LPSTR, DWORD);
DWORD CharLowerBuffW(LPWSTR, DWORD);
LPSTR CharNextA(LPCSTR);
LPWSTR CharNextW(LPCWSTR);
LPSTR CharNextExA(WORD, LPCSTR, DWORD);
LPWSTR CharNextExW(WORD, LPCWSTR, DWORD);
LPSTR CharPrevA(LPCSTR, LPCSTR);
LPWSTR CharPrevW(LPCWSTR, LPCWSTR);
LPSTR CharPrevExA(WORD, LPCSTR, LPCSTR, DWORD);
LPWSTR CharPrevExW(WORD, LPCWSTR, LPCWSTR, DWORD);
BOOL CharToOemA(LPCSTR, LPSTR);
BOOL CharToOemW(LPCWSTR, LPSTR);
BOOL CharToOemBuffA(LPCSTR, LPSTR, DWORD);
BOOL CharToOemBuffW(LPCWSTR, LPSTR, DWORD);
LPSTR CharUpperA(LPSTR);
LPWSTR CharUpperW(LPWSTR);
DWORD CharUpperBuffA(LPSTR, DWORD);
DWORD CharUpperBuffW(LPWSTR, DWORD);
BOOL CheckDlgButton(HWND, int, UINT);
DWORD CheckMenuItem(HMENU, UINT, UINT);
BOOL CheckMenuRadioItem(HMENU, UINT, UINT, UINT, UINT);
BOOL CheckRadioButton(HWND, int, int, int);
HWND ChildWindowFromPoint(HWND, POINT);
HWND ChildWindowFromPointEx(HWND, POINT, UINT);
BOOL ClientToScreen(HWND, LPPOINT);
BOOL ClipCursor(LPCRECT);
BOOL CloseClipboard();
BOOL CloseDesktop(HDESK);
BOOL CloseWindow(HWND);
BOOL CloseWindowStation(HWINSTA);
int CopyAcceleratorTableA(HACCEL, LPACCEL, int);
int CopyAcceleratorTableW(HACCEL, LPACCEL, int);
HICON CopyIcon(HICON);
HANDLE CopyImage(HANDLE, UINT, int, int, UINT);
BOOL CopyRect(LPRECT, LPCRECT);
int CountClipboardFormats();
HACCEL CreateAcceleratorTableA(LPACCEL, int);
HACCEL CreateAcceleratorTableW(LPACCEL, int);
BOOL CreateCaret(HWND, HBITMAP, int, int);
HCURSOR CreateCursor(HINSTANCE, int, int, int, int, PCVOID, PCVOID);
HDESK CreateDesktopA(LPCSTR, LPCSTR, LPDEVMODEA, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES);
HDESK CreateDesktopW(LPCWSTR, LPCWSTR, LPDEVMODEW, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES);
HWND CreateDialogParamA(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM);
HWND CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
HWND CreateDialogIndirectParamA(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
HWND CreateDialogIndirectParamW(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
HICON CreateIcon(HINSTANCE, int, int, BYTE, BYTE, BYTE*, BYTE*);
HICON CreateIconFromResource(PBYTE, DWORD, BOOL, DWORD);
HICON CreateIconFromResourceEx(PBYTE, DWORD, BOOL, DWORD, int, int, UINT);
HICON CreateIconIndirect(PICONINFO);
HWND CreateMDIWindowA(LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HINSTANCE, LPARAM);
HWND CreateMDIWindowW(LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HINSTANCE, LPARAM);
HMENU CreateMenu();
HMENU CreatePopupMenu();
HWND CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
HWND CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
HWINSTA CreateWindowStationA(LPSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES);
HWINSTA CreateWindowStationW(LPWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES);
LRESULT DefDlgProcA(HWND, UINT, WPARAM, LPARAM);
LRESULT DefDlgProcW(HWND, UINT, WPARAM, LPARAM);
HDWP DeferWindowPos(HDWP, HWND, HWND, int, int, int, int, UINT);
LRESULT DefFrameProcA(HWND, HWND, UINT, WPARAM, LPARAM);
LRESULT DefFrameProcW(HWND, HWND, UINT, WPARAM, LPARAM);
LRESULT DefMDIChildProcA(HWND, UINT, WPARAM, LPARAM);
LRESULT DefMDIChildProcW(HWND, UINT, WPARAM, LPARAM);
LRESULT DefWindowProcA(HWND, UINT, WPARAM, LPARAM);
LRESULT DefWindowProcW(HWND, UINT, WPARAM, LPARAM);
BOOL DeleteMenu(HMENU, UINT, UINT);
BOOL DeregisterShellHookWindow(HWND);
BOOL DestroyAcceleratorTable(HACCEL);
BOOL DestroyCaret();
BOOL DestroyCursor(HCURSOR);
BOOL DestroyIcon(HICON);
BOOL DestroyMenu(HMENU);
BOOL DestroyWindow(HWND);
int DialogBoxParamA(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM);
int DialogBoxParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
int DialogBoxIndirectParamA(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
int DialogBoxIndirectParamW(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
} // extern (Windows)
HCURSOR CopyCursor(HCURSOR c)
{
return cast(HCURSOR)CopyIcon(cast(HICON)c);
}
HWND CreateDialogA(HINSTANCE h, LPCSTR n, HWND w, DLGPROC f)
{
return CreateDialogParamA(h, n, w, f, 0);
}
HWND CreateDialogW(HINSTANCE h, LPCWSTR n, HWND w, DLGPROC f)
{
return CreateDialogParamW(h, n, w, f, 0);
}
HWND CreateDialogIndirectA(HINSTANCE h, LPCDLGTEMPLATE t, HWND w , DLGPROC f)
{
return CreateDialogIndirectParamA(h, t, w, f, 0);
}
HWND CreateDialogIndirectW(HINSTANCE h, LPCDLGTEMPLATE t, HWND w , DLGPROC f)
{
return CreateDialogIndirectParamW(h, t, w, f, 0);
}
HWND CreateWindowA(LPCSTR a, LPCSTR b, DWORD c, int d, int e, int f, int g, HWND h, HMENU i, HINSTANCE j, LPVOID k)
{
return CreateWindowExA(0, a, b, c, d, e, f, g, h, i, j, k);
}
HWND CreateWindowW(LPCWSTR a, LPCWSTR b, DWORD c, int d, int e, int f, int g, HWND h, HMENU i, HINSTANCE j, LPVOID k)
{
return CreateWindowExW(0, a, b, c, d, e, f, g, h, i, j, k);
}
int DialogBoxA(HINSTANCE i, LPCSTR t, HWND p, DLGPROC f)
{
return DialogBoxParamA(i, t, p, f, 0);
}
int DialogBoxW(HINSTANCE i, LPCWSTR t, HWND p, DLGPROC f)
{
return DialogBoxParamW(i, t, p, f, 0);
}
int DialogBoxIndirectA(HINSTANCE i, LPCDLGTEMPLATE t, HWND p, DLGPROC f)
{
return DialogBoxIndirectParamA(i, t, p, f, 0);
}
int DialogBoxIndirectW(HINSTANCE i, LPCDLGTEMPLATE t, HWND p, DLGPROC f)
{
return DialogBoxIndirectParamW(i, t, p, f, 0);
}
BOOL ExitWindows(UINT r, DWORD c)
{
return ExitWindowsEx(EWX_LOGOFF, 0);
}
alias GetWindow GetNextWindow;
extern (Windows):
LONG DispatchMessageA( MSG*);
LONG DispatchMessageW( MSG*);
int DlgDirListA(HWND, LPSTR, int, int, UINT);
int DlgDirListW(HWND, LPWSTR, int, int, UINT);
int DlgDirListComboBoxA(HWND, LPSTR, int, int, UINT);
int DlgDirListComboBoxW(HWND, LPWSTR, int, int, UINT);
BOOL DlgDirSelectComboBoxExA(HWND, LPSTR, int, int);
BOOL DlgDirSelectComboBoxExW(HWND, LPWSTR, int, int);
BOOL DlgDirSelectExA(HWND, LPSTR, int, int);
BOOL DlgDirSelectExW(HWND, LPWSTR, int, int);
BOOL DragDetect(HWND, POINT);
DWORD DragObject(HWND, HWND, UINT, DWORD, HCURSOR);
BOOL DrawAnimatedRects(HWND, int, LPCRECT, LPCRECT);
BOOL DrawCaption(HWND, HDC, LPCRECT, UINT);
BOOL DrawEdge(HDC, LPRECT, UINT, UINT);
BOOL DrawFocusRect(HDC, LPCRECT);
BOOL DrawFrameControl(HDC, LPRECT, UINT, UINT);
BOOL DrawIcon(HDC, int, int, HICON);
BOOL DrawIconEx(HDC, int, int, HICON, int, int, UINT, HBRUSH, UINT);
BOOL DrawMenuBar(HWND);
BOOL DrawStateA(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT);
BOOL DrawStateW(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT);
int DrawTextA(HDC, LPCSTR, int, LPRECT, UINT);
int DrawTextW(HDC, LPCWSTR, int, LPRECT, UINT);
int DrawTextExA(HDC, LPSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
int DrawTextExW(HDC, LPWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
BOOL EmptyClipboard();
BOOL EnableMenuItem(HMENU, UINT, UINT);
BOOL EnableScrollBar(HWND, UINT, UINT);
BOOL EnableWindow(HWND, BOOL);
BOOL EndDeferWindowPos(HDWP);
BOOL EndDialog(HWND, int);
BOOL EndMenu();
BOOL EndPaint(HWND, PAINTSTRUCT*);
BOOL EnumChildWindows(HWND, ENUMWINDOWSPROC, LPARAM);
UINT EnumClipboardFormats(UINT);
BOOL EnumDesktopsA(HWINSTA, DESKTOPENUMPROCA, LPARAM);
BOOL EnumDesktopsW(HWINSTA, DESKTOPENUMPROCW, LPARAM);
BOOL EnumDesktopWindows(HDESK, ENUMWINDOWSPROC, LPARAM);
BOOL EnumDisplaySettingsA(LPCSTR, DWORD, PDEVMODEA);
BOOL EnumDisplaySettingsW(LPCWSTR, DWORD, PDEVMODEW);
BOOL EnumDisplayDevicesA(LPCSTR, DWORD, PDISPLAY_DEVICEA, DWORD);
BOOL EnumDisplayDevicesW(LPCWSTR, DWORD, PDISPLAY_DEVICEW, DWORD);
int EnumPropsA(HWND, PROPENUMPROCA);
int EnumPropsW(HWND, PROPENUMPROCW);
int EnumPropsExA(HWND, PROPENUMPROCEXA, LPARAM);
int EnumPropsExW(HWND, PROPENUMPROCEXW, LPARAM);
BOOL EnumThreadWindows(DWORD, WNDENUMPROC, LPARAM);
BOOL EnumWindows(WNDENUMPROC, LPARAM);
BOOL EnumWindowStationsA(WINSTAENUMPROCA, LPARAM);
BOOL EnumWindowStationsW(WINSTAENUMPROCW, LPARAM);
BOOL EqualRect(LPCRECT, LPCRECT);
BOOL ExitWindowsEx(UINT, DWORD);
HWND FindWindowA(LPCSTR, LPCSTR);
HWND FindWindowExA(HWND, HWND, LPCSTR, LPCSTR);
HWND FindWindowExW(HWND, HWND, LPCWSTR, LPCWSTR);
HWND FindWindowW(LPCWSTR, LPCWSTR);
BOOL FlashWindow(HWND, BOOL);
int FrameRect(HDC, LPCRECT, HBRUSH);
BOOL FrameRgn(HDC, HRGN, HBRUSH, int, int);
HWND GetActiveWindow();
HWND GetAncestor(HWND, UINT);
SHORT GetAsyncKeyState(int);
HWND GetCapture();
UINT GetCaretBlinkTime();
BOOL GetCaretPos(LPPOINT);
BOOL GetClassInfoA(HINSTANCE, LPCSTR, LPWNDCLASSA);
BOOL GetClassInfoExA(HINSTANCE, LPCSTR, LPWNDCLASSEXA);
BOOL GetClassInfoW(HINSTANCE, LPCWSTR, LPWNDCLASSW);
BOOL GetClassInfoExW(HINSTANCE, LPCWSTR, LPWNDCLASSEXW);
DWORD GetClassLongA(HWND, int);
DWORD GetClassLongW(HWND, int);
int GetClassNameA(HWND, LPSTR, int);
int GetClassNameW(HWND, LPWSTR, int);
WORD GetClassWord(HWND, int);
BOOL GetClientRect(HWND, LPRECT);
HANDLE GetClipboardData(UINT);
int GetClipboardFormatNameA(UINT, LPSTR, int);
int GetClipboardFormatNameW(UINT, LPWSTR, int);
HWND GetClipboardOwner();
HWND GetClipboardViewer();
BOOL GetClipCursor(LPRECT);
BOOL GetCursorPos(LPPOINT);
HDC GetDC(HWND);
HDC GetDCEx(HWND, HRGN, DWORD);
HWND GetDesktopWindow();
int GetDialogBaseUnits();
int GetDlgCtrlID(HWND);
HWND GetDlgItem(HWND, int);
UINT GetDlgItemInt(HWND, int, PBOOL, BOOL);
UINT GetDlgItemTextA(HWND, int, LPSTR, int);
UINT GetDlgItemTextW(HWND, int, LPWSTR, int);
UINT GetDoubleClickTime();
HWND GetFocus();
HWND GetForegroundWindow();
BOOL GetIconInfo(HICON, PICONINFO);
BOOL GetInputState();
UINT GetKBCodePage();
HKL GetKeyboardLayout(DWORD);
UINT GetKeyboardLayoutList(int, HKL*);
BOOL GetKeyboardLayoutNameA(LPSTR);
BOOL GetKeyboardLayoutNameW(LPWSTR);
BOOL GetKeyboardState(PBYTE);
int GetKeyboardType(int);
int GetKeyNameTextA(LONG, LPSTR, int);
int GetKeyNameTextW(LONG, LPWSTR, int);
SHORT GetKeyState(int);
HWND GetLastActivePopup(HWND);
HMENU GetMenu(HWND);
LONG GetMenuCheckMarkDimensions();
DWORD GetMenuContextHelpId(HMENU);
UINT GetMenuDefaultItem(HMENU, UINT, UINT);
int GetMenuItemCount(HMENU);
UINT GetMenuItemID(HMENU, int);
BOOL GetMenuItemInfoA(HMENU, UINT, BOOL, LPMENUITEMINFOA);
BOOL GetMenuItemInfoW(HMENU, UINT, BOOL, LPMENUITEMINFOW);
BOOL GetMenuItemRect(HWND, HMENU, UINT, LPRECT);
UINT GetMenuState(HMENU, UINT, UINT);
int GetMenuStringA(HMENU, UINT, LPSTR, int, UINT);
int GetMenuStringW(HMENU, UINT, LPWSTR, int, UINT);
BOOL GetMessageA(LPMSG, HWND, UINT, UINT);
BOOL GetMessageW(LPMSG, HWND, UINT, UINT);
LONG GetMessageExtraInfo();
DWORD GetMessagePos();
LONG GetMessageTime();
HWND GetNextDlgGroupItem(HWND, HWND, BOOL);
HWND GetNextDlgTabItem(HWND, HWND, BOOL);
HWND GetOpenClipboardWindow();
HWND GetParent(HWND);
int GetPriorityClipboardFormat(UINT*, int);
HANDLE GetPropA(HWND, LPCSTR);
HANDLE GetPropW(HWND, LPCWSTR);
DWORD GetQueueStatus(UINT);
BOOL GetScrollInfo(HWND, int, LPSCROLLINFO);
int GetScrollPos(HWND, int);
BOOL GetScrollRange(HWND, int, LPINT, LPINT);
HMENU GetSubMenu(HMENU, int);
DWORD GetSysColor(int);
HBRUSH GetSysColorBrush(int);
HMENU GetSystemMenu(HWND, BOOL);
int GetSystemMetrics(int);
DWORD GetTabbedTextExtentA(HDC, LPCSTR, int, int, LPINT);
DWORD GetTabbedTextExtentW(HDC, LPCWSTR, int, int, LPINT);
LONG GetWindowLongA(HWND, int);
LONG GetWindowLongW(HWND, int);
HDESK GetThreadDesktop(DWORD);
HWND GetTopWindow(HWND);
BOOL GetUpdateRect(HWND, LPRECT, BOOL);
int GetUpdateRgn(HWND, HRGN, BOOL);
BOOL GetUserObjectInformationA(HANDLE, int, PVOID, DWORD, PDWORD);
BOOL GetUserObjectInformationW(HANDLE, int, PVOID, DWORD, PDWORD);
BOOL GetUserObjectSecurity(HANDLE, PSECURITY_INFORMATION, PSECURITY_DESCRIPTOR, DWORD, PDWORD);
HWND GetWindow(HWND, UINT);
DWORD GetWindowContextHelpId(HWND);
HDC GetWindowDC(HWND);
BOOL GetWindowPlacement(HWND, WINDOWPLACEMENT*);
BOOL GetWindowRect(HWND, LPRECT);
int GetWindowRgn(HWND, HRGN);
int GetWindowTextA(HWND, LPSTR, int);
int GetWindowTextLengthA(HWND);
int GetWindowTextLengthW(HWND);
int GetWindowTextW(HWND, LPWSTR, int);
WORD GetWindowWord(HWND, int);
BOOL GetAltTabInfoA(HWND, int, PALTTABINFO, LPSTR, UINT);
BOOL GetAltTabInfoW(HWND, int, PALTTABINFO, LPWSTR, UINT);
BOOL GetComboBoxInfo(HWND, PCOMBOBOXINFO);
BOOL GetCursorInfo(PCURSORINFO);
BOOL GetLastInputInfo(PLASTINPUTINFO);
DWORD GetListBoxInfo(HWND);
BOOL GetMenuBarInfo(HWND, LONG, LONG, PMENUBARINFO);
BOOL GetMenuInfo(HMENU, LPMENUINFO);
BOOL GetScrollBarInfo(HWND, LONG, PSCROLLBARINFO);
BOOL GetTitleBarInfo(HWND, PTITLEBARINFO);
BOOL GetWindowInfo(HWND, PWINDOWINFO);
UINT GetWindowModuleFileNameA(HWND, LPSTR, UINT);
UINT GetWindowModuleFileNameW(HWND, LPWSTR, UINT);
BOOL GrayStringA(HDC, HBRUSH, GRAYSTRINGPROC, LPARAM, int, int, int, int, int);
BOOL GrayStringW(HDC, HBRUSH, GRAYSTRINGPROC, LPARAM, int, int, int, int, int);
BOOL HideCaret(HWND);
BOOL HiliteMenuItem(HWND, HMENU, UINT, UINT);
BOOL InflateRect(LPRECT, int, int);
BOOL InSendMessage();
BOOL InsertMenuA(HMENU, UINT, UINT, UINT, LPCSTR);
BOOL InsertMenuW(HMENU, UINT, UINT, UINT, LPCWSTR);
BOOL InsertMenuItemA(HMENU, UINT, BOOL, LPCMENUITEMINFOA);
BOOL InsertMenuItemW(HMENU, UINT, BOOL, LPCMENUITEMINFOW);
INT InternalGetWindowText(HWND, LPWSTR, INT);
BOOL IntersectRect(LPRECT, LPCRECT, LPCRECT);
BOOL InvalidateRect(HWND, LPCRECT, BOOL);
BOOL InvalidateRgn(HWND, HRGN, BOOL);
BOOL InvertRect(HDC, LPCRECT);
BOOL IsCharAlphaA(CHAR ch);
BOOL IsCharAlphaNumericA(CHAR);
BOOL IsCharAlphaNumericW(WCHAR);
BOOL IsCharAlphaW(WCHAR);
BOOL IsCharLowerA(CHAR);
BOOL IsCharLowerW(WCHAR);
BOOL IsCharUpperA(CHAR);
BOOL IsCharUpperW(WCHAR);
BOOL IsChild(HWND, HWND);
BOOL IsClipboardFormatAvailable(UINT);
BOOL IsDialogMessageA(HWND, LPMSG);
BOOL IsDialogMessageW(HWND, LPMSG);
UINT IsDlgButtonChecked(HWND, int);
BOOL IsIconic(HWND);
BOOL IsMenu(HMENU);
BOOL IsRectEmpty(LPCRECT);
BOOL IsWindow(HWND);
BOOL IsWindowEnabled(HWND);
BOOL IsWindowUnicode(HWND);
BOOL IsWindowVisible(HWND);
BOOL IsZoomed(HWND);
void keybd_event(BYTE, BYTE, DWORD, DWORD);
BOOL KillTimer(HWND, UINT);
HACCEL LoadAcceleratorsA(HINSTANCE, LPCSTR);
HACCEL LoadAcceleratorsW(HINSTANCE, LPCWSTR);
HBITMAP LoadBitmapA(HINSTANCE, LPCSTR);
HBITMAP LoadBitmapW(HINSTANCE, LPCWSTR);
HCURSOR LoadCursorA(HINSTANCE, LPCSTR);
HCURSOR LoadCursorFromFileA(LPCSTR);
HCURSOR LoadCursorFromFileW(LPCWSTR);
HCURSOR LoadCursorW(HINSTANCE, LPCWSTR);
HICON LoadIconA(HINSTANCE, LPCSTR);
HICON LoadIconW(HINSTANCE, LPCWSTR);
HANDLE LoadImageA(HINSTANCE, LPCSTR, UINT, int, int, UINT);
HANDLE LoadImageW(HINSTANCE, LPCWSTR, UINT, int, int, UINT);
HKL LoadKeyboardLayoutA(LPCSTR, UINT);
HKL LoadKeyboardLayoutW(LPCWSTR, UINT);
HMENU LoadMenuA(HINSTANCE, LPCSTR);
HMENU LoadMenuIndirectA( MENUTEMPLATE*);
HMENU LoadMenuIndirectW( MENUTEMPLATE*);
HMENU LoadMenuW(HINSTANCE, LPCWSTR);
int LoadStringA(HINSTANCE, UINT, LPSTR, int);
int LoadStringW(HINSTANCE, UINT, LPWSTR, int);
BOOL LockWindowUpdate(HWND);
int LookupIconIdFromDirectory(PBYTE, BOOL);
int LookupIconIdFromDirectoryEx(PBYTE, BOOL, int, int, UINT);
BOOL MapDialogRect(HWND, LPRECT);
UINT MapVirtualKeyA(UINT, UINT);
UINT MapVirtualKeyExA(UINT, UINT, HKL);
UINT MapVirtualKeyExW(UINT, UINT, HKL);
UINT MapVirtualKeyW(UINT, UINT);
int MapWindowPoints(HWND, HWND, LPPOINT, UINT);
int MenuItemFromPoint(HWND, HMENU, POINT);
BOOL MessageBeep(UINT);
int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT);
int MessageBoxW(HWND, LPCWSTR, LPCWSTR, UINT);
int MessageBoxExA(HWND, LPCSTR, LPCSTR, UINT, WORD);
int MessageBoxExW(HWND, LPCWSTR, LPCWSTR, UINT, WORD);
int MessageBoxIndirectA(MSGBOXPARAMSA*);
int MessageBoxIndirectW(MSGBOXPARAMSW*);
BOOL ModifyMenuA(HMENU, UINT, UINT, UINT, LPCSTR);
BOOL ModifyMenuW(HMENU, UINT, UINT, UINT, LPCWSTR);
void mouse_event(DWORD, DWORD, DWORD, DWORD, ULONG_PTR);
BOOL MoveWindow(HWND, int, int, int, int, BOOL);
DWORD MsgWaitForMultipleObjects(DWORD, HANDLE*, BOOL, DWORD, DWORD);
DWORD MsgWaitForMultipleObjectsEx(DWORD, HANDLE*, DWORD, DWORD, DWORD);
DWORD OemKeyScan(WORD);
BOOL OemToCharA(LPCSTR, LPSTR);
BOOL OemToCharBuffA(LPCSTR, LPSTR, DWORD);
BOOL OemToCharBuffW(LPCSTR, LPWSTR, DWORD);
BOOL OemToCharW(LPCSTR, LPWSTR);
BOOL OffsetRect(LPRECT, int, int);
BOOL OpenClipboard(HWND);
HDESK OpenDesktopA(LPSTR, DWORD, BOOL, DWORD);
HDESK OpenDesktopW(LPWSTR, DWORD, BOOL, DWORD);
BOOL OpenIcon(HWND);
HDESK OpenInputDesktop(DWORD, BOOL, DWORD);
HWINSTA OpenWindowStationA(LPSTR, BOOL, DWORD);
HWINSTA OpenWindowStationW(LPWSTR, BOOL, DWORD);
BOOL PaintDesktop(HDC);
BOOL PeekMessageA(LPMSG, HWND, UINT, UINT, UINT);
BOOL PeekMessageW(LPMSG, HWND, UINT, UINT, UINT);
BOOL PostMessageA(HWND, UINT, WPARAM, LPARAM);
BOOL PostMessageW(HWND, UINT, WPARAM, LPARAM);
void PostQuitMessage(int);
BOOL PostThreadMessageA(DWORD, UINT, WPARAM, LPARAM);
BOOL PostThreadMessageW(DWORD, UINT, WPARAM, LPARAM);
BOOL PtInRect(LPCRECT, POINT);
HWND RealChildWindowFromPoint(HWND, POINT);
UINT RealGetWindowClassA(HWND, LPSTR, UINT);
UINT RealGetWindowClassW(HWND, LPWSTR, UINT);
BOOL RedrawWindow(HWND, LPCRECT, HRGN, UINT);
ATOM RegisterClassA(WNDCLASSA*);
ATOM RegisterClassW(WNDCLASSW*);
ATOM RegisterClassExA(WNDCLASSEXA*);
ATOM RegisterClassExW(WNDCLASSEXW*);
UINT RegisterClipboardFormatA(LPCSTR);
UINT RegisterClipboardFormatW(LPCWSTR);
BOOL RegisterHotKey(HWND, int, UINT, UINT);
UINT RegisterWindowMessageA(LPCSTR);
UINT RegisterWindowMessageW(LPCWSTR);
BOOL ReleaseCapture();
int ReleaseDC(HWND, HDC);
BOOL RemoveMenu(HMENU, UINT, UINT);
HANDLE RemovePropA(HWND, LPCSTR);
HANDLE RemovePropW(HWND, LPCWSTR);
BOOL ReplyMessage(LRESULT);
BOOL ScreenToClient(HWND, LPPOINT);
BOOL ScrollDC(HDC, int, int, LPCRECT, LPCRECT, HRGN, LPRECT);
BOOL ScrollWindow(HWND, int, int, LPCRECT, LPCRECT);
int ScrollWindowEx(HWND, int, int, LPCRECT, LPCRECT, HRGN, LPRECT, UINT);
LONG SendDlgItemMessageA(HWND, int, UINT, WPARAM, LPARAM);
LONG SendDlgItemMessageW(HWND, int, UINT, WPARAM, LPARAM);
LRESULT SendMessageA(HWND, UINT, WPARAM, LPARAM);
BOOL SendMessageCallbackA(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, DWORD);
BOOL SendMessageCallbackW(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, DWORD);
LRESULT SendMessageTimeoutA(HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD);
LRESULT SendMessageTimeoutW(HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD);
LRESULT SendMessageW(HWND, UINT, WPARAM, LPARAM);
BOOL SendNotifyMessageA(HWND, UINT, WPARAM, LPARAM);
BOOL SendNotifyMessageW(HWND, UINT, WPARAM, LPARAM);
HWND SetActiveWindow(HWND);
HWND SetCapture(HWND hWnd);
BOOL SetCaretBlinkTime(UINT);
BOOL SetCaretPos(int, int);
DWORD SetClassLongA(HWND, int, LONG);
DWORD SetClassLongW(HWND, int, LONG);
WORD SetClassWord(HWND, int, WORD);
HANDLE SetClipboardData(UINT, HANDLE);
HWND SetClipboardViewer(HWND);
HCURSOR SetCursor(HCURSOR);
BOOL SetCursorPos(int, int);
void SetDebugErrorLevel(DWORD);
BOOL SetDlgItemInt(HWND, int, UINT, BOOL);
BOOL SetDlgItemTextA(HWND, int, LPCSTR);
BOOL SetDlgItemTextW(HWND, int, LPCWSTR);
BOOL SetDoubleClickTime(UINT);
HWND SetFocus(HWND);
BOOL SetForegroundWindow(HWND);
BOOL SetKeyboardState(PBYTE);
BOOL SetMenu(HWND, HMENU);
BOOL SetMenuContextHelpId(HMENU, DWORD);
BOOL SetMenuDefaultItem(HMENU, UINT, UINT);
BOOL SetMenuInfo(HMENU, LPCMENUINFO);
BOOL SetMenuItemBitmaps(HMENU, UINT, UINT, HBITMAP, HBITMAP);
BOOL SetMenuItemInfoA(HMENU, UINT, BOOL, LPCMENUITEMINFOA);
BOOL SetMenuItemInfoW( HMENU, UINT, BOOL, LPCMENUITEMINFOW);
LPARAM SetMessageExtraInfo(LPARAM);
BOOL SetMessageQueue(int);
HWND SetParent(HWND, HWND);
BOOL SetProcessWindowStation(HWINSTA);
BOOL SetPropA(HWND, LPCSTR, HANDLE);
BOOL SetPropW(HWND, LPCWSTR, HANDLE);
BOOL SetRect(LPRECT, int, int, int, int);
BOOL SetRectEmpty(LPRECT);
int SetScrollInfo(HWND, int, LPCSCROLLINFO, BOOL);
int SetScrollPos(HWND, int, int, BOOL);
BOOL SetScrollRange(HWND, int, int, int, BOOL);
BOOL SetSysColors(int, INT* , COLORREF* );
BOOL SetSystemCursor(HCURSOR, DWORD);
BOOL SetThreadDesktop(HDESK);
UINT SetTimer(HWND, UINT, UINT, TIMERPROC);
BOOL SetUserObjectInformationA(HANDLE, int, PVOID, DWORD);
BOOL SetUserObjectInformationW(HANDLE, int, PVOID, DWORD);
BOOL SetUserObjectSecurity(HANDLE, PSECURITY_INFORMATION, PSECURITY_DESCRIPTOR);
BOOL SetWindowContextHelpId(HWND, DWORD);
LONG SetWindowLongA(HWND, int, LONG);
LONG SetWindowLongW(HWND, int, LONG);
BOOL SetWindowPlacement(HWND hWnd, WINDOWPLACEMENT*);
BOOL SetWindowPos(HWND, HWND, int, int, int, int, UINT);
int SetWindowRgn(HWND, HRGN, BOOL);
HHOOK SetWindowsHookA(int, HOOKPROC);
HHOOK SetWindowsHookW(int, HOOKPROC);
HHOOK SetWindowsHookExA(int, HOOKPROC, HINSTANCE, DWORD);
HHOOK SetWindowsHookExW(int, HOOKPROC, HINSTANCE, DWORD);
BOOL SetWindowTextA(HWND, LPCSTR);
BOOL SetWindowTextW(HWND, LPCWSTR);
WORD SetWindowWord(HWND, int, WORD);
BOOL ShowCaret(HWND);
int ShowCursor(BOOL);
BOOL ShowOwnedPopups(HWND, BOOL);
BOOL ShowScrollBar(HWND, int, BOOL);
BOOL ShowWindow(HWND, int);
BOOL ShowWindowAsync(HWND, int);
BOOL SubtractRect(LPRECT, LPCRECT, LPCRECT);
BOOL SwapMouseButton(BOOL);
BOOL SwitchDesktop(HDESK);
BOOL SystemParametersInfoA(UINT, UINT, PVOID, UINT);
BOOL SystemParametersInfoW(UINT, UINT, PVOID, UINT);
LONG TabbedTextOutA(HDC, int, int, LPCSTR, int, int, LPINT, int);
LONG TabbedTextOutW(HDC, int, int, LPCWSTR, int, int, LPINT, int);
WORD TileWindows(HWND, UINT, LPCRECT, UINT, HWND* );
int ToAscii(UINT, UINT, PBYTE, LPWORD, UINT);
int ToAsciiEx(UINT, UINT, PBYTE, LPWORD, UINT, HKL);
int ToUnicode(UINT, UINT, PBYTE, LPWSTR, int, UINT);
int ToUnicodeEx(UINT, UINT, PBYTE, LPWSTR, int, UINT, HKL);
BOOL TrackMouseEvent(LPTRACKMOUSEEVENT);
BOOL TrackPopupMenu(HMENU, UINT, int, int, int, HWND, LPCRECT);
BOOL TrackPopupMenuEx(HMENU, UINT, int, int, HWND, LPTPMPARAMS);
int TranslateAcceleratorA(HWND, HACCEL, LPMSG);
int TranslateAcceleratorW(HWND, HACCEL, LPMSG);
BOOL TranslateMDISysAccel(HWND, LPMSG);
BOOL TranslateMessage( MSG*);
BOOL UnhookWindowsHook(int, HOOKPROC);
BOOL UnhookWindowsHookEx(HHOOK);
BOOL UnionRect(LPRECT, LPCRECT, LPCRECT);
BOOL UnloadKeyboardLayout(HKL);
BOOL UnregisterClassA(LPCSTR, HINSTANCE);
BOOL UnregisterClassW(LPCWSTR, HINSTANCE);
BOOL UnregisterHotKey(HWND, int);
BOOL UpdateWindow(HWND);
BOOL ValidateRect(HWND, LPCRECT);
BOOL ValidateRgn(HWND, HRGN);
SHORT VkKeyScanA(CHAR);
SHORT VkKeyScanExA(CHAR, HKL);
SHORT VkKeyScanExW(WCHAR, HKL);
SHORT VkKeyScanW(WCHAR);
DWORD WaitForInputIdle(HANDLE, DWORD);
BOOL WaitMessage();
HWND WindowFromDC(HDC hDC);
HWND WindowFromPoint(POINT);
UINT WinExec(LPCSTR, UINT);
BOOL WinHelpA(HWND, LPCSTR, UINT, DWORD);
BOOL WinHelpW(HWND, LPCWSTR, UINT, DWORD);
extern (C) {
int wsprintfA(LPSTR, LPCSTR, ...);
int wsprintfW(LPWSTR, LPCWSTR, ...);
}
// These shouldn't be necessary for D.
typedef char* va_list_;
int wvsprintfA(LPSTR, LPCSTR, va_list_ arglist);
int wvsprintfW(LPWSTR, LPCWSTR, va_list_ arglist);
static if (_WIN32_WINDOWS == 0x400) {
// On Win95, there's only one version.
int BroadcastSystemMessage(DWORD, LPDWORD, UINT, WPARAM, LPARAM);
}
static if (_WIN32_WINNT >= 0x400) {
int BroadcastSystemMessageA(DWORD, LPDWORD, UINT, WPARAM, LPARAM);
int BroadcastSystemMessageW(DWORD, LPDWORD, UINT, WPARAM, LPARAM);
}
static if (_WIN32_WINNT >= 0x501) {
int BroadcastSystemMessageExA(DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO);
int BroadcastSystemMessageExW(DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO);
}
static if (_WIN32_WINNT >= 0x403) {
UINT SendInput(UINT, LPINPUT, int);
}
static if (_WIN32_WINNT >= 0x500) {
BOOL AnimateWindow(HWND, DWORD, DWORD);
BOOL EndTask(HWND, BOOL, BOOL);
DWORD GetGuiResources(HANDLE, DWORD);
HWND GetShellWindow();
BOOL GetProcessDefaultLayout(DWORD*);
BOOL IsHungAppWindow(HWND);
BOOL LockWorkStation();
HDEVNOTIFY RegisterDeviceNotificationA(HANDLE, LPVOID, DWORD);
HDEVNOTIFY RegisterDeviceNotificationW(HANDLE, LPVOID, DWORD);
BOOL SetProcessDefaultLayout(DWORD);
void SwitchToThisWindow(HWND, BOOL);
BOOL SetLayeredWindowAttributes(HWND, COLORREF, BYTE, DWORD);
BOOL UpdateLayeredWindow(HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD);
BOOL UserHandleGrantAccess(HANDLE, HANDLE, BOOL);
}
static if (_WIN32_WINNT >= 0x501) {
UINT GetRawInputBuffer(PRAWINPUT, PUINT, UINT);
UINT GetRawInputData(HRAWINPUT, UINT, LPVOID, PUINT, UINT);
UINT GetRawInputDeviceInfoA(HANDLE, UINT, LPVOID, PUINT);
UINT GetRawInputDeviceInfoW(HANDLE, UINT, LPVOID, PUINT);
UINT GetRawInputDeviceList(PRAWINPUTDEVICELIST, PUINT, UINT);
UINT GetRegisteredRawInputDevices(PRAWINPUTDEVICE, PUINT, UINT);
LRESULT DefRawInputProc(PRAWINPUT*, INT, UINT);
BOOL RegisterRawInputDevices(PCRAWINPUTDEVICE, UINT, UINT);
BOOL IsGUIThread(BOOL);
BOOL IsWinEventHookInstalled(DWORD);
BOOL PrintWindow(HWND, HDC, UINT);
BOOL GetLayeredWindowAttributes(HWND, COLORREF*, BYTE*, DWORD*);
}
static if (WINVER >= 0x410) {
BOOL EnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
BOOL GetMonitorInfoA(HMONITOR, LPMONITORINFO);
BOOL GetMonitorInfoA(HMONITOR, LPMONITORINFOEXA);
BOOL GetMonitorInfoW(HMONITOR, LPMONITORINFO);
BOOL GetMonitorInfoW(HMONITOR, LPMONITORINFOEXW);
HMONITOR MonitorFromPoint(POINT, DWORD);
HMONITOR MonitorFromRect(LPCRECT, DWORD);
HMONITOR MonitorFromWindow(HWND, DWORD);
}
static if (WINVER >= 0x500) {
BOOL GetGUIThreadInfo(DWORD, LPGUITHREADINFO);
void NotifyWinEvent(DWORD, HWND, LONG, LONG);
HWINEVENTHOOK SetWinEventHook(UINT, UINT, HMODULE, WINEVENTPROC, DWORD, DWORD, UINT);
BOOL UnhookWinEvent(HWINEVENTHOOK);
BOOL UnregisterDeviceNotification(HANDLE);
}
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x410)) {
BOOL EnumDisplaySettingsExA(LPCSTR, DWORD, LPDEVMODEA, DWORD);
BOOL EnumDisplaySettingsExW(LPCWSTR, DWORD, LPDEVMODEW, DWORD);
BOOL FlashWindowEx(PFLASHWINFO);
DWORD GetClipboardSequenceNumber();
DWORD InSendMessageEx(LPVOID);
}
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x490)) {
BOOL AllowSetForegroundWindow(DWORD);
BOOL LockSetForegroundWindow(UINT);
int GetMouseMovePointsEx(UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD);
}
version (Win64) {
LONG_PTR GetWindowLongPtrA(HWND, int);
LONG_PTR GetWindowLongPtrW(HWND, int);
LONG_PTR SetWindowLongPtrA(HWND, int, LONG_PTR);
LONG_PTR SetWindowLongPtrW(HWND, int, LONG_PTR);
} else {
alias GetWindowLongA GetWindowLongPtrA;
alias GetWindowLongW GetWindowLongPtrW;
alias SetWindowLongA SetWindowLongPtrA;
alias SetWindowLongW SetWindowLongPtrW;
}
// -----
// Aliases for Unicode or Ansi
version(Unicode) {
alias EDITWORDBREAKPROCW EDITWORDBREAKPROC;
alias PROPENUMPROCW PROPENUMPROC;
alias PROPENUMPROCEXW PROPENUMPROCEX;
alias DESKTOPENUMPROCW DESKTOPENUMPROC;
alias WINSTAENUMPROCW WINSTAENUMPROC;
alias MAKEINTRESOURCEW MAKEINTRESOURCE;
alias WNDCLASSW WNDCLASS;
alias WNDCLASSEXW WNDCLASSEX;
alias MENUITEMINFOW MENUITEMINFO;
alias LPCMENUITEMINFOW LPCMENUITEMINFO;
alias MSGBOXPARAMSW MSGBOXPARAMS;
alias HIGHCONTRASTW HIGHCONTRAST;
alias SERIALKEYSW SERIALKEYS;
alias SOUNDSENTRYW SOUNDSENTRY;
alias CREATESTRUCTW CREATESTRUCT;
alias CBT_CREATEWNDW CBT_CREATEWND;
alias MDICREATESTRUCTW MDICREATESTRUCT;
alias MULTIKEYHELPW MULTIKEYHELP;
alias MONITORINFOEXW MONITORINFOEX;
alias ICONMETRICSW ICONMETRICS;
alias NONCLIENTMETRICSW NONCLIENTMETRICS;
alias AppendMenuW AppendMenu;
alias BroadcastSystemMessageW BroadcastSystemMessage;
static if (_WIN32_WINNT >= 0x501) {
alias BroadcastSystemMessageExW BroadcastSystemMessageEx;
}
alias CallMsgFilterW CallMsgFilter;
alias CallWindowProcW CallWindowProc;
alias ChangeMenuW ChangeMenu;
alias CharLowerW CharLower;
alias CharLowerBuffW CharLowerBuff;
alias CharNextW CharNext;
alias CharNextExW CharNextEx;
alias CharPrevW CharPrev;
alias CharPrevExW CharPrevEx;
alias CharToOemW CharToOem;
alias CharToOemBuffW CharToOemBuff;
alias CharUpperW CharUpper;
alias CharUpperBuffW CharUpperBuff;
alias CopyAcceleratorTableW CopyAcceleratorTable;
alias CreateAcceleratorTableW CreateAcceleratorTable;
alias CreateDialogW CreateDialog;
alias CreateDialogIndirectW CreateDialogIndirect;
alias CreateDialogIndirectParamW CreateDialogIndirectParam;
alias CreateDialogParamW CreateDialogParam;
alias CreateMDIWindowW CreateMDIWindow;
alias CreateWindowW CreateWindow;
alias CreateWindowExW CreateWindowEx;
alias CreateWindowStationW CreateWindowStation;
alias DefDlgProcW DefDlgProc;
alias DefFrameProcW DefFrameProc;
alias DefMDIChildProcW DefMDIChildProc;
alias DefWindowProcW DefWindowProc;
alias DialogBoxW DialogBox;
alias DialogBoxIndirectW DialogBoxIndirect;
alias DialogBoxIndirectParamW DialogBoxIndirectParam;
alias DialogBoxParamW DialogBoxParam;
alias DispatchMessageW DispatchMessage;
alias DlgDirListW DlgDirList;
alias DlgDirListComboBoxW DlgDirListComboBox;
alias DlgDirSelectComboBoxExW DlgDirSelectComboBoxEx;
alias DlgDirSelectExW DlgDirSelectEx;
alias DrawStateW DrawState;
alias DrawTextW DrawText;
alias DrawTextExW DrawTextEx;
alias EnumDesktopsW EnumDesktops;
alias EnumPropsW EnumProps;
alias EnumPropsExW EnumPropsEx;
alias EnumWindowStationsW EnumWindowStations;
alias FindWindowW FindWindow;
alias FindWindowExW FindWindowEx;
alias GetClassInfoW GetClassInfo;
alias GetClassInfoExW GetClassInfoEx;
alias GetClassLongW GetClassLong;
alias GetClassNameW GetClassName;
alias GetClipboardFormatNameW GetClipboardFormatName;
alias GetDlgItemTextW GetDlgItemText;
alias GetKeyboardLayoutNameW GetKeyboardLayoutName;
alias GetKeyNameTextW GetKeyNameText;
alias GetMenuItemInfoW GetMenuItemInfo;
alias GetMenuStringW GetMenuString;
alias GetMessageW GetMessage;
static if (WINVER >=0x410) {
alias GetMonitorInfoW GetMonitorInfo;
}
alias GetPropW GetProp;
static if (_WIN32_WINNT >= 0x501) {
alias GetRawInputDeviceInfoW GetRawInputDeviceInfo;
}
alias GetTabbedTextExtentW GetTabbedTextExtent;
alias GetUserObjectInformationW GetUserObjectInformation;
alias GetWindowLongW GetWindowLong;
alias GetWindowLongPtrW GetWindowLongPtr;
alias GetWindowTextW GetWindowText;
alias GetWindowTextLengthW GetWindowTextLength;
alias GetAltTabInfoW GetAltTabInfo;
alias GetWindowModuleFileNameW GetWindowModuleFileName;
alias GrayStringW GrayString;
alias InsertMenuW InsertMenu;
alias InsertMenuItemW InsertMenuItem;
alias IsCharAlphaW IsCharAlpha;
alias IsCharAlphaNumericW IsCharAlphaNumeric;
alias IsCharLowerW IsCharLower;
alias IsCharUpperW IsCharUpper;
alias IsDialogMessageW IsDialogMessage;
alias LoadAcceleratorsW LoadAccelerators;
alias LoadBitmapW LoadBitmap;
alias LoadCursorW LoadCursor;
alias LoadCursorFromFileW LoadCursorFromFile;
alias LoadIconW LoadIcon;
alias LoadImageW LoadImage;
alias LoadKeyboardLayoutW LoadKeyboardLayout;
alias LoadMenuW LoadMenu;
alias LoadMenuIndirectW LoadMenuIndirect;
alias LoadStringW LoadString;
alias MapVirtualKeyW MapVirtualKey;
alias MapVirtualKeyExW MapVirtualKeyEx;
alias MessageBoxW MessageBox;
alias MessageBoxExW MessageBoxEx;
alias MessageBoxIndirectW MessageBoxIndirect;
alias ModifyMenuW ModifyMenu;
alias OemToCharW OemToChar;
alias OemToCharBuffW OemToCharBuff;
alias OpenDesktopW OpenDesktop;
alias OpenWindowStationW OpenWindowStation;
alias PeekMessageW PeekMessage;
alias PostMessageW PostMessage;
alias PostThreadMessageW PostThreadMessage;
alias RealGetWindowClassW RealGetWindowClass;
alias RegisterClassW RegisterClass;
alias RegisterClassExW RegisterClassEx;
alias RegisterClipboardFormatW RegisterClipboardFormat;
static if (WINVER >= 0x500) {
alias RegisterDeviceNotificationW RegisterDeviceNotification;
}
alias RegisterWindowMessageW RegisterWindowMessage;
alias RemovePropW RemoveProp;
alias SendDlgItemMessageW SendDlgItemMessage;
alias SendMessageW SendMessage;
alias SendMessageCallbackW SendMessageCallback;
alias SendMessageTimeoutW SendMessageTimeout;
alias SendNotifyMessageW SendNotifyMessage;
alias SetClassLongW SetClassLong;
alias SetDlgItemTextW SetDlgItemText;
alias SetMenuItemInfoW SetMenuItemInfo;
alias SetPropW SetProp;
alias SetUserObjectInformationW SetUserObjectInformation;
alias SetWindowLongW SetWindowLong;
alias SetWindowLongPtrW SetWindowLongPtr;
alias SetWindowsHookW SetWindowsHook;
alias SetWindowsHookExW SetWindowsHookEx;
alias SetWindowTextW SetWindowText;
alias SystemParametersInfoW SystemParametersInfo;
alias TabbedTextOutW TabbedTextOut;
alias TranslateAcceleratorW TranslateAccelerator;
alias UnregisterClassW UnregisterClass;
alias VkKeyScanW VkKeyScan;
alias VkKeyScanExW VkKeyScanEx;
alias WinHelpW WinHelp;
alias wsprintfW wsprintf;
alias wvsprintfW wvsprintf;
alias ChangeDisplaySettingsW ChangeDisplaySettings;
alias ChangeDisplaySettingsExW ChangeDisplaySettingsEx;
alias CreateDesktopW CreateDesktop;
alias EnumDisplaySettingsW EnumDisplaySettings;
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x410)) {
alias EnumDisplaySettingsExW EnumDisplaySettingsEx;
}
alias EnumDisplayDevicesW EnumDisplayDevices;
} else { // ANSI
alias EDITWORDBREAKPROCA EDITWORDBREAKPROC;
alias PROPENUMPROCA PROPENUMPROC;
alias PROPENUMPROCEXA PROPENUMPROCEX;
alias DESKTOPENUMPROCA DESKTOPENUMPROC;
alias WINSTAENUMPROCA WINSTAENUMPROC;
alias MAKEINTRESOURCEA MAKEINTRESOURCE;
alias WNDCLASSA WNDCLASS;
alias WNDCLASSEXA WNDCLASSEX;
alias MENUITEMINFOA MENUITEMINFO;
alias LPCMENUITEMINFOA LPCMENUITEMINFO;
alias MSGBOXPARAMSA MSGBOXPARAMS;
alias HIGHCONTRASTA HIGHCONTRAST;
alias SERIALKEYSA SERIALKEYS;
alias SOUNDSENTRYA SOUNDSENTRY;
alias CREATESTRUCTA CREATESTRUCT;
alias CBT_CREATEWNDA CBT_CREATEWND;
alias MDICREATESTRUCTA MDICREATESTRUCT;
alias MULTIKEYHELPA MULTIKEYHELP;
alias MONITORINFOEXA MONITORINFOEX;
alias ICONMETRICSA ICONMETRICS;
alias NONCLIENTMETRICSA NONCLIENTMETRICS;
alias AppendMenuA AppendMenu;
alias BroadcastSystemMessageA BroadcastSystemMessage;
static if (_WIN32_WINNT >= 0x501) {
alias BroadcastSystemMessageExA BroadcastSystemMessageEx;
}
alias CallMsgFilterA CallMsgFilter;
alias CallWindowProcA CallWindowProc;
alias ChangeMenuA ChangeMenu;
alias CharLowerA CharLower;
alias CharLowerBuffA CharLowerBuff;
alias CharNextA CharNext;
alias CharNextExA CharNextEx;
alias CharPrevA CharPrev;
alias CharPrevExA CharPrevEx;
alias CharToOemA CharToOem;
alias CharToOemBuffA CharToOemBuff;
alias CharUpperA CharUpper;
alias CharUpperBuffA CharUpperBuff;
alias CopyAcceleratorTableA CopyAcceleratorTable;
alias CreateAcceleratorTableA CreateAcceleratorTable;
alias CreateDialogA CreateDialog;
alias CreateDialogIndirectA CreateDialogIndirect;
alias CreateDialogIndirectParamA CreateDialogIndirectParam;
alias CreateDialogParamA CreateDialogParam;
alias CreateMDIWindowA CreateMDIWindow;
alias CreateWindowA CreateWindow;
alias CreateWindowExA CreateWindowEx;
alias CreateWindowStationA CreateWindowStation;
alias DefDlgProcA DefDlgProc;
alias DefFrameProcA DefFrameProc;
alias DefMDIChildProcA DefMDIChildProc;
alias DefWindowProcA DefWindowProc;
alias DialogBoxA DialogBox;
alias DialogBoxIndirectA DialogBoxIndirect;
alias DialogBoxIndirectParamA DialogBoxIndirectParam;
alias DialogBoxParamA DialogBoxParam;
alias DispatchMessageA DispatchMessage;
alias DlgDirListA DlgDirList;
alias DlgDirListComboBoxA DlgDirListComboBox;
alias DlgDirSelectComboBoxExA DlgDirSelectComboBoxEx;
alias DlgDirSelectExA DlgDirSelectEx;
alias DrawStateA DrawState;
alias DrawTextA DrawText;
alias DrawTextExA DrawTextEx;
alias EnumDesktopsA EnumDesktops;
alias EnumPropsA EnumProps;
alias EnumPropsExA EnumPropsEx;
alias EnumWindowStationsA EnumWindowStations;
alias FindWindowA FindWindow;
alias FindWindowExA FindWindowEx;
alias GetClassInfoA GetClassInfo;
alias GetClassInfoExA GetClassInfoEx;
alias GetClassLongA GetClassLong;
alias GetClassNameA GetClassName;
alias GetClipboardFormatNameA GetClipboardFormatName;
alias GetDlgItemTextA GetDlgItemText;
alias GetKeyboardLayoutNameA GetKeyboardLayoutName;
alias GetKeyNameTextA GetKeyNameText;
alias GetMenuItemInfoA GetMenuItemInfo;
alias GetMenuStringA GetMenuString;
alias GetMessageA GetMessage;
static if (WINVER >=0x410) {
alias GetMonitorInfoA GetMonitorInfo;
}
alias GetPropA GetProp;
static if (_WIN32_WINNT >= 0x501) {
alias GetRawInputDeviceInfoA GetRawInputDeviceInfo;
}
alias GetTabbedTextExtentA GetTabbedTextExtent;
alias GetUserObjectInformationA GetUserObjectInformation;
alias GetWindowLongA GetWindowLong;
alias GetWindowLongPtrA GetWindowLongPtr;
alias GetWindowTextA GetWindowText;
alias GetWindowTextLengthA GetWindowTextLength;
alias GetAltTabInfoA GetAltTabInfo;
alias GetWindowModuleFileNameA GetWindowModuleFileName;
alias GrayStringA GrayString;
alias InsertMenuA InsertMenu;
alias InsertMenuItemA InsertMenuItem;
alias IsCharAlphaA IsCharAlpha;
alias IsCharAlphaNumericA IsCharAlphaNumeric;
alias IsCharLowerA IsCharLower;
alias IsCharUpperA IsCharUpper;
alias IsDialogMessageA IsDialogMessage;
alias LoadAcceleratorsA LoadAccelerators;
alias LoadBitmapA LoadBitmap;
alias LoadCursorA LoadCursor;
alias LoadIconA LoadIcon;
alias LoadCursorFromFileA LoadCursorFromFile;
alias LoadImageA LoadImage;
alias LoadKeyboardLayoutA LoadKeyboardLayout;
alias LoadMenuA LoadMenu;
alias LoadMenuIndirectA LoadMenuIndirect;
alias LoadStringA LoadString;
alias MapVirtualKeyA MapVirtualKey;
alias MapVirtualKeyExA MapVirtualKeyEx;
alias MessageBoxA MessageBox;
alias MessageBoxExA MessageBoxEx;
alias MessageBoxIndirectA MessageBoxIndirect;
alias ModifyMenuA ModifyMenu;
alias OemToCharA OemToChar;
alias OemToCharBuffA OemToCharBuff;
alias OpenDesktopA OpenDesktop;
alias OpenWindowStationA OpenWindowStation;
alias PeekMessageA PeekMessage;
alias PostMessageA PostMessage;
alias PostThreadMessageA PostThreadMessage;
alias RealGetWindowClassA RealGetWindowClass;
alias RegisterClassA RegisterClass;
alias RegisterClassExA RegisterClassEx;
alias RegisterClipboardFormatA RegisterClipboardFormat;
static if (WINVER >= 0x500) {
alias RegisterDeviceNotificationA RegisterDeviceNotification;
}
alias RegisterWindowMessageA RegisterWindowMessage;
alias RemovePropA RemoveProp;
alias SendDlgItemMessageA SendDlgItemMessage;
alias SendMessageA SendMessage;
alias SendMessageCallbackA SendMessageCallback;
alias SendMessageTimeoutA SendMessageTimeout;
alias SendNotifyMessageA SendNotifyMessage;
alias SetClassLongA SetClassLong;
alias SetDlgItemTextA SetDlgItemText;
alias SetMenuItemInfoA SetMenuItemInfo;
alias SetPropA SetProp;
alias SetUserObjectInformationA SetUserObjectInformation;
alias SetWindowLongA SetWindowLong;
alias SetWindowLongPtrA SetWindowLongPtr;
alias SetWindowsHookA SetWindowsHook;
alias SetWindowsHookExA SetWindowsHookEx;
alias SetWindowTextA SetWindowText;
alias SystemParametersInfoA SystemParametersInfo;
alias TabbedTextOutA TabbedTextOut;
alias TranslateAcceleratorA TranslateAccelerator;
alias UnregisterClassA UnregisterClass;
alias VkKeyScanA VkKeyScan;
alias VkKeyScanExA VkKeyScanEx;
alias WinHelpA WinHelp;
alias wsprintfA wsprintf;
alias wvsprintfA wvsprintf;
alias ChangeDisplaySettingsA ChangeDisplaySettings;
alias ChangeDisplaySettingsExA ChangeDisplaySettingsEx;
alias CreateDesktopA CreateDesktop;
alias EnumDisplaySettingsA EnumDisplaySettings;
static if ((_WIN32_WINNT >= 0x500) || (_WIN32_WINDOWS >= 0x410)) {
alias EnumDisplaySettingsExA EnumDisplaySettingsEx;
}
alias EnumDisplayDevicesA EnumDisplayDevices;
}
alias WNDCLASS* LPWNDCLASS, PWNDCLASS;
alias WNDCLASSEX* LPWNDCLASSEX, PWNDCLASSEX;
alias MENUITEMINFO* LPMENUITEMINFO;
alias MSGBOXPARAMS* PMSGBOXPARAMS, LPMSGBOXPARAMS;
alias HIGHCONTRAST* LPHIGHCONTRAST;
alias SERIALKEYS* LPSERIALKEYS;
alias SOUNDSENTRY* LPSOUNDSENTRY;
alias CREATESTRUCT* LPCREATESTRUCT;
alias CBT_CREATEWND* LPCBT_CREATEWND;
alias MDICREATESTRUCT* LPMDICREATESTRUCT;
alias MULTIKEYHELP* PMULTIKEYHELP, LPMULTIKEYHELP;
alias MONITORINFOEX* LPMONITORINFOEX;
alias ICONMETRICS* LPICONMETRICS;
alias NONCLIENTMETRICS* LPNONCLIENTMETRICS;
|
D
|
module ext.opengl.gl_1_5;
import std.c.stdio, std.c.stdarg;
import ext.opengl.gl_1_0, ext.opengl.gl_1_1, ext.opengl.gl_1_2, ext.opengl.gl_1_3, ext.opengl.gl_1_4;
/* OpenGL 1.2 */
enum : GLenum{
GL_BUFFER_SIZE = 0x8764,
GL_BUFFER_USAGE = 0x8765,
GL_QUERY_COUNTER_BITS = 0x8864,
GL_CURRENT_QUERY = 0x8865,
GL_QUERY_RESULT = 0x8866,
GL_QUERY_RESULT_AVAILABLE = 0x8867,
GL_ARRAY_BUFFER = 0x8892,
GL_ELEMENT_ARRAY_BUFFER = 0x8893,
GL_ARRAY_BUFFER_BINDING = 0x8894,
GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896,
GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897,
GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898,
GL_INDEX_ARRAY_BUFFER_BINDING = 0x8899,
GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A,
GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889B,
GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889C,
GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D,
GL_WEIGHT_ARRAY_BUFFER_BINDING = 0x889E,
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
GL_READ_ONLY = 0x88B8,
GL_WRITE_ONLY = 0x88B9,
GL_READ_WRITE = 0x88BA,
GL_BUFFER_ACCESS = 0x88BB,
GL_BUFFER_MAPPED = 0x88BC,
GL_BUFFER_MAP_POINTER = 0x88BD,
GL_STREAM_DRAW = 0x88E0,
GL_STREAM_READ = 0x88E1,
GL_STREAM_COPY = 0x88E2,
GL_STATIC_DRAW = 0x88E4,
GL_STATIC_READ = 0x88E5,
GL_STATIC_COPY = 0x88E6,
GL_DYNAMIC_DRAW = 0x88E8,
GL_DYNAMIC_READ = 0x88E9,
GL_DYNAMIC_COPY = 0x88EA,
GL_SAMPLES_PASSED = 0x8914,
GL_FOG_COORD_SRC = GL_FOG_COORDINATE_SOURCE,
GL_FOG_COORD = GL_FOG_COORDINATE,
GL_CURRENT_FOG_COORD = GL_CURRENT_FOG_COORDINATE,
GL_FOG_COORD_ARRAY_TYPE = GL_FOG_COORDINATE_ARRAY_TYPE,
GL_FOG_COORD_ARRAY_STRIDE = GL_FOG_COORDINATE_ARRAY_STRIDE,
GL_FOG_COORD_ARRAY_POINTER = GL_FOG_COORDINATE_ARRAY_POINTER,
GL_FOG_COORD_ARRAY = GL_FOG_COORDINATE_ARRAY,
GL_FOG_COORD_ARRAY_BUFFER_BINDING = GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING,
GL_SRC0_RGB = GL_SOURCE0_RGB,
GL_SRC1_RGB = GL_SOURCE1_RGB,
GL_SRC2_RGB = GL_SOURCE2_RGB,
GL_SRC0_ALPHA = GL_SOURCE0_ALPHA,
GL_SRC1_ALPHA = GL_SOURCE1_ALPHA,
GL_SRC2_ALPHA = GL_SOURCE2_ALPHA,
}
/* 1.5 functions */
extern (System){
GLvoid function(GLsizei, GLuint*) glGenQueries;
GLvoid function(GLsizei,GLuint*) glDeleteQueries;
GLboolean function(GLuint) glIsQuery;
GLvoid function(GLenum, GLuint) glBeginQuery;
GLvoid function(GLenum) glEndQuery;
GLvoid function(GLenum, GLenum, GLint*) glGetQueryiv;
GLvoid function(GLuint, GLenum, GLint*) glGetQueryObjectiv;
GLvoid function(GLuint, GLenum, GLuint*) glGetQueryObjectuiv;
GLvoid function(GLenum, GLuint) glBindBuffer;
GLvoid function(GLsizei, GLuint*) glDeleteBuffers;
GLvoid function(GLsizei, GLuint*) glGenBuffers;
GLboolean function(GLuint) glIsBuffer;
GLvoid function(GLenum, GLsizeiptr, GLvoid*, GLenum) glBufferData;
GLvoid function(GLenum, GLintptr, GLsizeiptr,GLvoid*) glBufferSubData;
GLvoid function(GLenum, GLintptr, GLsizeiptr, GLvoid*) glGetBufferSubData;
GLvoid* function(GLenum, GLenum) glMapBuffer;
GLboolean function(GLenum) glUnmapBuffer;
GLvoid function(GLenum, GLenum, GLint*) glGetBufferParameteriv;
GLvoid function(GLenum, GLenum, GLvoid**) glGetBufferPointerv;
}
|
D
|
in a euphemistic manner
|
D
|
/Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Console.build/Command/Argument.swift.o : /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Bar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Argument.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Command+Print.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Command.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Group.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Option.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Runnable.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Value.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Ask.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Center.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Confirm.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Options.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Print.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Run.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/ConsoleError.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/FileHandle+Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/Pipe+Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/String+ANSI.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/Terminal+Command.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Utilities/String+Trim.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Loading/LoadingBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Progress/ProgressBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Clear/ConsoleClear.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Color/ConsoleColor.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Style/ConsoleStyle.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/libc.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Polymorphic.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Core.swiftmodule
/Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Console.build/Argument~partial.swiftmodule : /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Bar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Argument.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Command+Print.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Command.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Group.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Option.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Runnable.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Value.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Ask.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Center.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Confirm.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Options.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Print.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Run.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/ConsoleError.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/FileHandle+Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/Pipe+Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/String+ANSI.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/Terminal+Command.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Utilities/String+Trim.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Loading/LoadingBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Progress/ProgressBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Clear/ConsoleClear.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Color/ConsoleColor.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Style/ConsoleStyle.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/libc.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Polymorphic.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Core.swiftmodule
/Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Console.build/Argument~partial.swiftdoc : /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Bar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Argument.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Command+Print.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Command.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Group.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Option.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Runnable.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Command/Value.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Ask.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Center.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Confirm.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Options.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Print.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console+Run.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Console.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/ConsoleError.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/FileHandle+Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/Pipe+Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Stream/Stream.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/String+ANSI.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/Terminal+Command.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Terminal/Terminal.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Utilities/String+Trim.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Loading/LoadingBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Bar/Progress/ProgressBar.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Clear/ConsoleClear.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Color/ConsoleColor.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/Packages/Console-1.0.1/Sources/Console/Console/Style/ConsoleStyle.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/libc.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Polymorphic.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/KyleBlazier/Documents/Development/Xcode/ServerSide/Postgres/postgresAPI/.build/debug/Core.swiftmodule
|
D
|
the person who plays that position on a football team
gear consisting of ropes etc. supporting a ship's masts and sails
gear used in fishing
(American football) a position on the line of scrimmage
(American football) grasping an opposing player with the intention of stopping by throwing to the ground
accept as a challenge
put a harness
seize and throw down an opponent player, who usually carries the ball
|
D
|
module mir.random.flex.internal.types;
import std.traits: ReturnType, isFloatingPoint;
version(Flex_logging)
{
import std.experimental.logger;
}
/**
Major data unit of the Flex algorithm.
It is used to store
- (cached) values of the transformation (and its derivatives)
- area below the hat and squeeze function
- linked-list like reference to the right part of the interval (there will always
be exactly one interval with right = 0)
*/
struct Interval(S)
if (isFloatingPoint!S)
{
/// left position of the interval
S lx;
/// right position of the interval
S rx;
/// T_c family of the interval
S c;
/// transformed left value of lx
S ltx;
/// transformed value of the first derivate of the left lx value
S lt1x;
/// transformed value of the second derivate of the left lx value
S lt2x;
/// transformed right value of rx
S rtx;
/// transformed value of the first derivate of the right rx value
S rt1x;
/// transformed value of the second derivate of the right rx value
S rt2x;
/// hat function of the interval
LinearFun!S hat;
/// squeeze function of the interval
LinearFun!S squeeze;
/// calculated area of the integrated hat function
S hatArea;
/// calculated area of the integrated squeeze function
S squeezeArea;
// workaround against @@@BUG 16331@@@
// sets NaN's to be equal on comparison
version(Flex_logging)
bool opEquals(const Interval s2) const
{
import std.math : isNaN, isFloatingPoint;
import std.meta : AliasSeq;
string buildMixin()
{
enum symbols = AliasSeq!("lx", "rx", "c", "ltx", "lt1x", "lt2x",
"rtx", "rt1x", "rt2x", "hat", "squeeze", "hatArea", "squeezeArea");
enum linSymbols = AliasSeq!("slope", "y", "a");
string s = "return ";
foreach (i, attr; symbols)
{
if (i > 0)
s ~= " && ";
s ~= "(";
auto attrName = symbols[i].stringof;
alias T = typeof(mixin("typeof(this).init." ~ attr));
if (isFloatingPoint!T)
{
// allow NaNs
s ~= "this." ~ attr ~ ".isNaN && s2." ~ attr ~ ".isNaN ||";
}
else if (is(T == const LinearFun!S))
{
// allow NaNs
s ~= "(";
foreach (j, linSymbol; linSymbols)
{
if (j > 0)
s ~= "||";
s ~= attr ~ "." ~ linSymbol ~ ".isNaN";
s ~= "&& s2." ~ attr ~ "." ~ linSymbol ~ ".isNaN";
}
s ~= ") ||";
}
s ~= attr ~ " == s2." ~ attr;
s ~= ")";
}
s ~= ";";
return s;
}
mixin(buildMixin());
}
///
version(Flex_logging_hex) string logHex()
{
import std.format : format;
return "Interval!%s(%a, %a, %a, %a, %a, %a, %a, %a, %a, %s, %s, %a, %a)"
.format(S.stringof, lx, rx, c, ltx, lt1x, lt2x, rtx, rt1x, rt2x,
hat.logHex, squeeze.logHex, hatArea, squeezeArea);
}
}
/**
Notations of different function types according to Botts et al. (2013).
It is based on this naming scheme:
- a: concAve
- b: convex
- Type 4 is the pure case without any inflection point
*/
enum FunType {undefined, T1a, T1b, T2a, T2b, T3a, T3b, T4a, T4b}
/**
Determine the function type of an interval.
Based on Theorem 1 of the Flex paper.
Params:
bl = left side of the interval
br = right side of the interval
*/
FunType determineType(S)(in Interval!S iv)
in
{
import std.math : isInfinity, isNaN;
assert(iv.lx < iv.rx, "invalid interval");
}
out(type)
{
version(Flex_logging)
if (!type)
warningf("Interval has an undefined type: %s", iv);
}
body
{
with(FunType)
{
// In each unbounded interval f must be concave and strictly monotone
// Condition 4 in section 2.3 from Botts et al. (2013)
if (iv.lx == -S.infinity)
{
if (iv.rt2x < 0 && iv.rt1x > 0)
return T4a;
return undefined;
}
if (iv.rx == +S.infinity)
{
if (iv.lt2x < 0 && iv.lt1x < 0)
return T4a;
return undefined;
}
if (iv.c > 0 && iv.ltx == 0 || iv.c <= 0 && iv.ltx == -S.infinity)
{
if (iv.rt2x < 0 && iv.rt1x > 0)
return T4a;
if (iv.rt2x > 0 && iv.rt1x > 0)
return T4b;
return undefined;
}
if (iv.c > 0 && iv.rtx == 0 || iv.c <= 0 && iv.rtx == -S.infinity)
{
if (iv.lt2x < 0 && iv.lt1x < 0)
return T4a;
if (iv.lt2x > 0 && iv.lt1x < 0)
return T4b;
return undefined;
}
if (iv.c < 0)
{
if (iv.ltx == 0 && iv.rt2x > 0 || iv.rtx == 0 && iv.lt2x > 0)
return T4b;
}
// slope of the interval
auto R = (iv.rtx - iv.ltx) / (iv.rx- iv.lx);
if (iv.lt1x >= R && iv.rt1x >= R)
return T1a;
if (iv.lt1x <= R && iv.rt1x <= R)
return T1b;
if (iv.lt2x <= 0 && iv.rt2x <= 0)
return T4a;
if (iv.lt2x >= 0 && iv.rt2x >= 0)
return T4b;
if (iv.lt1x >= R && R >= iv.rt1x)
{
if (iv.lt2x < 0 && iv.rt2x > 0)
return T2a;
if (iv.lt2x > 0 && iv.rt2x < 0)
return T2b;
}
else if (iv.lt1x <= R && R <= iv.rt1x)
{
if (iv.lt2x < 0 && iv.rt2x > 0)
return T3a;
if (iv.lt2x > 0 && iv.rt2x < 0)
return T3b;
}
return undefined;
}
}
unittest
{
import std.meta : AliasSeq;
foreach (S; AliasSeq!(float, double, real)) with(FunType)
{
const f0 = (S x) => x ^^ 4;
const f1 = (S x) => 4 * x ^^ 3;
const f2 = (S x) => 12 * x * x;
enum c = 42; // c doesn't matter here
auto dt = (S l, S r) => determineType(Interval!S(l, r, c, f0(l), f1(l), f2(l),
f0(r), f1(r), f2(r)));
// entirely convex
assert(dt(-3.0, -1) == T4b);
assert(dt(-1.0, 1) == T4b);
assert(dt(1.0, 3) == T4b);
}
}
// test x^3
unittest
{
import std.meta : AliasSeq;
foreach (S; AliasSeq!(float, double, real)) with(FunType)
{
const f0 = (S x) => x ^^ 3;
const f1 = (S x) => 3 * x ^^ 2;
const f2 = (S x) => 6 * x;
enum c = 42; // c doesn't matter here
auto dt = (S l, S r) => determineType(Interval!S(l, r, c, f0(l), f1(l), f2(l),
f0(r), f1(r), f2(r)));
// concave
assert(dt(-S.infinity, S(-1.0)) == T4a);
assert(dt(S(-3.0), S(-1)) == T4a);
// inflection point at x = 0, concave before
assert(dt(S(-1.0), S(1)) == T1a);
// convex
assert(dt(S(1.0), S(3)) == T4b);
}
}
// test sin(x)
unittest
{
import std.math: PI;
// due to numerical errors a small padding must be added
// see e.g. https://gist.github.com/wilzbach/3d27d06b55821aa9795deb15d4d47679
import std.math : cos, sin;
import std.meta : AliasSeq;
foreach (S; AliasSeq!(float, double, real)) with(FunType)
{
import std.stdio;
const f0 = (S x) => sin(x);
const f1 = (S x) => cos(x);
const f2 = (S x) => -sin(x);
enum c = 42; // c doesn't matter here
auto dt = (S l, S r) => determineType(Interval!S(l, r, c, f0(l), f1(l), f2(l),
f0(r), f1(r), f2(r)));
// type 1a: concave
assert(dt(0.01, 2 * PI - 0.01) == T1a);
assert(dt(2 * PI + 0.01, 4 * PI - 0.01) == T1a);
assert(dt(2, 4) == T1a);
assert(dt(0.01, 5) == T1a);
assert(dt(1, 5) == T1a);
// type 1b: convex
assert(dt(-PI, PI) == T1b);
assert(dt(PI, 3 * PI) == T1b);
assert(dt(4, 8) == T1b);
// type 2a: concave
assert(dt(1, 4) == T2a);
// type 2b: convex
assert(dt(6, 8) == T2b);
// type 3a: concave
assert(dt(3, 4) == T3a);
assert(dt(2, 5.7) == T3a);
// type 3b: concave
assert(dt(-3, 0.1) == T3b);
// type 4a - pure concave intervals (special case of 2a)
assert(dt(0.01, PI - 0.01) == T4a);
assert(dt(0.01, 3) == T4a);
assert(dt(2 * PI + 0.01, 3 * PI - 0.01) == T4a);
// type 4b - pure convex intervals (special case of 3b)
assert(dt(-PI + 0.01, -0.01) == T4b);
assert(dt(PI + 0.01, 2 * PI - 0.01) == T4b);
assert(dt(4, 6) == T4b);
}
}
unittest
{
import std.meta : AliasSeq;
foreach (S; AliasSeq!(float, double, real)) with(FunType)
{
const f0 = (S x) => x * x;
const f1 = (S x) => 2 * x;
const f2 = (S x) => 2.0;
enum c = 42; // c doesn't matter here
auto dt = (S l, S r) => determineType(Interval!S(l, r, c, f0(l), f1(l), f2(l),
f0(r), f1(r), f2(r)));
// entirely convex
assert(dt(-1, 1) == T4b);
assert(dt(1, 3) == T4b);
}
}
/**
Representation of linear function of the form:
y = slope * (x - y) + a
This representation allows a bit higher precision than the
typical representation `y = slope * x + a`.
*/
struct LinearFun(S)
{
import std.format : FormatSpec;
/// direction and steepness (aka beta)
S slope;
/// boundary point where f obtains it's maximum
S y;
/// constant intercept
S a;
/**
Params:
slope = direction and steepness
y = boundary point, often f(x)
a = constant intercept
*/
this(S slope, S y, S a)
{
this.slope = slope;
this.y = y;
this.a = a;
}
/// textual representation of the function
void toString(scope void delegate(const(char)[]) sink,
FormatSpec!char fmt) const
{
import std.range : put;
import std.format: formatValue, singleSpec;
switch(fmt.spec)
{
case 'l':
import std.math: abs, approxEqual, isNaN;
if (slope.isNaN)
sink.put("#NaN#");
else
{
auto spec2g = singleSpec("%.2g");
if (!slope.approxEqual(0))
{
sink.formatValue(slope, spec2g);
sink.put("x");
if (!intercept.approxEqual(0))
{
sink.put(" ");
char sgn = intercept > 0 ? '+' : '-';
sink.put(sgn);
sink.put(" ");
sink.formatValue(abs(intercept), spec2g);
}
}
else
{
sink.formatValue(intercept, spec2g);
}
}
break;
case 's':
default:
import std.traits : Unqual;
sink.put(Unqual!(typeof(this)).stringof);
auto spec2g = singleSpec("%.6g");
sink.put("(");
sink.formatValue(slope, spec2g);
sink.put(", ");
sink.formatValue(y, spec2g);
sink.put(", ");
sink.formatValue(a, spec2g);
sink.put(")");
break;
}
}
/// call the linear function with x
S opCall(in S x) const
{
S val = slope * (x - y);
val += a;
return val;
}
/// calculate inverse of x
S inverse(S x) const
{
return y + (x - a) / slope;
}
// calculate intercept (for debugging)
S intercept() @property const
{
return slope * -y + a;
}
///
string logHex()
{
import std.format : format;
return "LinearFun!%s(%a, %a, %a)".format(S.stringof, slope, y, a);
}
}
/**
Constructs a linear function of the form `y = slope * (x - y) + a`.
Params:
slope = direction and steepness
y = boundary point, often f(x)
a = constant intercept
Returns:
A linear function constructed with the given parameters.
*/
LinearFun!S linearFun(S)(S slope, S y, S a)
{
return LinearFun!S(slope, y, a);
}
/// tangent of a point
unittest
{
import std.format : format;
auto f = (double x) => x * x + 1;
auto df = (double x) => 2 * x;
auto buildTan = (double x) => linearFun(df(x), x, f(x));
auto t0 = buildTan(0);
assert("%l".format(t0)== "1");
assert(t0(0) == 1);
assert(t0(42) == 1);
auto t1 = buildTan(1);
assert("%l".format(t1) == "2x");
assert(t1(1) == 2);
assert(t1(2) == 4);
auto t2 = buildTan(2);
assert("%l".format(t2) == "4x - 3");
assert(t2(1) == 1);
assert(t2(2) == 5);
}
/// secant of two points
unittest
{
import std.format : format;
auto f = (double x) => x * x + 1;
auto lx = 1, rx = 3;
// compute the slope between lx and rx
auto lf = linearFun((f(rx) - f(lx)) / (rx - lx), lx, f(lx));
assert("%l".format(lf) == "4x - 2");
assert(lf(1) == 2); // f(1)
assert(lf(3) == 10); // f(3)
}
/// construct an arbitrary linear function
unittest
{
import std.format : format;
// 2 * x + 1
auto t = linearFun!double(2, 0, 1);
assert("%l".format(t) == "2x + 1");
assert(t(1) == 3);
assert(t(-2) == -3);
}
unittest
{
import std.meta : AliasSeq;
foreach (S; AliasSeq!(float, double, real))
{
auto f1 = (S x) => 2 * x;
auto t1 = linearFun!S(f1(1), 1, 1);
assert(t1.slope == 2);
assert(t1.intercept == -1);
auto t2 = linearFun!S(f1(0), 0, 0);
assert(t2.slope == 0);
assert(t2.intercept == 0);
}
}
unittest
{
import std.math : cos;
import std.math : PI, approxEqual;
import std.meta : AliasSeq;
foreach (S; AliasSeq!(float, double, real))
{
auto f = (S x) => cos(x);
auto buildTan = (S x, S y) => linearFun(f(x), x, y);
auto t1 = buildTan(0, 0);
assert(t1.slope == 1);
assert(t1.intercept == 0);
auto t2 = buildTan(PI / 2, 1);
assert(t2.slope.approxEqual(0));
assert(t2.intercept.approxEqual(1));
}
}
// test default toString
unittest
{
import std.format : format;
auto t = linearFun!double(2, 0, 1);
assert("%s".format(t) == "LinearFun!double(2, 0, 1)");
}
// test NaN behavior
unittest
{
import std.format : format;
auto t = linearFun!double(double.nan, 0, 1);
assert("%s".format(t) == "LinearFun!double(nan, 0, 1)");
assert("%l".format(t) == "#NaN#");
}
/**
Compares whether to linear functions are approximately equal.
Params:
x = first linear function to compare
y = second linear function to compare
maxRelDiff = maximum relative difference
maxAbsDiff = maximum absolute difference
Returns:
True if both linear functions are approximately equal.
*/
bool approxEqual(S)(LinearFun!S x, LinearFun!S y, S maxRelDiff = 1e-2, S maxAbsDiff = 1e-5)
{
import std.math : approxEqual;
return x.slope.approxEqual(y.slope, maxRelDiff, maxAbsDiff) &&
x.y.approxEqual(y.y, maxRelDiff, maxAbsDiff) &&
x.a.approxEqual(y.a, maxRelDiff, maxAbsDiff);
}
///
unittest
{
auto x = linearFun!double(2, 0, 1);
auto x2 = linearFun!double(2, 0, 1);
assert(x.approxEqual(x2));
auto y = linearFun!double(2, 1e-9, 1);
assert(x.approxEqual(y));
auto z = linearFun!double(2, 4, 1);
assert(!x.approxEqual(z));
}
|
D
|
/Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Settings.build/KeyAccessible.swift.o : /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config+Arguments.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config+Directory.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/KeyAccessible+Merge.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/KeyAccessible.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Node+Merge.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Source.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/Env.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/Node+Env.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/String+Env.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Core.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/libc.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/JSON.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Jay.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Node.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/PathIndexable.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Polymorphic.swiftmodule
/Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Settings.build/KeyAccessible~partial.swiftmodule : /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config+Arguments.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config+Directory.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/KeyAccessible+Merge.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/KeyAccessible.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Node+Merge.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Source.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/Env.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/Node+Env.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/String+Env.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Core.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/libc.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/JSON.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Jay.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Node.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/PathIndexable.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Polymorphic.swiftmodule
/Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Settings.build/KeyAccessible~partial.swiftdoc : /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config+Arguments.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config+Directory.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Config.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/KeyAccessible+Merge.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/KeyAccessible.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Node+Merge.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Source.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/Env.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/Node+Env.swift /Users/miladmehrpoo/Desktop/Helloworld/Packages/Vapor-1.1.1/Sources/Settings/Env/String+Env.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Core.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/libc.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/JSON.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Jay.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Node.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/PathIndexable.swiftmodule /Users/miladmehrpoo/Desktop/Helloworld/.build/debug/Polymorphic.swiftmodule
|
D
|
instance VLK_4140_Waffenknecht (Npc_Default)
{
// ------ NSC ------
name = NAME_WAFFENKNECHT;
guild = GIL_MIL;
id = 4140;
voice = 1;
flags = 0; //NPC_FLAG_IMMORTAL oder 0
npctype = NPCTYPE_OCAMBIENT;
// ------ Attribute ------
B_SetAttributesToChapter (self, 1); //setzt Attribute und LEVEL entsprechend dem angegebenen Kapitel (1-6)
// ------ Kampf-Taktik ------
fight_tactic = FAI_HUMAN_COWARD; // MASTER / STRONG / COWARD
// ------ Equippte Waffen ------ //Munition wird automatisch generiert, darf aber angegeben werden
EquipItem (self, ItMw_1H_Mil_Sword);
// ------ Inventory ------
B_CreateAmbientInv (self);
// ------ visuals ------ //Muss NACH Attributen kommen, weil in B_SetNpcVisual die Breite abh. v. STR skaliert wird
B_SetNpcVisual (self, MALE, "Hum_Head_Bald", Face_B_Tough_Silas, BodyTex_B, ITAR_MIL_L);
Mdl_SetModelFatness (self, 2);
Mdl_ApplyOverlayMds (self, "Humans_Militia.mds"); // Tired / Militia / Mage / Arrogance / Relaxed
// ------ NSC-relevante Talente vergeben ------
B_GiveNpcTalents (self);
// ------ Kampf-Talente ------ //Der enthaltene B_AddFightSkill setzt Talent-Ani abhängig von TrefferChance% - alle Kampftalente werden gleichhoch gesetzt
B_SetFightSkills (self, 30); //Grenzen für Talent-Level liegen bei 30 und 60
// ------ TA anmelden ------
daily_routine = Rtn_Start_4140;
};
FUNC VOID Rtn_Start_4140 ()
{
TA_Smalltalk (08,00,23,00,"OC_CENTER_03");
TA_Sit_Campfire (23,00,08,00,"OC_KNECHTCAMP_01");
};
|
D
|
/****************************************************************************
**
** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtWinExtras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWINTHUMBNAILTOOLBAR_H
#define QWINTHUMBNAILTOOLBAR_H
public import qt.QtCore.qobject;
public import qt.QtCore.qscopedpointer;
public import qt.QtWinExtras.qwinextrasglobal;
QT_BEGIN_NAMESPACE
class QPixmap;
class QWindow;
class QWinThumbnailToolButton;
class QWinThumbnailToolBarPrivate;
class Q_WINEXTRAS_EXPORT QWinThumbnailToolBar : public QObject
{
mixin Q_OBJECT;
mixin Q_PROPERTY!(int, "count", "READ", "count", "STORED", "false");
mixin Q_PROPERTY!(QWindow, "*window", "READ", "window", "WRITE", "setWindow");
mixin Q_PROPERTY!(bool, "iconicPixmapNotificationsEnabled", "READ", "iconicPixmapNotificationsEnabled", "WRITE", "setIconicPixmapNotificationsEnabled");
mixin Q_PROPERTY!(QPixmap, "iconicThumbnailPixmap", "READ", "iconicThumbnailPixmap", "WRITE", "setIconicThumbnailPixmap");
mixin Q_PROPERTY!(QPixmap, "iconicLivePreviewPixmap", "READ", "iconicLivePreviewPixmap", "WRITE", "setIconicLivePreviewPixmap");
public:
explicit QWinThumbnailToolBar(QObject *parent = 0);
~QWinThumbnailToolBar();
void setWindow(QWindow *window);
QWindow *window() const;
void addButton(QWinThumbnailToolButton *button);
void removeButton(QWinThumbnailToolButton *button);
void setButtons(const QList<QWinThumbnailToolButton *> &buttons);
QList<QWinThumbnailToolButton *> buttons() const;
int count() const;
bool iconicPixmapNotificationsEnabled() const;
void setIconicPixmapNotificationsEnabled(bool enabled);
QPixmap iconicThumbnailPixmap() const;
QPixmap iconicLivePreviewPixmap() const;
public Q_SLOTS:
void clear();
void setIconicThumbnailPixmap(ref const(QPixmap) );
void setIconicLivePreviewPixmap(ref const(QPixmap) );
Q_SIGNALS:
void iconicThumbnailPixmapRequested();
void iconicLivePreviewPixmapRequested();
private:
mixin Q_DISABLE_COPY;
mixin Q_DECLARE_PRIVATE;
QScopedPointer<QWinThumbnailToolBarPrivate> d_ptr;
friend class QWinThumbnailToolButton;
Q_PRIVATE_SLOT(d_func(), void _q_updateToolbar())
Q_PRIVATE_SLOT(d_func(), void _q_scheduleUpdate())
};
QT_END_NAMESPACE
#endif // QWINTHUMBNAILTOOLBAR_H
|
D
|
/home/syx/SYXrepo/vacation_homework/percolation/target/debug/deps/libeither-cafae82f01e79117.rlib: /home/syx/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/either-1.5.0/src/lib.rs
/home/syx/SYXrepo/vacation_homework/percolation/target/debug/deps/either-cafae82f01e79117.d: /home/syx/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/either-1.5.0/src/lib.rs
/home/syx/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/either-1.5.0/src/lib.rs:
|
D
|
$NetBSD$
--- runtime/druntime/src/core/sys/posix/grp.d.orig 2016-01-21 15:39:03.000000000 +0000
+++ runtime/druntime/src/core/sys/posix/grp.d
@@ -68,6 +68,19 @@ else version( FreeBSD )
char** gr_mem;
}
}
+else version( NetBSD )
+{
+ struct group
+ {
+ char* gr_name;
+ char* gr_passwd;
+ gid_t gr_gid;
+ char** gr_mem;
+ }
+
+ group* getgrnam(in char*);
+ group* getgrgid(gid_t);
+}
else version( Solaris )
{
struct group
@@ -119,6 +132,11 @@ else version( FreeBSD )
int getgrnam_r(in char*, group*, char*, size_t, group**);
int getgrgid_r(gid_t, group*, char*, size_t, group**);
}
+else version( NetBSD )
+{
+ int getgrnam_r(in char*, group*, char*, size_t, group**);
+ int getgrgid_r(gid_t, group*, char*, size_t, group**);
+}
else version( Solaris )
{
int getgrnam_r(in char*, group*, char*, int, group**);
@@ -159,6 +177,12 @@ else version( FreeBSD )
@trusted void endgrent();
@trusted void setgrent();
}
+else version( NetBSD )
+{
+ group* getgrent();
+ @trusted void endgrent();
+ @trusted void setgrent();
+}
else version( Solaris )
{
group* getgrent();
|
D
|
module text.Unicode;
deprecated ткст блокВЗаг(ткст ввод, ткст вывод = пусто, дим[] working = пусто);
ткст вЗаг(ткст ввод, ткст вывод = пусто) ;
шим[] вЗаг(шим[] ввод, шим[] вывод = пусто) ;
дим[] вЗаг(дим[] ввод, дим[] вывод = пусто);
ткст вПроп(ткст ввод, ткст вывод = пусто);
шим[] вПроп(шим[] ввод, шим[] вывод = пусто);
дим[] вПроп(дим[] ввод, дим[] вывод = пусто);
ткст вФолд(ткст ввод, ткст вывод = пусто) ;
шим[] вФолд(шим[] ввод, шим[] вывод = пусто);
дим[] вФолд(дим[] ввод, дим[] вывод = пусто) ;
бул цифра_ли(дим ch) ;
бул буква_ли(цел ch);
бул букваИлиЦифра(цел ch) ;
бул проп_ли(дим ch) ;
бул титул_ли(дим ch);
бул заг_ли(дим ch) ;
бул пробел_ли(дим ch);
бул пбел_ли(дим ch) ;
бул печат_ли(дим ch) ;
|
D
|
// sphere.h
//
// Copyright (C) 2003, 2004 Jason Bevins
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
// License (COPYING.txt) for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// The developer's email is jlbezigvins@gmzigail.com (for great email, take
// off every 'zig'.)
//
module noise.model.sphere;
private {
import noise.mod.modulebase;
import noise.latlon;
}
/// @addtogroup libnoise
/// @{
/// @addtogroup models
/// @{
/// Model that defines the surface of a sphere.
///
/// @image html modelsphere.png
///
/// This model returns an output value from a noise module given the
/// coordinates of an input value located on the surface of a sphere.
///
/// To generate an output value, pass the (latitude, longitude)
/// coordinates of an input value to the GetValue() method.
///
/// This model is useful for creating:
/// - seamless textures that can be mapped onto a sphere
/// - terrain height maps for entire planets
///
/// This sphere has a radius of 1.0 unit and its center is located at
/// the origin.
class Sphere
{
public:
/// Constructor.
this ()
{
m_pMod = null;
}
/// Constructor
///
/// @param module The noise module that is used to generate the output
/// values.
this (ref const(Mod) mod)
{
m_pMod = &mod;
}
/// Returns the noise module that is used to generate the output
/// values.
///
/// @returns A reference to the noise module.
///
/// @pre A noise module was passed to the SetMod() method.
ref const(Mod) GetMod () const
{
assert (m_pMod !is null);
return *m_pMod;
}
/// Returns the output value from the noise module given the
/// (latitude, longitude) coordinates of the specified input value
/// located on the surface of the sphere.
///
/// @param lat The latitude of the input value, in degrees.
/// @param lon The longitude of the input value, in degrees.
///
/// @returns The output value from the noise module.
///
/// @pre A noise module was passed to the SetMod() method.
///
/// This output value is generated by the noise module passed to the
/// SetMod() method.
///
/// Use a negative latitude if the input value is located on the
/// southern hemisphere.
///
/// Use a negative longitude if the input value is located on the
/// western hemisphere.
double GetValue (double lat, double lon) const
{
assert (m_pMod !is null);
double x, y, z;
LatLonToXYZ (lat, lon, x, y, z);
return m_pMod.GetValue (x, y, z);
}
/// Sets the noise module that is used to generate the output values.
///
/// @param module The noise module that is used to generate the output
/// values.
///
/// This noise module must exist for the lifetime of this object,
/// until you pass a new noise module to this method.
void SetMod (ref const(Mod) mod)
{
m_pMod = &mod;
}
private:
/// A pointer to the noise module used to generate the output values.
const(Mod)* m_pMod;
};
/// @}
/// @}
|
D
|
instance BDT_1035_Fluechtling(Npc_Default)
{
name[0] = NAME_Fluechtling;
guild = GIL_OUT;
id = 1035;
voice = 7;
flags = 0;
npcType = npctype_main;
B_SetAttributesToChapter(self,3);
fight_tactic = FAI_HUMAN_STRONG;
EquipItem(self,ItMw_1h_Sld_Sword);
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_FatBald",Face_B_Normal_Orik,BodyTex_B,ITAR_Leather_L);
Mdl_SetModelFatness(self,2);
Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,60);
daily_routine = Rtn_Start_1035;
};
func void Rtn_Start_1035()
{
TA_Smalltalk(8,0,23,0,"NW_BIGFARM_HOUSE_OUT_05");
TA_Smalltalk(23,0,8,0,"NW_BIGFARM_HOUSE_OUT_05");
};
|
D
|
///////////////////////////////////////////////////////////////////////
// Info EXIT
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_1015_BANDIT_EXIT (C_INFO)
{
npc = BDT_1015_Bandit_L;
nr = 999;
condition = DIA_1015_BANDIT_EXIT_Condition;
information = DIA_1015_BANDIT_EXIT_Info;
permanent = TRUE;
description = DIALOG_ENDE;
};
FUNC INT DIA_1015_BANDIT_EXIT_Condition()
{
return TRUE;
};
FUNC VOID DIA_1015_BANDIT_EXIT_Info()
{
AI_StopProcessInfos (self);
};
///////////////////////////////////////////////////////////////////////
// Info AMBUSH
///////////////////////////////////////////////////////////////////////
instance DIA_1015_BANDIT_AMBUSH (C_INFO)
{
npc = BDT_1015_Bandit_L;
nr = 2;
condition = DIA_1015_BANDIT_AMBUSH_Condition;
information = DIA_1015_BANDIT_AMBUSH_Info;
permanent = FALSE;
IMPORTANT = TRUE;
};
func int DIA_1015_BANDIT_AMBUSH_Condition ()
{
if (Npc_IsDead (Ambusher_1014))
|| (Npc_IsInState (self, ZS_Talk))
{
return TRUE;
};
};
func void DIA_1015_BANDIT_AMBUSH_Info ()
{
AI_Output (self, other, "DIA_1015_BANDIT_AMBUSH_06_00"); //Hej, chyba widziałem już tę gębę...
AI_StopProcessInfos (self);
B_Attack (self, other, AR_SuddenEnemyInferno, 1);
};
|
D
|
// Written in the D programming language.
/**
* Elementary mathematical functions
*
* Contains the elementary mathematical functions (powers, roots,
* and trignometric functions), and low-level floating-point operations.
* Mathematical special functions are available in std.mathspecial.
*
* The functionality closely follows the IEEE754-2008 standard for
* floating-point arithmetic, including the use of camelCase names rather
* than C99-style lower case names. All of these functions behave correctly
* when presented with an infinity or NaN.
*
* Unlike C, there is no global 'errno' variable. Consequently, almost all of
* these functions are pure nothrow.
*
* Status:
* The semantics and names of feqrel and approxEqual will be revised.
*
* Source: $(PHOBOSSRC std/_math.d)
* Macros:
* WIKI = Phobos/StdMath
*
* TABLE_SV = <table border=1 cellpadding=4 cellspacing=0>
* <caption>Special Values</caption>
* $0</table>
* SVH = $(TR $(TH $1) $(TH $2))
* SV = $(TR $(TD $1) $(TD $2))
*
* NAN = $(RED NAN)
* SUP = <span style="vertical-align:super;font-size:smaller">$0</span>
* GAMMA = Γ
* THETA = θ
* INTEGRAL = ∫
* INTEGRATE = $(BIG ∫<sub>$(SMALL $1)</sub><sup>$2</sup>)
* POWER = $1<sup>$2</sup>
* SUB = $1<sub>$2</sub>
* BIGSUM = $(BIG Σ <sup>$2</sup><sub>$(SMALL $1)</sub>)
* CHOOSE = $(BIG () <sup>$(SMALL $1)</sup><sub>$(SMALL $2)</sub> $(BIG ))
* PLUSMN = ±
* INFIN = ∞
* PLUSMNINF = ±∞
* PI = π
* LT = <
* GT = >
* SQRT = √
* HALF = ½
*
* Copyright: Copyright Digital Mars 2000 - 2011.
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: $(WEB digitalmars.com, Walter Bright),
* Don Clugston
* Source: $(PHOBOSSRC std/_math.d)
*/
module std.math;
import core.stdc.math;
import std.range, std.traits;
version(unittest) {
import std.typetuple;
}
version(LDC) {
import ldc.intrinsics;
}
version(DigitalMars){
version = INLINE_YL2X; // x87 has opcodes for these
}
version (X86){
version = X86_Any;
}
version (X86_64){
version = X86_Any;
}
version(D_InlineAsm_X86){
version = InlineAsm_X86_Any;
}
else version(D_InlineAsm_X86_64){
version = InlineAsm_X86_Any;
}
private:
/*
* The following IEEE 'real' formats are currently supported:
* 64 bit Big-endian 'double' (eg PowerPC)
* 128 bit Big-endian 'quadruple' (eg SPARC)
* 64 bit Little-endian 'double' (eg x86-SSE2)
* 80 bit Little-endian, with implied bit 'real80' (eg x87, Itanium).
* 128 bit Little-endian 'quadruple' (not implemented on any known processor!)
*
* Non-IEEE 128 bit Big-endian 'doubledouble' (eg PowerPC) has partial support
*/
version(LittleEndian) {
static assert(real.mant_dig == 53 || real.mant_dig==64
|| real.mant_dig == 113,
"Only 64-bit, 80-bit, and 128-bit reals"
" are supported for LittleEndian CPUs");
} else {
static assert(real.mant_dig == 53 || real.mant_dig==106
|| real.mant_dig == 113,
"Only 64-bit and 128-bit reals are supported for BigEndian CPUs."
" double-double reals have partial support");
}
// Constants used for extracting the components of the representation.
// They supplement the built-in floating point properties.
template floatTraits(T) {
// EXPMASK is a ushort mask to select the exponent portion (without sign)
// EXPPOS_SHORT is the index of the exponent when represented as a ushort array.
// SIGNPOS_BYTE is the index of the sign when represented as a ubyte array.
// RECIP_EPSILON is the value such that (smallest_subnormal) * RECIP_EPSILON == T.min_normal
enum T RECIP_EPSILON = (1/T.epsilon);
static if (T.mant_dig == 24)
{ // float
enum ushort EXPMASK = 0x7F80;
enum ushort EXPBIAS = 0x3F00;
enum uint EXPMASK_INT = 0x7F80_0000;
enum uint MANTISSAMASK_INT = 0x007F_FFFF;
version(LittleEndian) {
enum EXPPOS_SHORT = 1;
} else {
enum EXPPOS_SHORT = 0;
}
}
else static if (T.mant_dig == 53) // double, or real==double
{
enum ushort EXPMASK = 0x7FF0;
enum ushort EXPBIAS = 0x3FE0;
enum uint EXPMASK_INT = 0x7FF0_0000;
enum uint MANTISSAMASK_INT = 0x000F_FFFF; // for the MSB only
version(LittleEndian) {
enum EXPPOS_SHORT = 3;
enum SIGNPOS_BYTE = 7;
} else {
enum EXPPOS_SHORT = 0;
enum SIGNPOS_BYTE = 0;
}
}
else static if (T.mant_dig == 64) // real80
{
enum ushort EXPMASK = 0x7FFF;
enum ushort EXPBIAS = 0x3FFE;
version(LittleEndian)
{
enum EXPPOS_SHORT = 4;
enum SIGNPOS_BYTE = 9;
}
else
{
enum EXPPOS_SHORT = 0;
enum SIGNPOS_BYTE = 0;
}
} else static if (T.mant_dig == 113){ // quadruple
enum ushort EXPMASK = 0x7FFF;
version(LittleEndian)
{
enum EXPPOS_SHORT = 7;
enum SIGNPOS_BYTE = 15;
}
else
{
enum EXPPOS_SHORT = 0;
enum SIGNPOS_BYTE = 0;
}
} else static if (T.mant_dig == 106) { // doubledouble
enum ushort EXPMASK = 0x7FF0;
// the exponent byte is not unique
version(LittleEndian)
{
enum EXPPOS_SHORT = 7; // [3] is also an exp short
enum SIGNPOS_BYTE = 15;
}
else
{
enum EXPPOS_SHORT = 0; // [4] is also an exp short
enum SIGNPOS_BYTE = 0;
}
}
}
// These apply to all floating-point types
version(LittleEndian)
{
enum MANTISSA_LSB = 0;
enum MANTISSA_MSB = 1;
}
else
{
enum MANTISSA_LSB = 1;
enum MANTISSA_MSB = 0;
}
public:
// Values obtained from Wolfram Alpha. 116 bits ought to be enough for anybody.
// Wolfram Alpha LLC. 2011. Wolfram|Alpha. http://www.wolframalpha.com/input/?i=e+in+base+16 (access July 6, 2011).
enum real E = 0x1.5bf0a8b1457695355fb8ac404e7a8p+1L; /** e = 2.718281... */
enum real LOG2T = 0x1.a934f0979a3715fc9257edfe9b5fbp+1L; /** $(SUB log, 2)10 = 3.321928... */
enum real LOG2E = 0x1.71547652b82fe1777d0ffda0d23a8p+0L; /** $(SUB log, 2)e = 1.442695... */
enum real LOG2 = 0x1.34413509f79fef311f12b35816f92p-2L; /** $(SUB log, 10)2 = 0.301029... */
enum real LOG10E = 0x1.bcb7b1526e50e32a6ab7555f5a67cp-2L; /** $(SUB log, 10)e = 0.434294... */
enum real LN2 = 0x1.62e42fefa39ef35793c7673007e5fp-1L; /** ln 2 = 0.693147... */
enum real LN10 = 0x1.26bb1bbb5551582dd4adac5705a61p+1L; /** ln 10 = 2.302585... */
enum real PI = 0x1.921fb54442d18469898cc51701b84p+1L; /** $(_PI) = 3.141592... */
enum real PI_2 = PI/2; /** $(PI) / 2 = 1.570796... */
enum real PI_4 = PI/4; /** $(PI) / 4 = 0.785398... */
enum real M_1_PI = 0x1.45f306dc9c882a53f84eafa3ea69cp-2L; /** 1 / $(PI) = 0.318309... */
enum real M_2_PI = 2*M_1_PI; /** 2 / $(PI) = 0.636619... */
enum real M_2_SQRTPI = 0x1.20dd750429b6d11ae3a914fed7fd8p+0L; /** 2 / $(SQRT)$(PI) = 1.128379... */
enum real SQRT2 = 0x1.6a09e667f3bcc908b2fb1366ea958p+0L; /** $(SQRT)2 = 1.414213... */
enum real SQRT1_2 = SQRT2/2; /** $(SQRT)$(HALF) = 0.707106... */
// Note: Make sure the magic numbers in compiler backend for x87 match these.
/*
Octal versions:
PI/64800 0.00001 45530 36176 77347 02143 15351 61441 26767
PI/180 0.01073 72152 11224 72344 25603 54276 63351 22056
PI/8 0.31103 75524 21026 43021 51423 06305 05600 67016
SQRT(1/PI) 0.44067 27240 41233 33210 65616 51051 77327 77303
2/PI 0.50574 60333 44710 40522 47741 16537 21752 32335
PI/4 0.62207 73250 42055 06043 23046 14612 13401 56034
SQRT(2/PI) 0.63041 05147 52066 24106 41762 63612 00272 56161
PI 3.11037 55242 10264 30215 14230 63050 56006 70163
LOG2 0.23210 11520 47674 77674 61076 11263 26013 37111
*/
/***********************************
* Calculates the absolute value
*
* For complex numbers, abs(z) = sqrt( $(POWER z.re, 2) + $(POWER z.im, 2) )
* = hypot(z.re, z.im).
*/
Num abs(Num)(Num x) @safe pure nothrow
if (is(typeof(Num.init >= 0)) && is(typeof(-Num.init)) &&
!(is(Num* : const(ifloat*)) || is(Num* : const(idouble*))
|| is(Num* : const(ireal*))))
{
static if (isFloatingPoint!(Num))
return fabs(x);
else
return x>=0 ? x : -x;
}
auto abs(Num)(Num z) @safe pure nothrow
if (is(Num* : const(cfloat*)) || is(Num* : const(cdouble*))
|| is(Num* : const(creal*)))
{
return hypot(z.re, z.im);
}
/** ditto */
real abs(Num)(Num y) @safe pure nothrow
if (is(Num* : const(ifloat*)) || is(Num* : const(idouble*))
|| is(Num* : const(ireal*)))
{
return fabs(y.im);
}
unittest
{
assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-3.2Li) == 3.2L);
assert(abs(71.6Li) == 71.6L);
assert(abs(-56) == 56);
assert(abs(2321312L) == 2321312L);
assert(abs(-1+1i) == sqrt(2.0));
}
/***********************************
* Complex conjugate
*
* conj(x + iy) = x - iy
*
* Note that z * conj(z) = $(POWER z.re, 2) - $(POWER z.im, 2)
* is always a real number
*/
creal conj(creal z) @safe pure nothrow
{
return z.re - z.im*1i;
}
/** ditto */
ireal conj(ireal y) @safe pure nothrow
{
return -y;
}
unittest
{
assert(conj(7 + 3i) == 7-3i);
ireal z = -3.2Li;
assert(conj(z) == -z);
}
/***********************************
* Returns cosine of x. x is in radians.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH cos(x)) $(TH invalid?))
* $(TR $(TD $(NAN)) $(TD $(NAN)) $(TD yes) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(NAN)) $(TD yes) )
* )
* Bugs:
* Results are undefined if |x| >= $(POWER 2,64).
*/
real cos(real x) @safe pure nothrow; /* intrinsic */
/***********************************
* Returns sine of x. x is in radians.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH sin(x)) $(TH invalid?))
* $(TR $(TD $(NAN)) $(TD $(NAN)) $(TD yes))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no))
* $(TR $(TD $(PLUSMNINF)) $(TD $(NAN)) $(TD yes))
* )
* Bugs:
* Results are undefined if |x| >= $(POWER 2,64).
*/
real sin(real x) @safe pure nothrow; /* intrinsic */
/***********************************
* sine, complex and imaginary
*
* sin(z) = sin(z.re)*cosh(z.im) + cos(z.re)*sinh(z.im)i
*
* If both sin($(THETA)) and cos($(THETA)) are required,
* it is most efficient to use expi($(THETA)).
*/
creal sin(creal z) @safe pure nothrow
{
creal cs = expi(z.re);
creal csh = coshisinh(z.im);
return cs.im * csh.re + cs.re * csh.im * 1i;
}
/** ditto */
ireal sin(ireal y) @safe pure nothrow
{
return cosh(y.im)*1i;
}
unittest
{
assert(sin(0.0+0.0i) == 0.0);
assert(sin(2.0+0.0i) == sin(2.0L) );
}
/***********************************
* cosine, complex and imaginary
*
* cos(z) = cos(z.re)*cosh(z.im) - sin(z.re)*sinh(z.im)i
*/
creal cos(creal z) @safe pure nothrow
{
creal cs = expi(z.re);
creal csh = coshisinh(z.im);
return cs.re * csh.re - cs.im * csh.im * 1i;
}
/** ditto */
real cos(ireal y) @safe pure nothrow
{
return cosh(y.im);
}
unittest{
assert(cos(0.0+0.0i)==1.0);
assert(cos(1.3L+0.0i)==cos(1.3L));
assert(cos(5.2Li)== cosh(5.2L));
}
/****************************************************************************
* Returns tangent of x. x is in radians.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH tan(x)) $(TH invalid?))
* $(TR $(TD $(NAN)) $(TD $(NAN)) $(TD yes))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no))
* $(TR $(TD $(PLUSMNINF)) $(TD $(NAN)) $(TD yes))
* )
*/
real tan(real x) @trusted pure nothrow
{
version(D_InlineAsm_X86)
{
asm
{
fld x[EBP] ; // load theta
fxam ; // test for oddball values
fstsw AX ;
sahf ;
jc trigerr ; // x is NAN, infinity, or empty
// 387's can handle subnormals
SC18: fptan ;
fstp ST(0) ; // dump X, which is always 1
fstsw AX ;
sahf ;
jnp Lret ; // C2 = 1 (x is out of range)
// Do argument reduction to bring x into range
fldpi ;
fxch ;
SC17: fprem1 ;
fstsw AX ;
sahf ;
jp SC17 ;
fstp ST(1) ; // remove pi from stack
jmp SC18 ;
trigerr:
jnp Lret ; // if theta is NAN, return theta
fstp ST(0) ; // dump theta
}
return real.nan;
Lret:
;
}
else version(D_InlineAsm_X86_64)
{
asm
{
fld x[RBP] ; // load theta
fxam ; // test for oddball values
fstsw AX ;
test AH,1 ;
jnz trigerr ; // x is NAN, infinity, or empty
// 387's can handle subnormals
SC18: fptan ;
fstp ST(0) ; // dump X, which is always 1
fstsw AX ;
test AH,4 ;
jz Lret ; // C2 = 1 (x is out of range)
// Do argument reduction to bring x into range
fldpi ;
fxch ;
SC17: fprem1 ;
fstsw AX ;
test AH,4 ;
jnz SC17 ;
fstp ST(1) ; // remove pi from stack
jmp SC18 ;
trigerr:
test AH,4 ;
jz Lret ; // if theta is NAN, return theta
fstp ST(0) ; // dump theta
}
return real.nan;
Lret:
;
} else {
return core.stdc.math.tanl(x);
}
}
unittest
{
static real vals[][2] = // angle,tan
[
[ 0, 0],
[ .5, .5463024898],
[ 1, 1.557407725],
[ 1.5, 14.10141995],
[ 2, -2.185039863],
[ 2.5,-.7470222972],
[ 3, -.1425465431],
[ 3.5, .3745856402],
[ 4, 1.157821282],
[ 4.5, 4.637332055],
[ 5, -3.380515006],
[ 5.5,-.9955840522],
[ 6, -.2910061914],
[ 6.5, .2202772003],
[ 10, .6483608275],
// special angles
[ PI_4, 1],
//[ PI_2, real.infinity], // PI_2 is not _exactly_ pi/2.
[ 3*PI_4, -1],
[ PI, 0],
[ 5*PI_4, 1],
//[ 3*PI_2, -real.infinity],
[ 7*PI_4, -1],
[ 2*PI, 0],
];
int i;
for (i = 0; i < vals.length; i++)
{
real x = vals[i][0];
real r = vals[i][1];
real t = tan(x);
//printf("tan(%Lg) = %Lg, should be %Lg\n", x, t, r);
if (!isIdentical(r, t)) assert(fabs(r-t) <= .0000001);
x = -x;
r = -r;
t = tan(x);
//printf("tan(%Lg) = %Lg, should be %Lg\n", x, t, r);
if (!isIdentical(r, t) && !(r!<>=0 && t!<>=0)) assert(fabs(r-t) <= .0000001);
}
// overflow
assert(isNaN(tan(real.infinity)));
assert(isNaN(tan(-real.infinity)));
// NaN propagation
assert(isIdentical( tan(NaN(0x0123L)), NaN(0x0123L) ));
}
/***************
* Calculates the arc cosine of x,
* returning a value ranging from 0 to $(PI).
*
* $(TABLE_SV
* $(TR $(TH x) $(TH acos(x)) $(TH invalid?))
* $(TR $(TD $(GT)1.0) $(TD $(NAN)) $(TD yes))
* $(TR $(TD $(LT)-1.0) $(TD $(NAN)) $(TD yes))
* $(TR $(TD $(NAN)) $(TD $(NAN)) $(TD yes))
* )
*/
real acos(real x) @safe pure nothrow
{
return atan2(sqrt(1-x*x), x);
}
/// ditto
double acos(double x) @safe pure nothrow { return acos(cast(real)x); }
/// ditto
float acos(float x) @safe pure nothrow { return acos(cast(real)x); }
/***************
* Calculates the arc sine of x,
* returning a value ranging from -$(PI)/2 to $(PI)/2.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH asin(x)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no))
* $(TR $(TD $(GT)1.0) $(TD $(NAN)) $(TD yes))
* $(TR $(TD $(LT)-1.0) $(TD $(NAN)) $(TD yes))
* )
*/
real asin(real x) @safe pure nothrow
{
return atan2(x, sqrt(1-x*x));
}
/// ditto
double asin(double x) @safe pure nothrow { return asin(cast(real)x); }
/// ditto
float asin(float x) @safe pure nothrow { return asin(cast(real)x); }
/***************
* Calculates the arc tangent of x,
* returning a value ranging from -$(PI)/2 to $(PI)/2.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH atan(x)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no))
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(NAN)) $(TD yes))
* )
*/
real atan(real x) @safe pure nothrow { return atan2(x, 1.0L); }
/// ditto
double atan(double x) @safe pure nothrow { return atan(cast(real)x); }
/// ditto
float atan(float x) @safe pure nothrow { return atan(cast(real)x); }
/***************
* Calculates the arc tangent of y / x,
* returning a value ranging from -$(PI) to $(PI).
*
* $(TABLE_SV
* $(TR $(TH y) $(TH x) $(TH atan(y, x)))
* $(TR $(TD $(NAN)) $(TD anything) $(TD $(NAN)) )
* $(TR $(TD anything) $(TD $(NAN)) $(TD $(NAN)) )
* $(TR $(TD $(PLUSMN)0.0) $(TD $(GT)0.0) $(TD $(PLUSMN)0.0) )
* $(TR $(TD $(PLUSMN)0.0) $(TD +0.0) $(TD $(PLUSMN)0.0) )
* $(TR $(TD $(PLUSMN)0.0) $(TD $(LT)0.0) $(TD $(PLUSMN)$(PI)))
* $(TR $(TD $(PLUSMN)0.0) $(TD -0.0) $(TD $(PLUSMN)$(PI)))
* $(TR $(TD $(GT)0.0) $(TD $(PLUSMN)0.0) $(TD $(PI)/2) )
* $(TR $(TD $(LT)0.0) $(TD $(PLUSMN)0.0) $(TD -$(PI)/2) )
* $(TR $(TD $(GT)0.0) $(TD $(INFIN)) $(TD $(PLUSMN)0.0) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD anything) $(TD $(PLUSMN)$(PI)/2))
* $(TR $(TD $(GT)0.0) $(TD -$(INFIN)) $(TD $(PLUSMN)$(PI)) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(INFIN)) $(TD $(PLUSMN)$(PI)/4))
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD -$(INFIN)) $(TD $(PLUSMN)3$(PI)/4))
* )
*/
real atan2(real y, real x) @trusted pure nothrow
{
version(InlineAsm_X86_Any)
{
asm {
fld y;
fld x;
fpatan;
}
}
else
{
return core.stdc.math.atan2l(y,x);
}
}
/// ditto
double atan2(double y, double x) @safe pure nothrow
{
return atan2(cast(real)y, cast(real)x);
}
/// ditto
float atan2(float y, float x) @safe pure nothrow
{
return atan2(cast(real)y, cast(real)x);
}
/***********************************
* Calculates the hyperbolic cosine of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH cosh(x)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(PLUSMN)0.0) $(TD no) )
* )
*/
real cosh(real x) @safe pure nothrow
{
// cosh = (exp(x)+exp(-x))/2.
// The naive implementation works correctly.
real y = exp(x);
return (y + 1.0/y) * 0.5;
}
/// ditto
double cosh(double x) @safe pure nothrow { return cosh(cast(real)x); }
/// ditto
float cosh(float x) @safe pure nothrow { return cosh(cast(real)x); }
/***********************************
* Calculates the hyperbolic sine of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH sinh(x)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no))
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(PLUSMN)$(INFIN)) $(TD no))
* )
*/
real sinh(real x) @safe pure nothrow
{
// sinh(x) = (exp(x)-exp(-x))/2;
// Very large arguments could cause an overflow, but
// the maximum value of x for which exp(x) + exp(-x)) != exp(x)
// is x = 0.5 * (real.mant_dig) * LN2. // = 22.1807 for real80.
if (fabs(x) > real.mant_dig * LN2) {
return copysign(0.5 * exp(fabs(x)), x);
}
real y = expm1(x);
return 0.5 * y / (y+1) * (y+2);
}
/// ditto
double sinh(double x) @safe pure nothrow { return sinh(cast(real)x); }
/// ditto
float sinh(float x) @safe pure nothrow { return sinh(cast(real)x); }
/***********************************
* Calculates the hyperbolic tangent of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH tanh(x)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(PLUSMN)1.0) $(TD no))
* )
*/
real tanh(real x) @safe pure nothrow
{
// tanh(x) = (exp(x) - exp(-x))/(exp(x)+exp(-x))
if (fabs(x) > real.mant_dig * LN2) {
return copysign(1, x);
}
real y = expm1(2*x);
return y / (y + 2);
}
/// ditto
double tanh(double x) @safe pure nothrow { return tanh(cast(real)x); }
/// ditto
float tanh(float x) @safe pure nothrow { return tanh(cast(real)x); }
package:
/* Returns cosh(x) + I * sinh(x)
* Only one call to exp() is performed.
*/
creal coshisinh(real x) @safe pure nothrow
{
// See comments for cosh, sinh.
if (fabs(x) > real.mant_dig * LN2) {
real y = exp(fabs(x));
return y * 0.5 + 0.5i * copysign(y, x);
} else {
real y = expm1(x);
return (y + 1.0 + 1.0/(y + 1.0)) * 0.5 + 0.5i * y / (y+1) * (y+2);
}
}
unittest {
creal c = coshisinh(3.0L);
assert(c.re == cosh(3.0L));
assert(c.im == sinh(3.0L));
}
public:
/***********************************
* Calculates the inverse hyperbolic cosine of x.
*
* Mathematically, acosh(x) = log(x + sqrt( x*x - 1))
*
* $(TABLE_DOMRG
* $(DOMAIN 1..$(INFIN))
* $(RANGE 1..log(real.max), $(INFIN)) )
* $(TABLE_SV
* $(SVH x, acosh(x) )
* $(SV $(NAN), $(NAN) )
* $(SV $(LT)1, $(NAN) )
* $(SV 1, 0 )
* $(SV +$(INFIN),+$(INFIN))
* )
*/
real acosh(real x) @safe pure nothrow
{
if (x > 1/real.epsilon)
return LN2 + log(x);
else
return log(x + sqrt(x*x - 1));
}
/// ditto
double acosh(double x) @safe pure nothrow { return acosh(cast(real)x); }
/// ditto
float acosh(float x) @safe pure nothrow { return acosh(cast(real)x); }
unittest
{
assert(isNaN(acosh(0.9)));
assert(isNaN(acosh(real.nan)));
assert(acosh(1.0)==0.0);
assert(acosh(real.infinity) == real.infinity);
}
/***********************************
* Calculates the inverse hyperbolic sine of x.
*
* Mathematically,
* ---------------
* asinh(x) = log( x + sqrt( x*x + 1 )) // if x >= +0
* asinh(x) = -log(-x + sqrt( x*x + 1 )) // if x <= -0
* -------------
*
* $(TABLE_SV
* $(SVH x, asinh(x) )
* $(SV $(NAN), $(NAN) )
* $(SV $(PLUSMN)0, $(PLUSMN)0 )
* $(SV $(PLUSMN)$(INFIN),$(PLUSMN)$(INFIN))
* )
*/
real asinh(real x) @safe pure nothrow
{
return (fabs(x) > 1 / real.epsilon)
// beyond this point, x*x + 1 == x*x
? copysign(LN2 + log(fabs(x)), x)
// sqrt(x*x + 1) == 1 + x * x / ( 1 + sqrt(x*x + 1) )
: copysign(log1p(fabs(x) + x*x / (1 + sqrt(x*x + 1)) ), x);
}
/// ditto
double asinh(double x) @safe pure nothrow { return asinh(cast(real)x); }
/// ditto
float asinh(float x) @safe pure nothrow { return asinh(cast(real)x); }
unittest
{
assert(isIdentical(asinh(0.0), 0.0));
assert(isIdentical(asinh(-0.0), -0.0));
assert(asinh(real.infinity) == real.infinity);
assert(asinh(-real.infinity) == -real.infinity);
assert(isNaN(asinh(real.nan)));
}
/***********************************
* Calculates the inverse hyperbolic tangent of x,
* returning a value from ranging from -1 to 1.
*
* Mathematically, atanh(x) = log( (1+x)/(1-x) ) / 2
*
*
* $(TABLE_DOMRG
* $(DOMAIN -$(INFIN)..$(INFIN))
* $(RANGE -1..1) )
* $(TABLE_SV
* $(SVH x, acosh(x) )
* $(SV $(NAN), $(NAN) )
* $(SV $(PLUSMN)0, $(PLUSMN)0)
* $(SV -$(INFIN), -0)
* )
*/
real atanh(real x) @safe pure nothrow
{
// log( (1+x)/(1-x) ) == log ( 1 + (2*x)/(1-x) )
return 0.5 * log1p( 2 * x / (1 - x) );
}
/// ditto
double atanh(double x) @safe pure nothrow { return atanh(cast(real)x); }
/// ditto
float atanh(float x) @safe pure nothrow { return atanh(cast(real)x); }
unittest
{
assert(isIdentical(atanh(0.0), 0.0));
assert(isIdentical(atanh(-0.0),-0.0));
assert(isNaN(atanh(real.nan)));
assert(isNaN(atanh(-real.infinity)));
}
/*****************************************
* Returns x rounded to a long value using the current rounding mode.
* If the integer value of x is
* greater than long.max, the result is
* indeterminate.
*/
long rndtol(real x) @safe pure nothrow; /* intrinsic */
/*****************************************
* Returns x rounded to a long value using the FE_TONEAREST rounding mode.
* If the integer value of x is
* greater than long.max, the result is
* indeterminate.
*/
extern (C) real rndtonl(real x);
/***************************************
* Compute square root of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH sqrt(x)) $(TH invalid?))
* $(TR $(TD -0.0) $(TD -0.0) $(TD no))
* $(TR $(TD $(LT)0.0) $(TD $(NAN)) $(TD yes))
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) $(TD no))
* )
*/
float sqrt(float x) @safe pure nothrow; /* intrinsic */
double sqrt(double x) @safe pure nothrow; /* intrinsic */ /// ditto
real sqrt(real x) @safe pure nothrow; /* intrinsic */ /// ditto
creal sqrt(creal z) @safe pure nothrow
{
creal c;
real x,y,w,r;
if (z == 0)
{
c = 0 + 0i;
}
else
{
real z_re = z.re;
real z_im = z.im;
x = fabs(z_re);
y = fabs(z_im);
if (x >= y)
{
r = y / x;
w = sqrt(x) * sqrt(0.5 * (1 + sqrt(1 + r * r)));
}
else
{
r = x / y;
w = sqrt(y) * sqrt(0.5 * (r + sqrt(1 + r * r)));
}
if (z_re >= 0)
{
c = w + (z_im / (w + w)) * 1.0i;
}
else
{
if (z_im < 0)
w = -w;
c = z_im / (w + w) + w * 1.0i;
}
}
return c;
}
/**
* Calculates e$(SUP x).
*
* $(TABLE_SV
* $(TR $(TH x) $(TH e$(SUP x)) )
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) )
* $(TR $(TD -$(INFIN)) $(TD +0.0) )
* $(TR $(TD $(NAN)) $(TD $(NAN)) )
* )
*/
real exp(real x) @trusted pure nothrow
{
version(D_InlineAsm_X86)
{
// e^^x = 2^^(LOG2E*x)
// (This is valid because the overflow & underflow limits for exp
// and exp2 are so similar).
return exp2(LOG2E*x);
}
else version(D_InlineAsm_X86_64)
{
// e^^x = 2^^(LOG2E*x)
// (This is valid because the overflow & underflow limits for exp
// and exp2 are so similar).
return exp2(LOG2E*x);
} else {
return core.stdc.math.exp(x);
}
}
/// ditto
double exp(double x) @safe pure nothrow { return exp(cast(real)x); }
/// ditto
float exp(float x) @safe pure nothrow { return exp(cast(real)x); }
/**
* Calculates the value of the natural logarithm base (e)
* raised to the power of x, minus 1.
*
* For very small x, expm1(x) is more accurate
* than exp(x)-1.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH e$(SUP x)-1) )
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) )
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) )
* $(TR $(TD -$(INFIN)) $(TD -1.0) )
* $(TR $(TD $(NAN)) $(TD $(NAN)) )
* )
*/
real expm1(real x) @trusted pure nothrow
{
version(D_InlineAsm_X86) {
enum { PARAMSIZE = (real.sizeof+3)&(0xFFFF_FFFC) } // always a multiple of 4
asm {
/* expm1() for x87 80-bit reals, IEEE754-2008 conformant.
* Author: Don Clugston.
*
* expm1(x) = 2^^(rndint(y))* 2^^(y-rndint(y)) - 1 where y = LN2*x.
* = 2rndy * 2ym1 + 2rndy - 1, where 2rndy = 2^^(rndint(y))
* and 2ym1 = (2^^(y-rndint(y))-1).
* If 2rndy < 0.5*real.epsilon, result is -1.
* Implementation is otherwise the same as for exp2()
*/
naked;
fld real ptr [ESP+4] ; // x
mov AX, [ESP+4+8]; // AX = exponent and sign
sub ESP, 12+8; // Create scratch space on the stack
// [ESP,ESP+2] = scratchint
// [ESP+4..+6, +8..+10, +10] = scratchreal
// set scratchreal mantissa = 1.0
mov dword ptr [ESP+8], 0;
mov dword ptr [ESP+8+4], 0x80000000;
and AX, 0x7FFF; // drop sign bit
cmp AX, 0x401D; // avoid InvalidException in fist
jae L_extreme;
fldl2e;
fmulp ST(1), ST; // y = x*log2(e)
fist dword ptr [ESP]; // scratchint = rndint(y)
fisub dword ptr [ESP]; // y - rndint(y)
// and now set scratchreal exponent
mov EAX, [ESP];
add EAX, 0x3fff;
jle short L_largenegative;
cmp EAX,0x8000;
jge short L_largepositive;
mov [ESP+8+8],AX;
f2xm1; // 2ym1 = 2^^(y-rndint(y)) -1
fld real ptr [ESP+8] ; // 2rndy = 2^^rndint(y)
fmul ST(1), ST; // ST=2rndy, ST(1)=2rndy*2ym1
fld1;
fsubp ST(1), ST; // ST = 2rndy-1, ST(1) = 2rndy * 2ym1 - 1
faddp ST(1), ST; // ST = 2rndy * 2ym1 + 2rndy - 1
add ESP,12+8;
ret PARAMSIZE;
L_extreme: // Extreme exponent. X is very large positive, very
// large negative, infinity, or NaN.
fxam;
fstsw AX;
test AX, 0x0400; // NaN_or_zero, but we already know x!=0
jz L_was_nan; // if x is NaN, returns x
test AX, 0x0200;
jnz L_largenegative;
L_largepositive:
// Set scratchreal = real.max.
// squaring it will create infinity, and set overflow flag.
mov word ptr [ESP+8+8], 0x7FFE;
fstp ST(0);
fld real ptr [ESP+8]; // load scratchreal
fmul ST(0), ST; // square it, to create havoc!
L_was_nan:
add ESP,12+8;
ret PARAMSIZE;
L_largenegative:
fstp ST(0);
fld1;
fchs; // return -1. Underflow flag is not set.
add ESP,12+8;
ret PARAMSIZE;
}
} else version(D_InlineAsm_X86_64) {
asm
{
/* expm1() for x87 80-bit reals, IEEE754-2008 conformant.
* Author: Don Clugston.
*
* expm1(x) = 2^(rndint(y))* 2^(y-rndint(y)) - 1 where y = LN2*x.
* = 2rndy * 2ym1 + 2rndy - 1, where 2rndy = 2^(rndint(y))
* and 2ym1 = (2^(y-rndint(y))-1).
* If 2rndy < 0.5*real.epsilon, result is -1.
* Implementation is otherwise the same as for exp2()
*/
naked;
fld real ptr [RSP+8] ; // x
mov AX, [RSP+8+8]; // AX = exponent and sign
sub RSP, 24; // Create scratch space on the stack
// [RSP,RSP+2] = scratchint
// [RSP+4..+6, +8..+10, +10] = scratchreal
// set scratchreal mantissa = 1.0
mov dword ptr [RSP+8], 0;
mov dword ptr [RSP+8+4], 0x80000000;
and AX, 0x7FFF; // drop sign bit
cmp AX, 0x401D; // avoid InvalidException in fist
jae L_extreme;
fldl2e;
fmul ; // y = x*log2(e)
fist dword ptr [RSP]; // scratchint = rndint(y)
fisub dword ptr [RSP]; // y - rndint(y)
// and now set scratchreal exponent
mov EAX, [RSP];
add EAX, 0x3fff;
jle short L_largenegative;
cmp EAX,0x8000;
jge short L_largepositive;
mov [RSP+8+8],AX;
f2xm1; // 2^(y-rndint(y)) -1
fld real ptr [RSP+8] ; // 2^rndint(y)
fmul ST(1), ST;
fld1;
fsubp ST(1), ST;
fadd;
add RSP,24;
ret;
L_extreme: // Extreme exponent. X is very large positive, very
// large negative, infinity, or NaN.
fxam;
fstsw AX;
test AX, 0x0400; // NaN_or_zero, but we already know x!=0
jz L_was_nan; // if x is NaN, returns x
test AX, 0x0200;
jnz L_largenegative;
L_largepositive:
// Set scratchreal = real.max.
// squaring it will create infinity, and set overflow flag.
mov word ptr [RSP+8+8], 0x7FFE;
fstp ST(0);
fld real ptr [RSP+8]; // load scratchreal
fmul ST(0), ST; // square it, to create havoc!
L_was_nan:
add RSP,24;
ret;
L_largenegative:
fstp ST(0);
fld1;
fchs; // return -1. Underflow flag is not set.
add RSP,24;
ret;
}
} else {
return core.stdc.math.expm1(x);
}
}
/**
* Calculates 2$(SUP x).
*
* $(TABLE_SV
* $(TR $(TH x) $(TH exp2(x)) )
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) )
* $(TR $(TD -$(INFIN)) $(TD +0.0) )
* $(TR $(TD $(NAN)) $(TD $(NAN)) )
* )
*/
real exp2(real x) @trusted pure nothrow
{
version(D_InlineAsm_X86) {
enum { PARAMSIZE = (real.sizeof+3)&(0xFFFF_FFFC) } // always a multiple of 4
asm {
/* exp2() for x87 80-bit reals, IEEE754-2008 conformant.
* Author: Don Clugston.
*
* exp2(x) = 2^^(rndint(x))* 2^^(y-rndint(x))
* The trick for high performance is to avoid the fscale(28cycles on core2),
* frndint(19 cycles), leaving f2xm1(19 cycles) as the only slow instruction.
*
* We can do frndint by using fist. BUT we can't use it for huge numbers,
* because it will set the Invalid Operation flag if overflow or NaN occurs.
* Fortunately, whenever this happens the result would be zero or infinity.
*
* We can perform fscale by directly poking into the exponent. BUT this doesn't
* work for the (very rare) cases where the result is subnormal. So we fall back
* to the slow method in that case.
*/
naked;
fld real ptr [ESP+4] ; // x
mov AX, [ESP+4+8]; // AX = exponent and sign
sub ESP, 12+8; // Create scratch space on the stack
// [ESP,ESP+2] = scratchint
// [ESP+4..+6, +8..+10, +10] = scratchreal
// set scratchreal mantissa = 1.0
mov dword ptr [ESP+8], 0;
mov dword ptr [ESP+8+4], 0x80000000;
and AX, 0x7FFF; // drop sign bit
cmp AX, 0x401D; // avoid InvalidException in fist
jae L_extreme;
fist dword ptr [ESP]; // scratchint = rndint(x)
fisub dword ptr [ESP]; // x - rndint(x)
// and now set scratchreal exponent
mov EAX, [ESP];
add EAX, 0x3fff;
jle short L_subnormal;
cmp EAX,0x8000;
jge short L_overflow;
mov [ESP+8+8],AX;
L_normal:
f2xm1;
fld1;
faddp ST(1), ST; // 2^^(x-rndint(x))
fld real ptr [ESP+8] ; // 2^^rndint(x)
add ESP,12+8;
fmulp ST(1), ST;
ret PARAMSIZE;
L_subnormal:
// Result will be subnormal.
// In this rare case, the simple poking method doesn't work.
// The speed doesn't matter, so use the slow fscale method.
fild dword ptr [ESP]; // scratchint
fld1;
fscale;
fstp real ptr [ESP+8]; // scratchreal = 2^^scratchint
fstp ST(0); // drop scratchint
jmp L_normal;
L_extreme: // Extreme exponent. X is very large positive, very
// large negative, infinity, or NaN.
fxam;
fstsw AX;
test AX, 0x0400; // NaN_or_zero, but we already know x!=0
jz L_was_nan; // if x is NaN, returns x
// set scratchreal = real.min_normal
// squaring it will return 0, setting underflow flag
mov word ptr [ESP+8+8], 1;
test AX, 0x0200;
jnz L_waslargenegative;
L_overflow:
// Set scratchreal = real.max.
// squaring it will create infinity, and set overflow flag.
mov word ptr [ESP+8+8], 0x7FFE;
L_waslargenegative:
fstp ST(0);
fld real ptr [ESP+8]; // load scratchreal
fmul ST(0), ST; // square it, to create havoc!
L_was_nan:
add ESP,12+8;
ret PARAMSIZE;
}
} else version(D_InlineAsm_X86_64) {
asm {
/* exp2() for x87 80-bit reals, IEEE754-2008 conformant.
* Author: Don Clugston.
*
* exp2(x) = 2^(rndint(x))* 2^(y-rndint(x))
* The trick for high performance is to avoid the fscale(28cycles on core2),
* frndint(19 cycles), leaving f2xm1(19 cycles) as the only slow instruction.
*
* We can do frndint by using fist. BUT we can't use it for huge numbers,
* because it will set the Invalid Operation flag is overflow or NaN occurs.
* Fortunately, whenever this happens the result would be zero or infinity.
*
* We can perform fscale by directly poking into the exponent. BUT this doesn't
* work for the (very rare) cases where the result is subnormal. So we fall back
* to the slow method in that case.
*/
naked;
fld real ptr [RSP+8] ; // x
mov AX, [RSP+8+8]; // AX = exponent and sign
sub RSP, 24; // Create scratch space on the stack
// [RSP,RSP+2] = scratchint
// [RSP+4..+6, +8..+10, +10] = scratchreal
// set scratchreal mantissa = 1.0
mov dword ptr [RSP+8], 0;
mov dword ptr [RSP+8+4], 0x80000000;
and AX, 0x7FFF; // drop sign bit
cmp AX, 0x401D; // avoid InvalidException in fist
jae L_extreme;
fist dword ptr [RSP]; // scratchint = rndint(x)
fisub dword ptr [RSP]; // x - rndint(x)
// and now set scratchreal exponent
mov EAX, [RSP];
add EAX, 0x3fff;
jle short L_subnormal;
cmp EAX,0x8000;
jge short L_overflow;
mov [RSP+8+8],AX;
L_normal:
f2xm1;
fld1;
fadd; // 2^(x-rndint(x))
fld real ptr [RSP+8] ; // 2^rndint(x)
add RSP,24;
fmulp ST(1), ST;
ret;
L_subnormal:
// Result will be subnormal.
// In this rare case, the simple poking method doesn't work.
// The speed doesn't matter, so use the slow fscale method.
fild dword ptr [RSP]; // scratchint
fld1;
fscale;
fstp real ptr [RSP+8]; // scratchreal = 2^scratchint
fstp ST(0); // drop scratchint
jmp L_normal;
L_extreme: // Extreme exponent. X is very large positive, very
// large negative, infinity, or NaN.
fxam;
fstsw AX;
test AX, 0x0400; // NaN_or_zero, but we already know x!=0
jz L_was_nan; // if x is NaN, returns x
// set scratchreal = real.min
// squaring it will return 0, setting underflow flag
mov word ptr [RSP+8+8], 1;
test AX, 0x0200;
jnz L_waslargenegative;
L_overflow:
// Set scratchreal = real.max.
// squaring it will create infinity, and set overflow flag.
mov word ptr [RSP+8+8], 0x7FFE;
L_waslargenegative:
fstp ST(0);
fld real ptr [RSP+8]; // load scratchreal
fmul ST(0), ST; // square it, to create havoc!
L_was_nan:
add RSP,24;
ret;
}
} else {
return core.stdc.math.exp2(x);
}
}
unittest{
assert(exp2(0.5L)== SQRT2);
assert(exp2(8.0L) == 256.0);
assert(exp2(-9.0L)== 1.0L/512.0);
assert(exp(3.0L) == E*E*E);
}
unittest
{
FloatingPointControl ctrl;
ctrl.disableExceptions(FloatingPointControl.allExceptions);
ctrl.rounding = FloatingPointControl.roundToNearest;
// @@BUG@@: Non-immutable array literals are ridiculous.
// Note that these are only valid for 80-bit reals: overflow will be different for 64-bit reals.
static const real [2][] exptestpoints =
[ // x, exp(x)
[1.0L, E ],
[0.5L, 0x1.A612_98E1_E069_BC97p+0L ],
[3.0L, E*E*E ],
[0x1.1p13L, 0x1.29aeffefc8ec645p+12557L ], // near overflow
[-0x1.18p13L, 0x1.5e4bf54b4806db9p-12927L ], // near underflow
[-0x1.625p13L, 0x1.a6bd68a39d11f35cp-16358L],
[-0x1p30L, 0 ], // underflow - subnormal
[-0x1.62DAFp13L, 0x1.96c53d30277021dp-16383L ],
[-0x1.643p13L, 0x1p-16444L ],
[-0x1.645p13L, 0 ], // underflow to zero
[0x1p80L, real.infinity ], // far overflow
[real.infinity, real.infinity ],
[0x1.7p13L, real.infinity ] // close overflow
];
real x;
IeeeFlags f;
for (int i=0; i<exptestpoints.length;++i) {
resetIeeeFlags();
x = exp(exptestpoints[i][0]);
f = ieeeFlags;
assert(x == exptestpoints[i][1]);
// Check the overflow bit
assert(f.overflow() == (fabs(x) == real.infinity));
// Check the underflow bit
assert(f.underflow() == (fabs(x) < real.min_normal));
// Invalid and div by zero shouldn't be affected.
assert(!f.invalid);
assert(!f.divByZero);
}
// Ideally, exp(0) would not set the inexact flag.
// Unfortunately, fldl2e sets it!
// So it's not realistic to avoid setting it.
assert(exp(0.0L) == 1.0);
// NaN propagation. Doesn't set flags, bcos was already NaN.
resetIeeeFlags();
x = exp(real.nan);
f = ieeeFlags;
assert(isIdentical(x,real.nan));
assert(f.flags == 0);
resetIeeeFlags();
x = exp(-real.nan);
f = ieeeFlags;
assert(isIdentical(x, -real.nan));
assert(f.flags == 0);
x = exp(NaN(0x123));
assert(isIdentical(x, NaN(0x123)));
// High resolution test
assert(exp(0.5L) == 0x1.A612_98E1_E069_BC97_2DFE_FAB6D_33Fp+0L);
}
/**
* Calculate cos(y) + i sin(y).
*
* On many CPUs (such as x86), this is a very efficient operation;
* almost twice as fast as calculating sin(y) and cos(y) separately,
* and is the preferred method when both are required.
*/
creal expi(real y) @trusted pure nothrow
{
version(InlineAsm_X86_Any)
{
asm
{
fld y;
fsincos;
fxch ST(1), ST(0);
}
}
else
{
return cos(y) + sin(y)*1i;
}
}
unittest
{
assert(expi(1.3e5L) == cos(1.3e5L) + sin(1.3e5L) * 1i);
assert(expi(0.0L) == 1L + 0.0Li);
}
/*********************************************************************
* Separate floating point value into significand and exponent.
*
* Returns:
* Calculate and return $(I x) and $(I exp) such that
* value =$(I x)*2$(SUP exp) and
* .5 $(LT)= |$(I x)| $(LT) 1.0
*
* $(I x) has same sign as value.
*
* $(TABLE_SV
* $(TR $(TH value) $(TH returns) $(TH exp))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD 0))
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) $(TD int.max))
* $(TR $(TD -$(INFIN)) $(TD -$(INFIN)) $(TD int.min))
* $(TR $(TD $(PLUSMN)$(NAN)) $(TD $(PLUSMN)$(NAN)) $(TD int.min))
* )
*/
real frexp(real value, out int exp) @trusted pure nothrow
{
ushort* vu = cast(ushort*)&value;
long* vl = cast(long*)&value;
uint ex;
alias floatTraits!(real) F;
ex = vu[F.EXPPOS_SHORT] & F.EXPMASK;
static if (real.mant_dig == 64) { // real80
if (ex) { // If exponent is non-zero
if (ex == F.EXPMASK) { // infinity or NaN
if (*vl & 0x7FFF_FFFF_FFFF_FFFF) { // NaN
*vl |= 0xC000_0000_0000_0000; // convert NaNS to NaNQ
exp = int.min;
} else if (vu[F.EXPPOS_SHORT] & 0x8000) { // negative infinity
exp = int.min;
} else { // positive infinity
exp = int.max;
}
} else {
exp = ex - F.EXPBIAS;
vu[F.EXPPOS_SHORT] = (0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FFE;
}
} else if (!*vl) {
// value is +-0.0
exp = 0;
} else {
// subnormal
value *= F.RECIP_EPSILON;
ex = vu[F.EXPPOS_SHORT] & F.EXPMASK;
exp = ex - F.EXPBIAS - real.mant_dig + 1;
vu[F.EXPPOS_SHORT] = (0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FFE;
}
} else static if (real.mant_dig == 113) { // quadruple
if (ex) { // If exponent is non-zero
if (ex == F.EXPMASK) { // infinity or NaN
if (vl[MANTISSA_LSB] |
( vl[MANTISSA_MSB] & 0x0000_FFFF_FFFF_FFFF)) { // NaN
// convert NaNS to NaNQ
vl[MANTISSA_MSB] |= 0x0000_8000_0000_0000;
exp = int.min;
} else if (vu[F.EXPPOS_SHORT] & 0x8000) { // negative infinity
exp = int.min;
} else { // positive infinity
exp = int.max;
}
} else {
exp = ex - F.EXPBIAS;
vu[F.EXPPOS_SHORT] =
cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FFE);
}
} else if ((vl[MANTISSA_LSB]
|(vl[MANTISSA_MSB] & 0x0000_FFFF_FFFF_FFFF)) == 0) {
// value is +-0.0
exp = 0;
} else {
// subnormal
value *= F.RECIP_EPSILON;
ex = vu[F.EXPPOS_SHORT] & F.EXPMASK;
exp = ex - F.EXPBIAS - real.mant_dig + 1;
vu[F.EXPPOS_SHORT] =
cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FFE);
}
} else static if (real.mant_dig==53) { // real is double
if (ex) { // If exponent is non-zero
if (ex == F.EXPMASK) { // infinity or NaN
if (*vl == 0x7FF0_0000_0000_0000) { // positive infinity
exp = int.max;
} else if (*vl == 0xFFF0_0000_0000_0000) { // negative infinity
exp = int.min;
} else { // NaN
*vl |= 0x0008_0000_0000_0000; // convert NaNS to NaNQ
exp = int.min;
}
} else {
exp = (ex - F.EXPBIAS) >> 4;
vu[F.EXPPOS_SHORT] = cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FE0);
}
} else if (!(*vl & 0x7FFF_FFFF_FFFF_FFFF)) {
// value is +-0.0
exp = 0;
} else {
// subnormal
value *= F.RECIP_EPSILON;
ex = vu[F.EXPPOS_SHORT] & F.EXPMASK;
exp = ((ex - F.EXPBIAS)>> 4) - real.mant_dig + 1;
vu[F.EXPPOS_SHORT] =
cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FE0);
}
} else { //static if(real.mant_dig==106) // doubledouble
assert (0, "frexp not implemented");
}
return value;
}
unittest
{
static real vals[][3] = // x,frexp,exp
[
[0.0, 0.0, 0],
[-0.0, -0.0, 0],
[1.0, .5, 1],
[-1.0, -.5, 1],
[2.0, .5, 2],
[double.min_normal/2.0, .5, -1022],
[real.infinity,real.infinity,int.max],
[-real.infinity,-real.infinity,int.min],
[real.nan,real.nan,int.min],
[-real.nan,-real.nan,int.min],
];
int i;
for (i = 0; i < vals.length; i++) {
real x = vals[i][0];
real e = vals[i][1];
int exp = cast(int)vals[i][2];
int eptr;
real v = frexp(x, eptr);
assert(isIdentical(e, v));
assert(exp == eptr);
}
static if (real.mant_dig == 64) {
static real extendedvals[][3] = [ // x,frexp,exp
[0x1.a5f1c2eb3fe4efp+73L, 0x1.A5F1C2EB3FE4EFp-1L, 74], // normal
[0x1.fa01712e8f0471ap-1064L, 0x1.fa01712e8f0471ap-1L, -1063],
[real.min_normal, .5, -16381],
[real.min_normal/2.0L, .5, -16382] // subnormal
];
for (i = 0; i < extendedvals.length; i++) {
real x = extendedvals[i][0];
real e = extendedvals[i][1];
int exp = cast(int)extendedvals[i][2];
int eptr;
real v = frexp(x, eptr);
assert(isIdentical(e, v));
assert(exp == eptr);
}
}
}
/******************************************
* Extracts the exponent of x as a signed integral value.
*
* If x is not a special value, the result is the same as
* $(D cast(int)logb(x)).
*
* $(TABLE_SV
* $(TR $(TH x) $(TH ilogb(x)) $(TH Range error?))
* $(TR $(TD 0) $(TD FP_ILOGB0) $(TD yes))
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD int.max) $(TD no))
* $(TR $(TD $(NAN)) $(TD FP_ILOGBNAN) $(TD no))
* )
*/
int ilogb(real x) @trusted nothrow { return core.stdc.math.ilogbl(x); }
alias core.stdc.math.FP_ILOGB0 FP_ILOGB0;
alias core.stdc.math.FP_ILOGBNAN FP_ILOGBNAN;
/*******************************************
* Compute n * 2$(SUP exp)
* References: frexp
*/
real ldexp(real n, int exp) @safe pure nothrow; /* intrinsic */
unittest {
assert(ldexp(1, -16384) == 0x1p-16384L);
assert(ldexp(1, -16382) == 0x1p-16382L);
int x;
real n = frexp(0x1p-16384L, x);
assert(n==0.5L);
assert(x==-16383);
assert(ldexp(n, x)==0x1p-16384L);
}
/**************************************
* Calculate the natural logarithm of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH log(x)) $(TH divide by 0?) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD -$(INFIN)) $(TD yes) $(TD no))
* $(TR $(TD $(LT)0.0) $(TD $(NAN)) $(TD no) $(TD yes))
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) $(TD no) $(TD no))
* )
*/
real log(real x) @safe pure nothrow
{
version (INLINE_YL2X)
return yl2x(x, LN2);
else
return core.stdc.math.logl(x);
}
unittest
{
assert(log(E) == 1);
}
/**************************************
* Calculate the base-10 logarithm of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH log10(x)) $(TH divide by 0?) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD -$(INFIN)) $(TD yes) $(TD no))
* $(TR $(TD $(LT)0.0) $(TD $(NAN)) $(TD no) $(TD yes))
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) $(TD no) $(TD no))
* )
*/
real log10(real x) @safe pure nothrow
{
version (INLINE_YL2X)
return yl2x(x, LOG2);
else
return core.stdc.math.log10l(x);
}
unittest
{
//printf("%Lg\n", log10(1000) - 3);
assert(fabs(log10(1000) - 3) < .000001);
}
/******************************************
* Calculates the natural logarithm of 1 + x.
*
* For very small x, log1p(x) will be more accurate than
* log(1 + x).
*
* $(TABLE_SV
* $(TR $(TH x) $(TH log1p(x)) $(TH divide by 0?) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no) $(TD no))
* $(TR $(TD -1.0) $(TD -$(INFIN)) $(TD yes) $(TD no))
* $(TR $(TD $(LT)-1.0) $(TD $(NAN)) $(TD no) $(TD yes))
* $(TR $(TD +$(INFIN)) $(TD -$(INFIN)) $(TD no) $(TD no))
* )
*/
real log1p(real x) @safe pure nothrow
{
version(INLINE_YL2X)
{
// On x87, yl2xp1 is valid if and only if -0.5 <= lg(x) <= 0.5,
// ie if -0.29<=x<=0.414
return (fabs(x) <= 0.25) ? yl2xp1(x, LN2) : yl2x(x+1, LN2);
}
else
{
return core.stdc.math.log1pl(x);
}
}
/***************************************
* Calculates the base-2 logarithm of x:
* $(SUB log, 2)x
*
* $(TABLE_SV
* $(TR $(TH x) $(TH log2(x)) $(TH divide by 0?) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD -$(INFIN)) $(TD yes) $(TD no) )
* $(TR $(TD $(LT)0.0) $(TD $(NAN)) $(TD no) $(TD yes) )
* $(TR $(TD +$(INFIN)) $(TD +$(INFIN)) $(TD no) $(TD no) )
* )
*/
real log2(real x) @safe pure nothrow
{
version (INLINE_YL2X)
return yl2x(x, 1);
else
return core.stdc.math.log2l(x);
}
/*****************************************
* Extracts the exponent of x as a signed integral value.
*
* If x is subnormal, it is treated as if it were normalized.
* For a positive, finite x:
*
* 1 $(LT)= $(I x) * FLT_RADIX$(SUP -logb(x)) $(LT) FLT_RADIX
*
* $(TABLE_SV
* $(TR $(TH x) $(TH logb(x)) $(TH divide by 0?) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD +$(INFIN)) $(TD no))
* $(TR $(TD $(PLUSMN)0.0) $(TD -$(INFIN)) $(TD yes) )
* )
*/
real logb(real x) @trusted nothrow { return core.stdc.math.logbl(x); }
/************************************
* Calculates the remainder from the calculation x/y.
* Returns:
* The value of x - i * y, where i is the number of times that y can
* be completely subtracted from x. The result has the same sign as x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH y) $(TH fmod(x, y)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD not 0.0) $(TD $(PLUSMN)0.0) $(TD no))
* $(TR $(TD $(PLUSMNINF)) $(TD anything) $(TD $(NAN)) $(TD yes))
* $(TR $(TD anything) $(TD $(PLUSMN)0.0) $(TD $(NAN)) $(TD yes))
* $(TR $(TD !=$(PLUSMNINF)) $(TD $(PLUSMNINF)) $(TD x) $(TD no))
* )
*/
real fmod(real x, real y) @trusted nothrow { return core.stdc.math.fmodl(x, y); }
/************************************
* Breaks x into an integral part and a fractional part, each of which has
* the same sign as x. The integral part is stored in i.
* Returns:
* The fractional part of x.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH i (on input)) $(TH modf(x, i)) $(TH i (on return)))
* $(TR $(TD $(PLUSMNINF)) $(TD anything) $(TD $(PLUSMN)0.0) $(TD $(PLUSMNINF)))
* )
*/
real modf(real x, ref real i) @trusted nothrow { return core.stdc.math.modfl(x,&i); }
/*************************************
* Efficiently calculates x * 2$(SUP n).
*
* scalbn handles underflow and overflow in
* the same fashion as the basic arithmetic operators.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH scalb(x)))
* $(TR $(TD $(PLUSMNINF)) $(TD $(PLUSMNINF)) )
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) )
* )
*/
real scalbn(real x, int n) @trusted nothrow
{
version(InlineAsm_X86_Any) {
// scalbnl is not supported on DMD-Windows, so use asm.
asm {
fild n;
fld x;
fscale;
fstp ST(1);
}
} else {
return core.stdc.math.scalbnl(x, n);
}
}
unittest {
assert(scalbn(-real.infinity, 5) == -real.infinity);
}
/***************
* Calculates the cube root of x.
*
* $(TABLE_SV
* $(TR $(TH $(I x)) $(TH cbrt(x)) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD $(PLUSMN)0.0) $(TD no) )
* $(TR $(TD $(NAN)) $(TD $(NAN)) $(TD yes) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(PLUSMN)$(INFIN)) $(TD no) )
* )
*/
real cbrt(real x) @trusted nothrow { return core.stdc.math.cbrtl(x); }
/*******************************
* Returns |x|
*
* $(TABLE_SV
* $(TR $(TH x) $(TH fabs(x)))
* $(TR $(TD $(PLUSMN)0.0) $(TD +0.0) )
* $(TR $(TD $(PLUSMN)$(INFIN)) $(TD +$(INFIN)) )
* )
*/
real fabs(real x) @safe pure nothrow; /* intrinsic */
/***********************************************************************
* Calculates the length of the
* hypotenuse of a right-angled triangle with sides of length x and y.
* The hypotenuse is the value of the square root of
* the sums of the squares of x and y:
*
* sqrt($(POWER x, 2) + $(POWER y, 2))
*
* Note that hypot(x, y), hypot(y, x) and
* hypot(x, -y) are equivalent.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH y) $(TH hypot(x, y)) $(TH invalid?))
* $(TR $(TD x) $(TD $(PLUSMN)0.0) $(TD |x|) $(TD no))
* $(TR $(TD $(PLUSMNINF)) $(TD y) $(TD +$(INFIN)) $(TD no))
* $(TR $(TD $(PLUSMNINF)) $(TD $(NAN)) $(TD +$(INFIN)) $(TD no))
* )
*/
real hypot(real x, real y) @safe pure nothrow
{
// Scale x and y to avoid underflow and overflow.
// If one is huge and the other tiny, return the larger.
// If both are huge, avoid overflow by scaling by 1/sqrt(real.max/2).
// If both are tiny, avoid underflow by scaling by sqrt(real.min_normal*real.epsilon).
enum real SQRTMIN = 0.5*sqrt(real.min_normal); // This is a power of 2.
enum real SQRTMAX = 1.0L/SQRTMIN; // 2^^((max_exp)/2) = nextUp(sqrt(real.max))
static assert(2*(SQRTMAX/2)*(SQRTMAX/2) <= real.max);
static assert(real.min_normal*real.max>2 && real.min_normal*real.max<=4); // Proves that sqrt(real.max) ~~ 0.5/sqrt(real.min_normal)
real u = fabs(x);
real v = fabs(y);
if (u !>= v) // check for NaN as well.
{
v = u;
u = fabs(y);
if (u == real.infinity) return u; // hypot(inf, nan) == inf
if (v == real.infinity) return v; // hypot(nan, inf) == inf
}
// Now u >= v, or else one is NaN.
if (v >= SQRTMAX*0.5)
{
// hypot(huge, huge) -- avoid overflow
u *= SQRTMIN*0.5;
v *= SQRTMIN*0.5;
return sqrt(u*u + v*v) * SQRTMAX * 2.0;
}
if (u <= SQRTMIN)
{
// hypot (tiny, tiny) -- avoid underflow
// This is only necessary to avoid setting the underflow
// flag.
u *= SQRTMAX / real.epsilon;
v *= SQRTMAX / real.epsilon;
return sqrt(u*u + v*v) * SQRTMIN * real.epsilon;
}
if (u * real.epsilon > v)
{
// hypot (huge, tiny) = huge
return u;
}
// both are in the normal range
return sqrt(u*u + v*v);
}
unittest
{
static real vals[][3] = // x,y,hypot
[
[ 0.0, 0.0, 0.0],
[ 0.0, -0.0, 0.0],
[ -0.0, -0.0, 0.0],
[ 3.0, 4.0, 5.0],
[ -300, -400, 500],
[0.0, 7.0, 7.0],
[9.0, 9*real.epsilon, 9.0],
[88/(64*sqrt(real.min_normal)), 105/(64*sqrt(real.min_normal)), 137/(64*sqrt(real.min_normal))],
[88/(128*sqrt(real.min_normal)), 105/(128*sqrt(real.min_normal)), 137/(128*sqrt(real.min_normal))],
[3*real.min_normal*real.epsilon, 4*real.min_normal*real.epsilon, 5*real.min_normal*real.epsilon],
[ real.min_normal, real.min_normal, sqrt(2.0L)*real.min_normal],
[ real.max/sqrt(2.0L), real.max/sqrt(2.0L), real.max],
[ real.infinity, real.nan, real.infinity],
[ real.nan, real.infinity, real.infinity],
[ real.nan, real.nan, real.nan],
[ real.nan, real.max, real.nan],
[ real.max, real.nan, real.nan],
];
for (int i = 0; i < vals.length; i++)
{
real x = vals[i][0];
real y = vals[i][1];
real z = vals[i][2];
real h = hypot(x, y);
assert(isIdentical(z, h));
}
}
/**************************************
* Returns the value of x rounded upward to the next integer
* (toward positive infinity).
*/
real ceil(real x) @trusted nothrow { return core.stdc.math.ceill(x); }
/**************************************
* Returns the value of x rounded downward to the next integer
* (toward negative infinity).
*/
real floor(real x) @trusted nothrow { return core.stdc.math.floorl(x); }
/******************************************
* Rounds x to the nearest integer value, using the current rounding
* mode.
*
* Unlike the rint functions, nearbyint does not raise the
* FE_INEXACT exception.
*/
real nearbyint(real x) @trusted nothrow { return core.stdc.math.nearbyintl(x); }
/**********************************
* Rounds x to the nearest integer value, using the current rounding
* mode.
* If the return value is not equal to x, the FE_INEXACT
* exception is raised.
* $(B nearbyint) performs
* the same operation, but does not set the FE_INEXACT exception.
*/
real rint(real x) @safe pure nothrow; /* intrinsic */
/***************************************
* Rounds x to the nearest integer value, using the current rounding
* mode.
*
* This is generally the fastest method to convert a floating-point number
* to an integer. Note that the results from this function
* depend on the rounding mode, if the fractional part of x is exactly 0.5.
* If using the default rounding mode (ties round to even integers)
* lrint(4.5) == 4, lrint(5.5)==6.
*/
long lrint(real x) @trusted pure nothrow
{
version(InlineAsm_X86_Any)
{
long n;
asm
{
fld x;
fistp n;
}
return n;
} else {
return core.stdc.math.llrintl(x);
}
}
/*******************************************
* Return the value of x rounded to the nearest integer.
* If the fractional part of x is exactly 0.5, the return value is rounded to
* the even integer.
*/
real round(real x) @trusted nothrow { return core.stdc.math.roundl(x); }
/**********************************************
* Return the value of x rounded to the nearest integer.
*
* If the fractional part of x is exactly 0.5, the return value is rounded
* away from zero.
*/
long lround(real x) @trusted nothrow
{
version (Posix)
return core.stdc.math.llroundl(x);
else
assert (0, "lround not implemented");
}
version(Posix)
{
unittest
{
assert(lround(0.49) == 0);
assert(lround(0.5) == 1);
assert(lround(1.5) == 2);
}
}
/****************************************************
* Returns the integer portion of x, dropping the fractional portion.
*
* This is also known as "chop" rounding.
*/
real trunc(real x) @trusted nothrow { return core.stdc.math.truncl(x); }
/****************************************************
* Calculate the remainder x REM y, following IEC 60559.
*
* REM is the value of x - y * n, where n is the integer nearest the exact
* value of x / y.
* If |n - x / y| == 0.5, n is even.
* If the result is zero, it has the same sign as x.
* Otherwise, the sign of the result is the sign of x / y.
* Precision mode has no effect on the remainder functions.
*
* remquo returns n in the parameter n.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH y) $(TH remainder(x, y)) $(TH n) $(TH invalid?))
* $(TR $(TD $(PLUSMN)0.0) $(TD not 0.0) $(TD $(PLUSMN)0.0) $(TD 0.0) $(TD no))
* $(TR $(TD $(PLUSMNINF)) $(TD anything) $(TD $(NAN)) $(TD ?) $(TD yes))
* $(TR $(TD anything) $(TD $(PLUSMN)0.0) $(TD $(NAN)) $(TD ?) $(TD yes))
* $(TR $(TD != $(PLUSMNINF)) $(TD $(PLUSMNINF)) $(TD x) $(TD ?) $(TD no))
* )
*
* Note: remquo not supported on windows
*/
real remainder(real x, real y) @trusted nothrow { return core.stdc.math.remainderl(x, y); }
real remquo(real x, real y, out int n) @trusted nothrow /// ditto
{
version (Posix)
return core.stdc.math.remquol(x, y, &n);
else
assert (0, "remquo not implemented");
}
/** IEEE exception status flags ('sticky bits')
These flags indicate that an exceptional floating-point condition has occurred.
They indicate that a NaN or an infinity has been generated, that a result
is inexact, or that a signalling NaN has been encountered. If floating-point
exceptions are enabled (unmasked), a hardware exception will be generated
instead of setting these flags.
Example:
----
real a=3.5;
// Set all the flags to zero
resetIeeeFlags();
assert(!ieeeFlags.divByZero);
// Perform a division by zero.
a/=0.0L;
assert(a==real.infinity);
assert(ieeeFlags.divByZero);
// Create a NaN
a*=0.0L;
assert(ieeeFlags.invalid);
assert(isNaN(a));
// Check that calling func() has no effect on the
// status flags.
IeeeFlags f = ieeeFlags;
func();
assert(ieeeFlags == f);
----
*/
struct IeeeFlags
{
private:
// The x87 FPU status register is 16 bits.
// The Pentium SSE2 status register is 32 bits.
uint flags;
version (X86_Any) {
// Applies to both x87 status word (16 bits) and SSE2 status word(32 bits).
enum : int {
INEXACT_MASK = 0x20,
UNDERFLOW_MASK = 0x10,
OVERFLOW_MASK = 0x08,
DIVBYZERO_MASK = 0x04,
INVALID_MASK = 0x01
}
// Don't bother about subnormals, they are not supported on most CPUs.
// SUBNORMAL_MASK = 0x02;
} else version (PPC) {
// PowerPC FPSCR is a 32-bit register.
enum : int {
INEXACT_MASK = 0x600,
UNDERFLOW_MASK = 0x010,
OVERFLOW_MASK = 0x008,
DIVBYZERO_MASK = 0x020,
INVALID_MASK = 0xF80 // PowerPC has five types of invalid exceptions.
}
} else version (ARM) {
// TODO: Fill this in for VFP.
} else version(SPARC) { // SPARC FSR is a 32bit register
//(64 bits for Sparc 7 & 8, but high 32 bits are uninteresting).
enum : int {
INEXACT_MASK = 0x020,
UNDERFLOW_MASK = 0x080,
OVERFLOW_MASK = 0x100,
DIVBYZERO_MASK = 0x040,
INVALID_MASK = 0x200
}
} else
static assert(0, "Not implemented");
private:
static uint getIeeeFlags()
{
version(D_InlineAsm_X86) {
asm {
fstsw AX;
// NOTE: If compiler supports SSE2, need to OR the result with
// the SSE2 status register.
// Clear all irrelevant bits
and EAX, 0x03D;
}
} else version(D_InlineAsm_X86_64) {
asm {
fstsw AX;
// NOTE: If compiler supports SSE2, need to OR the result with
// the SSE2 status register.
// Clear all irrelevant bits
and RAX, 0x03D;
}
} else version (SPARC) {
/*
int retval;
asm { st %fsr, retval; }
return retval;
*/
assert(0, "Not yet supported");
} else version (ARM) {
assert(false, "Not yet supported.");
} else
assert(0, "Not yet supported");
}
static void resetIeeeFlags()
{
version(InlineAsm_X86_Any) {
asm {
fnclex;
}
} else {
/* SPARC:
int tmpval;
asm { st %fsr, tmpval; }
tmpval &=0xFFFF_FC00;
asm { ld tmpval, %fsr; }
*/
assert(0, "Not yet supported");
}
}
public:
version (X86_Any) { // TODO: Lift this version condition when we support !x86.
/// The result cannot be represented exactly, so rounding occured.
/// (example: x = sin(0.1); )
@property bool inexact() { return (flags & INEXACT_MASK) != 0; }
/// A zero was generated by underflow (example: x = real.min*real.epsilon/2;)
@property bool underflow() { return (flags & UNDERFLOW_MASK) != 0; }
/// An infinity was generated by overflow (example: x = real.max*2;)
@property bool overflow() { return (flags & OVERFLOW_MASK) != 0; }
/// An infinity was generated by division by zero (example: x = 3/0.0; )
@property bool divByZero() { return (flags & DIVBYZERO_MASK) != 0; }
/// A machine NaN was generated. (example: x = real.infinity * 0.0; )
@property bool invalid() { return (flags & INVALID_MASK) != 0; }
}
}
/// Set all of the floating-point status flags to false.
void resetIeeeFlags() { IeeeFlags.resetIeeeFlags(); }
/// Return a snapshot of the current state of the floating-point status flags.
@property IeeeFlags ieeeFlags()
{
return IeeeFlags(IeeeFlags.getIeeeFlags());
}
/** Control the Floating point hardware
Change the IEEE754 floating-point rounding mode and the floating-point
hardware exceptions.
By default, the rounding mode is roundToNearest and all hardware exceptions
are disabled. For most applications, debugging is easier if the $(I division
by zero), $(I overflow), and $(I invalid operation) exceptions are enabled.
These three are combined into a $(I severeExceptions) value for convenience.
Note in particular that if $(I invalidException) is enabled, a hardware trap
will be generated whenever an uninitialized floating-point variable is used.
All changes are temporary. The previous state is restored at the
end of the scope.
Example:
----
{
// Enable hardware exceptions for division by zero, overflow to infinity,
// invalid operations, and uninitialized floating-point variables.
FloatingPointControl fpctrl;
fpctrl.enableExceptions(FloatingPointControl.severeExceptions);
double y = x*3.0; // will generate a hardware exception, if x is uninitialized.
//
fpctrl.rounding = FloatingPointControl.roundUp;
// The hardware exceptions will be disabled when leaving this scope.
// The original rounding mode will also be restored.
}
----
*/
struct FloatingPointControl
{
alias uint RoundingMode;
/** IEEE rounding modes.
* The default mode is roundToNearest.
*/
enum : RoundingMode
{
roundToNearest = 0x0000,
roundDown = 0x0400,
roundUp = 0x0800,
roundToZero = 0x0C00
};
/** IEEE hardware exceptions.
* By default, all exceptions are masked (disabled).
*/
enum : uint
{
inexactException = 0x20,
underflowException = 0x10,
overflowException = 0x08,
divByZeroException = 0x04,
subnormalException = 0x02,
invalidException = 0x01,
/// Severe = The overflow, division by zero, and invalid exceptions.
severeExceptions = overflowException | divByZeroException
| invalidException,
allExceptions = severeExceptions | underflowException
| inexactException | subnormalException,
};
private:
enum ushort EXCEPTION_MASK = 0x3F;
enum ushort ROUNDING_MASK = 0xC00;
public:
/// Enable (unmask) specific hardware exceptions. Multiple exceptions may be ORed together.
void enableExceptions(uint exceptions)
{
initialize();
setControlState(getControlState() & ~(exceptions & EXCEPTION_MASK));
}
/// Disable (mask) specific hardware exceptions. Multiple exceptions may be ORed together.
void disableExceptions(uint exceptions)
{
initialize();
setControlState(getControlState() | (exceptions & EXCEPTION_MASK));
}
//// Change the floating-point hardware rounding mode
@property void rounding(RoundingMode newMode)
{
ushort old = getControlState();
setControlState((old & ~ROUNDING_MASK) | (newMode & ROUNDING_MASK));
}
/// Return the exceptions which are currently enabled (unmasked)
@property static uint enabledExceptions()
{
return (getControlState() & EXCEPTION_MASK) ^ EXCEPTION_MASK;
}
/// Return the currently active rounding mode
@property static RoundingMode rounding()
{
return cast(RoundingMode)(getControlState() & ROUNDING_MASK);
}
/// Clear all pending exceptions, then restore the original exception state and rounding mode.
~this()
{
clearExceptions();
setControlState(savedState);
}
private:
ushort savedState;
bool initialized=false;
void initialize()
{
// BUG: This works around the absence of this() constructors.
if (initialized) return;
clearExceptions();
savedState = getControlState();
initialized=true;
}
// Clear all pending exceptions
static void clearExceptions()
{
version (InlineAsm_X86_Any)
{
asm
{
fclex;
}
}
else
assert(0, "Not yet supported");
}
// Read from the control register
static ushort getControlState()
{
version (D_InlineAsm_X86)
{
short cont;
asm
{
xor EAX, EAX;
fstcw cont;
}
return cont;
}
else
version (D_InlineAsm_X86_64)
{
short cont;
asm
{
xor RAX, RAX;
fstcw cont;
}
return cont;
}
else
assert(0, "Not yet supported");
}
// Set the control register
static void setControlState(ushort newState)
{
version (InlineAsm_X86_Any)
{
asm
{
fclex;
fldcw newState;
}
}
else
assert(0, "Not yet supported");
}
}
unittest
{
{
FloatingPointControl ctrl;
ctrl.enableExceptions(FloatingPointControl.divByZeroException
| FloatingPointControl.overflowException);
assert(ctrl.enabledExceptions() ==
(FloatingPointControl.divByZeroException
| FloatingPointControl.overflowException));
ctrl.rounding = FloatingPointControl.roundUp;
assert(FloatingPointControl.rounding == FloatingPointControl.roundUp);
}
assert(FloatingPointControl.rounding
== FloatingPointControl.roundToNearest);
assert(FloatingPointControl.enabledExceptions() ==0);
}
/*********************************
* Returns !=0 if e is a NaN.
*/
bool isNaN(real x) @trusted pure nothrow
{
alias floatTraits!(real) F;
static if (real.mant_dig==53) { // double
ulong* p = cast(ulong *)&x;
return ((*p & 0x7FF0_0000_0000_0000) == 0x7FF0_0000_0000_0000)
&& *p & 0x000F_FFFF_FFFF_FFFF;
} else static if (real.mant_dig==64) { // real80
ushort e = F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT];
ulong* ps = cast(ulong *)&x;
return e == F.EXPMASK &&
*ps & 0x7FFF_FFFF_FFFF_FFFF; // not infinity
} else static if (real.mant_dig==113) { // quadruple
ushort e = F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT];
ulong* ps = cast(ulong *)&x;
return e == F.EXPMASK &&
(ps[MANTISSA_LSB] | (ps[MANTISSA_MSB]& 0x0000_FFFF_FFFF_FFFF))!=0;
} else {
return x!=x;
}
}
unittest
{
assert(isNaN(float.nan));
assert(isNaN(-double.nan));
assert(isNaN(real.nan));
assert(!isNaN(53.6));
assert(!isNaN(float.infinity));
}
/*********************************
* Returns !=0 if e is finite (not infinite or $(NAN)).
*/
int isFinite(real e) @trusted pure nothrow
{
alias floatTraits!(real) F;
ushort* pe = cast(ushort *)&e;
return (pe[F.EXPPOS_SHORT] & F.EXPMASK) != F.EXPMASK;
}
unittest
{
assert(isFinite(1.23));
assert(!isFinite(double.infinity));
assert(!isFinite(float.nan));
}
/*********************************
* Returns !=0 if x is normalized (not zero, subnormal, infinite, or $(NAN)).
*/
/* Need one for each format because subnormal floats might
* be converted to normal reals.
*/
int isNormal(X)(X x) @trusted pure nothrow
{
alias floatTraits!(X) F;
static if(real.mant_dig==106) { // doubledouble
// doubledouble is normal if the least significant part is normal.
return isNormal((cast(double*)&x)[MANTISSA_LSB]);
} else {
ushort e = F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT];
return (e != F.EXPMASK && e!=0);
}
}
unittest
{
float f = 3;
double d = 500;
real e = 10e+48;
assert(isNormal(f));
assert(isNormal(d));
assert(isNormal(e));
f = d = e = 0;
assert(!isNormal(f));
assert(!isNormal(d));
assert(!isNormal(e));
assert(!isNormal(real.infinity));
assert(isNormal(-real.max));
assert(!isNormal(real.min_normal/4));
}
/*********************************
* Is number subnormal? (Also called "denormal".)
* Subnormals have a 0 exponent and a 0 most significant mantissa bit.
*/
/* Need one for each format because subnormal floats might
* be converted to normal reals.
*/
int isSubnormal(float f) @trusted pure nothrow
{
uint *p = cast(uint *)&f;
return (*p & 0x7F80_0000) == 0 && *p & 0x007F_FFFF;
}
unittest
{
float f = 3.0;
for (f = 1.0; !isSubnormal(f); f /= 2)
assert(f != 0);
}
/// ditto
int isSubnormal(double d) @trusted pure nothrow
{
uint *p = cast(uint *)&d;
return (p[MANTISSA_MSB] & 0x7FF0_0000) == 0
&& (p[MANTISSA_LSB] || p[MANTISSA_MSB] & 0x000F_FFFF);
}
unittest
{
double f;
for (f = 1; !isSubnormal(f); f /= 2)
assert(f != 0);
}
/// ditto
int isSubnormal(real x) @trusted pure nothrow
{
alias floatTraits!(real) F;
static if (real.mant_dig == 53) { // double
return isSubnormal(cast(double)x);
} else static if (real.mant_dig == 113) { // quadruple
ushort e = F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT];
long* ps = cast(long *)&x;
return (e == 0 &&
(((ps[MANTISSA_LSB]|(ps[MANTISSA_MSB]& 0x0000_FFFF_FFFF_FFFF))) !=0));
} else static if (real.mant_dig==64) { // real80
ushort* pe = cast(ushort *)&x;
long* ps = cast(long *)&x;
return (pe[F.EXPPOS_SHORT] & F.EXPMASK) == 0 && *ps > 0;
} else { // double double
return isSubnormal((cast(double*)&x)[MANTISSA_MSB]);
}
}
unittest
{
real f;
for (f = 1; !isSubnormal(f); f /= 2)
assert(f != 0);
}
/*********************************
* Return !=0 if e is $(PLUSMN)$(INFIN).
*/
bool isInfinity(real x) @trusted pure nothrow
{
alias floatTraits!(real) F;
static if (real.mant_dig == 53) { // double
return ((*cast(ulong *)&x) & 0x7FFF_FFFF_FFFF_FFFF)
== 0x7FF8_0000_0000_0000;
} else static if(real.mant_dig == 106) { //doubledouble
return (((cast(ulong *)&x)[MANTISSA_MSB]) & 0x7FFF_FFFF_FFFF_FFFF)
== 0x7FF8_0000_0000_0000;
} else static if (real.mant_dig == 113) { // quadruple
long* ps = cast(long *)&x;
return (ps[MANTISSA_LSB] == 0)
&& (ps[MANTISSA_MSB] & 0x7FFF_FFFF_FFFF_FFFF) == 0x7FFF_0000_0000_0000;
} else { // real80
ushort e = cast(ushort)(F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT]);
ulong* ps = cast(ulong *)&x;
// On Motorola 68K, infinity can have hidden bit=1 or 0. On x86, it is always 1.
return e == F.EXPMASK && (*ps & 0x7FFF_FFFF_FFFF_FFFF) == 0;
}
}
unittest
{
assert(isInfinity(float.infinity));
assert(!isInfinity(float.nan));
assert(isInfinity(double.infinity));
assert(isInfinity(-real.infinity));
assert(isInfinity(-1.0 / 0.0));
}
/*********************************
* Is the binary representation of x identical to y?
*
* Same as ==, except that positive and negative zero are not identical,
* and two $(NAN)s are identical if they have the same 'payload'.
*/
bool isIdentical(real x, real y) @trusted pure nothrow
{
// We're doing a bitwise comparison so the endianness is irrelevant.
long* pxs = cast(long *)&x;
long* pys = cast(long *)&y;
static if (real.mant_dig == 53)
{ //double
return pxs[0] == pys[0];
}
else static if (real.mant_dig == 113 || real.mant_dig==106)
{
// quadruple or doubledouble
return pxs[0] == pys[0] && pxs[1] == pys[1];
}
else
{ // real80
ushort* pxe = cast(ushort *)&x;
ushort* pye = cast(ushort *)&y;
return pxe[4] == pye[4] && pxs[0] == pys[0];
}
}
/*********************************
* Return 1 if sign bit of e is set, 0 if not.
*/
int signbit(real x) @trusted pure nothrow
{
return ((cast(ubyte *)&x)[floatTraits!(real).SIGNPOS_BYTE] & 0x80) != 0;
}
unittest
{
debug (math) printf("math.signbit.unittest\n");
assert(!signbit(float.nan));
assert(signbit(-float.nan));
assert(!signbit(168.1234));
assert(signbit(-168.1234));
assert(!signbit(0.0));
assert(signbit(-0.0));
assert(signbit(-double.max));
assert(!signbit(double.max));
}
/*********************************
* Return a value composed of to with from's sign bit.
*/
real copysign(real to, real from) @trusted pure nothrow
{
ubyte* pto = cast(ubyte *)&to;
const ubyte* pfrom = cast(ubyte *)&from;
alias floatTraits!(real) F;
pto[F.SIGNPOS_BYTE] &= 0x7F;
pto[F.SIGNPOS_BYTE] |= pfrom[F.SIGNPOS_BYTE] & 0x80;
return to;
}
unittest
{
real e;
e = copysign(21, 23.8);
assert(e == 21);
e = copysign(-21, 23.8);
assert(e == 21);
e = copysign(21, -23.8);
assert(e == -21);
e = copysign(-21, -23.8);
assert(e == -21);
e = copysign(real.nan, -23.8);
assert(isNaN(e) && signbit(e));
}
/*********************************
Returns $(D -1) if $(D x < 0), $(D x) if $(D x == 0), $(D 1) if
$(D x > 0), and $(NAN) if x==$(NAN).
*/
F sgn(F)(F x) @safe pure nothrow
{
// @@@TODO@@@: make this faster
return x > 0 ? 1 : x < 0 ? -1 : x;
}
unittest
{
debug (math) printf("math.sgn.unittest\n");
assert(sgn(168.1234) == 1);
assert(sgn(-168.1234) == -1);
assert(sgn(0.0) == 0);
assert(sgn(-0.0) == 0);
}
// Functions for NaN payloads
/*
* A 'payload' can be stored in the significand of a $(NAN). One bit is required
* to distinguish between a quiet and a signalling $(NAN). This leaves 22 bits
* of payload for a float; 51 bits for a double; 62 bits for an 80-bit real;
* and 111 bits for a 128-bit quad.
*/
/**
* Create a quiet $(NAN), storing an integer inside the payload.
*
* For floats, the largest possible payload is 0x3F_FFFF.
* For doubles, it is 0x3_FFFF_FFFF_FFFF.
* For 80-bit or 128-bit reals, it is 0x3FFF_FFFF_FFFF_FFFF.
*/
real NaN(ulong payload) @trusted pure nothrow
{
static if (real.mant_dig == 64) { //real80
ulong v = 3; // implied bit = 1, quiet bit = 1
} else {
ulong v = 2; // no implied bit. quiet bit = 1
}
ulong a = payload;
// 22 Float bits
ulong w = a & 0x3F_FFFF;
a -= w;
v <<=22;
v |= w;
a >>=22;
// 29 Double bits
v <<=29;
w = a & 0xFFF_FFFF;
v |= w;
a -= w;
a >>=29;
static if (real.mant_dig == 53) { // double
v |=0x7FF0_0000_0000_0000;
real x;
* cast(ulong *)(&x) = v;
return x;
} else {
v <<=11;
a &= 0x7FF;
v |= a;
real x = real.nan;
// Extended real bits
static if (real.mant_dig==113) { //quadruple
v<<=1; // there's no implicit bit
version(LittleEndian) {
*cast(ulong*)(6+cast(ubyte*)(&x)) = v;
} else {
*cast(ulong*)(2+cast(ubyte*)(&x)) = v;
}
} else { // real80
* cast(ulong *)(&x) = v;
}
return x;
}
}
/**
* Extract an integral payload from a $(NAN).
*
* Returns:
* the integer payload as a ulong.
*
* For floats, the largest possible payload is 0x3F_FFFF.
* For doubles, it is 0x3_FFFF_FFFF_FFFF.
* For 80-bit or 128-bit reals, it is 0x3FFF_FFFF_FFFF_FFFF.
*/
ulong getNaNPayload(real x) @trusted pure nothrow
{
// assert(isNaN(x));
static if (real.mant_dig == 53) {
ulong m = *cast(ulong *)(&x);
// Make it look like an 80-bit significand.
// Skip exponent, and quiet bit
m &= 0x0007_FFFF_FFFF_FFFF;
m <<= 10;
} else static if (real.mant_dig==113) { // quadruple
version(LittleEndian) {
ulong m = *cast(ulong*)(6+cast(ubyte*)(&x));
} else {
ulong m = *cast(ulong*)(2+cast(ubyte*)(&x));
}
m>>=1; // there's no implicit bit
} else {
ulong m = *cast(ulong *)(&x);
}
// ignore implicit bit and quiet bit
ulong f = m & 0x3FFF_FF00_0000_0000L;
ulong w = f >>> 40;
w |= (m & 0x00FF_FFFF_F800L) << (22 - 11);
w |= (m & 0x7FF) << 51;
return w;
}
debug(UnitTest) {
unittest {
real nan4 = NaN(0x789_ABCD_EF12_3456);
static if (real.mant_dig == 64 || real.mant_dig==113) {
assert (getNaNPayload(nan4) == 0x789_ABCD_EF12_3456);
} else {
assert (getNaNPayload(nan4) == 0x1_ABCD_EF12_3456);
}
double nan5 = nan4;
assert (getNaNPayload(nan5) == 0x1_ABCD_EF12_3456);
float nan6 = nan4;
assert (getNaNPayload(nan6) == 0x12_3456);
nan4 = NaN(0xFABCD);
assert (getNaNPayload(nan4) == 0xFABCD);
nan6 = nan4;
assert (getNaNPayload(nan6) == 0xFABCD);
nan5 = NaN(0x100_0000_0000_3456);
assert(getNaNPayload(nan5) == 0x0000_0000_3456);
}
}
/**
* Calculate the next largest floating point value after x.
*
* Return the least number greater than x that is representable as a real;
* thus, it gives the next point on the IEEE number line.
*
* $(TABLE_SV
* $(SVH x, nextUp(x) )
* $(SV -$(INFIN), -real.max )
* $(SV $(PLUSMN)0.0, real.min_normal*real.epsilon )
* $(SV real.max, $(INFIN) )
* $(SV $(INFIN), $(INFIN) )
* $(SV $(NAN), $(NAN) )
* )
*/
real nextUp(real x) @trusted pure nothrow
{
alias floatTraits!(real) F;
static if (real.mant_dig == 53) { // double
return nextUp(cast(double)x);
} else static if(real.mant_dig==113) { // quadruple
ushort e = F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT];
if (e == F.EXPMASK) { // NaN or Infinity
if (x == -real.infinity) return -real.max;
return x; // +Inf and NaN are unchanged.
}
ulong* ps = cast(ulong *)&e;
if (ps[MANTISSA_LSB] & 0x8000_0000_0000_0000) { // Negative number
if (ps[MANTISSA_LSB] == 0
&& ps[MANTISSA_MSB] == 0x8000_0000_0000_0000) {
// it was negative zero, change to smallest subnormal
ps[MANTISSA_LSB] = 0x0000_0000_0000_0001;
ps[MANTISSA_MSB] = 0;
return x;
}
--*ps;
if (ps[MANTISSA_LSB]==0) --ps[MANTISSA_MSB];
} else { // Positive number
++ps[MANTISSA_LSB];
if (ps[MANTISSA_LSB]==0) ++ps[MANTISSA_MSB];
}
return x;
} else static if(real.mant_dig==64){ // real80
// For 80-bit reals, the "implied bit" is a nuisance...
ushort *pe = cast(ushort *)&x;
ulong *ps = cast(ulong *)&x;
if ((pe[F.EXPPOS_SHORT] & F.EXPMASK) == F.EXPMASK) {
// First, deal with NANs and infinity
if (x == -real.infinity) return -real.max;
return x; // +Inf and NaN are unchanged.
}
if (pe[F.EXPPOS_SHORT] & 0x8000) {
// Negative number -- need to decrease the significand
--*ps;
// Need to mask with 0x7FFF... so subnormals are treated correctly.
if ((*ps & 0x7FFF_FFFF_FFFF_FFFF) == 0x7FFF_FFFF_FFFF_FFFF) {
if (pe[F.EXPPOS_SHORT] == 0x8000) { // it was negative zero
*ps = 1;
pe[F.EXPPOS_SHORT] = 0; // smallest subnormal.
return x;
}
--pe[F.EXPPOS_SHORT];
if (pe[F.EXPPOS_SHORT] == 0x8000) {
return x; // it's become a subnormal, implied bit stays low.
}
*ps = 0xFFFF_FFFF_FFFF_FFFF; // set the implied bit
return x;
}
return x;
} else {
// Positive number -- need to increase the significand.
// Works automatically for positive zero.
++*ps;
if ((*ps & 0x7FFF_FFFF_FFFF_FFFF) == 0) {
// change in exponent
++pe[F.EXPPOS_SHORT];
*ps = 0x8000_0000_0000_0000; // set the high bit
}
}
return x;
} // doubledouble is not supported
}
/** ditto */
double nextUp(double x) @trusted pure nothrow
{
ulong *ps = cast(ulong *)&x;
if ((*ps & 0x7FF0_0000_0000_0000) == 0x7FF0_0000_0000_0000) {
// First, deal with NANs and infinity
if (x == -x.infinity) return -x.max;
return x; // +INF and NAN are unchanged.
}
if (*ps & 0x8000_0000_0000_0000) { // Negative number
if (*ps == 0x8000_0000_0000_0000) { // it was negative zero
*ps = 0x0000_0000_0000_0001; // change to smallest subnormal
return x;
}
--*ps;
} else { // Positive number
++*ps;
}
return x;
}
/** ditto */
float nextUp(float x) @trusted pure nothrow
{
uint *ps = cast(uint *)&x;
if ((*ps & 0x7F80_0000) == 0x7F80_0000) {
// First, deal with NANs and infinity
if (x == -x.infinity) return -x.max;
return x; // +INF and NAN are unchanged.
}
if (*ps & 0x8000_0000) { // Negative number
if (*ps == 0x8000_0000) { // it was negative zero
*ps = 0x0000_0001; // change to smallest subnormal
return x;
}
--*ps;
} else { // Positive number
++*ps;
}
return x;
}
/**
* Calculate the next smallest floating point value before x.
*
* Return the greatest number less than x that is representable as a real;
* thus, it gives the previous point on the IEEE number line.
*
* $(TABLE_SV
* $(SVH x, nextDown(x) )
* $(SV $(INFIN), real.max )
* $(SV $(PLUSMN)0.0, -real.min_normal*real.epsilon )
* $(SV -real.max, -$(INFIN) )
* $(SV -$(INFIN), -$(INFIN) )
* $(SV $(NAN), $(NAN) )
* )
*/
real nextDown(real x) @safe pure nothrow
{
return -nextUp(-x);
}
/** ditto */
double nextDown(double x) @safe pure nothrow
{
return -nextUp(-x);
}
/** ditto */
float nextDown(float x) @safe pure nothrow
{
return -nextUp(-x);
}
unittest {
assert( nextDown(1.0 + real.epsilon) == 1.0);
}
unittest {
static if (real.mant_dig == 64) {
// Tests for 80-bit reals
assert(isIdentical(nextUp(NaN(0xABC)), NaN(0xABC)));
// negative numbers
assert( nextUp(-real.infinity) == -real.max );
assert( nextUp(-1.0L-real.epsilon) == -1.0 );
assert( nextUp(-2.0L) == -2.0 + real.epsilon);
// subnormals and zero
assert( nextUp(-real.min_normal) == -real.min_normal*(1-real.epsilon) );
assert( nextUp(-real.min_normal*(1-real.epsilon)) == -real.min_normal*(1-2*real.epsilon) );
assert( isIdentical(-0.0L, nextUp(-real.min_normal*real.epsilon)) );
assert( nextUp(-0.0L) == real.min_normal*real.epsilon );
assert( nextUp(0.0L) == real.min_normal*real.epsilon );
assert( nextUp(real.min_normal*(1-real.epsilon)) == real.min_normal );
assert( nextUp(real.min_normal) == real.min_normal*(1+real.epsilon) );
// positive numbers
assert( nextUp(1.0L) == 1.0 + real.epsilon );
assert( nextUp(2.0L-real.epsilon) == 2.0 );
assert( nextUp(real.max) == real.infinity );
assert( nextUp(real.infinity)==real.infinity );
}
double n = NaN(0xABC);
assert(isIdentical(nextUp(n), n));
// negative numbers
assert( nextUp(-double.infinity) == -double.max );
assert( nextUp(-1-double.epsilon) == -1.0 );
assert( nextUp(-2.0) == -2.0 + double.epsilon);
// subnormals and zero
assert( nextUp(-double.min_normal) == -double.min_normal*(1-double.epsilon) );
assert( nextUp(-double.min_normal*(1-double.epsilon)) == -double.min_normal*(1-2*double.epsilon) );
assert( isIdentical(-0.0, nextUp(-double.min_normal*double.epsilon)) );
assert( nextUp(0.0) == double.min_normal*double.epsilon );
assert( nextUp(-0.0) == double.min_normal*double.epsilon );
assert( nextUp(double.min_normal*(1-double.epsilon)) == double.min_normal );
assert( nextUp(double.min_normal) == double.min_normal*(1+double.epsilon) );
// positive numbers
assert( nextUp(1.0) == 1.0 + double.epsilon );
assert( nextUp(2.0-double.epsilon) == 2.0 );
assert( nextUp(double.max) == double.infinity );
float fn = NaN(0xABC);
assert(isIdentical(nextUp(fn), fn));
float f = -float.min_normal*(1-float.epsilon);
float f1 = -float.min_normal;
assert( nextUp(f1) == f);
f = 1.0f+float.epsilon;
f1 = 1.0f;
assert( nextUp(f1) == f );
f1 = -0.0f;
assert( nextUp(f1) == float.min_normal*float.epsilon);
assert( nextUp(float.infinity)==float.infinity );
assert(nextDown(1.0L+real.epsilon)==1.0);
assert(nextDown(1.0+double.epsilon)==1.0);
f = 1.0f+float.epsilon;
assert(nextDown(f)==1.0);
assert(nextafter(1.0+real.epsilon, -real.infinity)==1.0);
}
/******************************************
* Calculates the next representable value after x in the direction of y.
*
* If y > x, the result will be the next largest floating-point value;
* if y < x, the result will be the next smallest value.
* If x == y, the result is y.
*
* Remarks:
* This function is not generally very useful; it's almost always better to use
* the faster functions nextUp() or nextDown() instead.
*
* The FE_INEXACT and FE_OVERFLOW exceptions will be raised if x is finite and
* the function result is infinite. The FE_INEXACT and FE_UNDERFLOW
* exceptions will be raised if the function value is subnormal, and x is
* not equal to y.
*/
T nextafter(T)(T x, T y) @safe pure nothrow
{
if (x==y) return y;
return ((y>x) ? nextUp(x) : nextDown(x));
}
unittest
{
float a = 1;
assert(is(typeof(nextafter(a, a)) == float));
assert(nextafter(a, a.infinity) > a);
double b = 2;
assert(is(typeof(nextafter(b, b)) == double));
assert(nextafter(b, b.infinity) > b);
real c = 3;
assert(is(typeof(nextafter(c, c)) == real));
assert(nextafter(c, c.infinity) > c);
}
//real nexttoward(real x, real y) { return core.stdc.math.nexttowardl(x, y); }
/*******************************************
* Returns the positive difference between x and y.
* Returns:
* $(TABLE_SV
* $(TR $(TH x, y) $(TH fdim(x, y)))
* $(TR $(TD x $(GT) y) $(TD x - y))
* $(TR $(TD x $(LT)= y) $(TD +0.0))
* )
*/
real fdim(real x, real y) @safe pure nothrow { return (x > y) ? x - y : +0.0; }
/****************************************
* Returns the larger of x and y.
*/
real fmax(real x, real y) @safe pure nothrow { return x > y ? x : y; }
/****************************************
* Returns the smaller of x and y.
*/
real fmin(real x, real y) @safe pure nothrow { return x < y ? x : y; }
/**************************************
* Returns (x * y) + z, rounding only once according to the
* current rounding mode.
*
* BUGS: Not currently implemented - rounds twice.
*/
real fma(real x, real y, real z) @safe pure nothrow { return (x * y) + z; }
/*******************************************************************
* Compute the value of x $(SUP n), where n is an integer
*/
Unqual!F pow(F, G)(F x, G n) @trusted pure nothrow
if (isFloatingPoint!(F) && isIntegral!(G))
{
real p = 1.0, v = void;
Unsigned!(Unqual!G) m = n;
if (n < 0)
{
switch (n)
{
case -1:
return 1 / x;
case -2:
return 1 / (x * x);
default:
}
m = -n;
v = p / x;
}
else
{
switch (n)
{
case 0:
return 1.0;
case 1:
return x;
case 2:
return x * x;
default:
}
v = x;
}
while (1)
{
if (m & 1)
p *= v;
m >>= 1;
if (!m)
break;
v *= v;
}
return p;
}
unittest
{
// Make sure it instantiates and works properly on immutable values and
// with various integer and float types.
immutable real x = 46;
immutable float xf = x;
immutable double xd = x;
immutable uint one = 1;
immutable ushort two = 2;
immutable ubyte three = 3;
immutable ulong eight = 8;
immutable int neg1 = -1;
immutable short neg2 = -2;
immutable byte neg3 = -3;
immutable long neg8 = -8;
assert(pow(x,0) == 1.0);
assert(pow(xd,one) == x);
assert(pow(xf,two) == x * x);
assert(pow(x,three) == x * x * x);
assert(pow(x,eight) == (x * x) * (x * x) * (x * x) * (x * x));
assert(pow(x, neg1) == 1 / x);
version(X86_64)
{
pragma(msg, "test disabled on x86_64, see bug 5628");
}
else
{
assert(pow(xd, neg2) == 1 / (x * x));
assert(pow(xf, neg8) == 1 / ((x * x) * (x * x) * (x * x) * (x * x)));
}
assert(pow(x, neg3) == 1 / (x * x * x));
}
/** Compute the value of an integer x, raised to the power of a positive
* integer n.
*
* If both x and n are 0, the result is 1.
* If n is negative, an integer divide error will occur at runtime,
* regardless of the value of x.
*/
typeof(Unqual!(F).init * Unqual!(G).init) pow(F, G)(F x, G n) @trusted pure nothrow
if (isIntegral!(F) && isIntegral!(G))
{
if (n<0) return x/0; // Only support positive powers
typeof(return) p, v = void;
Unqual!G m = n;
switch (m)
{
case 0:
p = 1;
break;
case 1:
p = x;
break;
case 2:
p = x * x;
break;
default:
v = x;
p = 1;
while (1){
if (m & 1)
p *= v;
m >>= 1;
if (!m)
break;
v *= v;
}
break;
}
return p;
}
unittest
{
immutable int one = 1;
immutable byte two = 2;
immutable ubyte three = 3;
immutable short four = 4;
immutable long ten = 10;
assert(pow(two, three) == 8);
assert(pow(two, ten) == 1024);
assert(pow(one, ten) == 1);
assert(pow(ten, four) == 10_000);
assert(pow(four, 10) == 1_048_576);
assert(pow(three, four) == 81);
}
/**Computes integer to floating point powers.*/
real pow(I, F)(I x, F y) @trusted pure nothrow
if(isIntegral!I && isFloatingPoint!F)
{
return pow(cast(real) x, cast(Unqual!F) y);
}
/*********************************************
* Calculates x$(SUP y).
*
* $(TABLE_SV
* $(TR $(TH x) $(TH y) $(TH pow(x, y))
* $(TH div 0) $(TH invalid?))
* $(TR $(TD anything) $(TD $(PLUSMN)0.0) $(TD 1.0)
* $(TD no) $(TD no) )
* $(TR $(TD |x| $(GT) 1) $(TD +$(INFIN)) $(TD +$(INFIN))
* $(TD no) $(TD no) )
* $(TR $(TD |x| $(LT) 1) $(TD +$(INFIN)) $(TD +0.0)
* $(TD no) $(TD no) )
* $(TR $(TD |x| $(GT) 1) $(TD -$(INFIN)) $(TD +0.0)
* $(TD no) $(TD no) )
* $(TR $(TD |x| $(LT) 1) $(TD -$(INFIN)) $(TD +$(INFIN))
* $(TD no) $(TD no) )
* $(TR $(TD +$(INFIN)) $(TD $(GT) 0.0) $(TD +$(INFIN))
* $(TD no) $(TD no) )
* $(TR $(TD +$(INFIN)) $(TD $(LT) 0.0) $(TD +0.0)
* $(TD no) $(TD no) )
* $(TR $(TD -$(INFIN)) $(TD odd integer $(GT) 0.0) $(TD -$(INFIN))
* $(TD no) $(TD no) )
* $(TR $(TD -$(INFIN)) $(TD $(GT) 0.0, not odd integer) $(TD +$(INFIN))
* $(TD no) $(TD no))
* $(TR $(TD -$(INFIN)) $(TD odd integer $(LT) 0.0) $(TD -0.0)
* $(TD no) $(TD no) )
* $(TR $(TD -$(INFIN)) $(TD $(LT) 0.0, not odd integer) $(TD +0.0)
* $(TD no) $(TD no) )
* $(TR $(TD $(PLUSMN)1.0) $(TD $(PLUSMN)$(INFIN)) $(TD $(NAN))
* $(TD no) $(TD yes) )
* $(TR $(TD $(LT) 0.0) $(TD finite, nonintegral) $(TD $(NAN))
* $(TD no) $(TD yes))
* $(TR $(TD $(PLUSMN)0.0) $(TD odd integer $(LT) 0.0) $(TD $(PLUSMNINF))
* $(TD yes) $(TD no) )
* $(TR $(TD $(PLUSMN)0.0) $(TD $(LT) 0.0, not odd integer) $(TD +$(INFIN))
* $(TD yes) $(TD no))
* $(TR $(TD $(PLUSMN)0.0) $(TD odd integer $(GT) 0.0) $(TD $(PLUSMN)0.0)
* $(TD no) $(TD no) )
* $(TR $(TD $(PLUSMN)0.0) $(TD $(GT) 0.0, not odd integer) $(TD +0.0)
* $(TD no) $(TD no) )
* )
*/
Unqual!(Largest!(F, G)) pow(F, G)(F x, G y) @trusted pure nothrow
if (isFloatingPoint!(F) && isFloatingPoint!(G))
{
alias typeof(return) Float;
static real impl(real x, real y) pure nothrow
{
if (isNaN(y))
return y;
if (y == 0)
return 1; // even if x is $(NAN)
if (isNaN(x) && y != 0)
return x;
if (isInfinity(y))
{
if (fabs(x) > 1)
{
if (signbit(y))
return +0.0;
else
return F.infinity;
}
else if (fabs(x) == 1)
{
return y * 0; // generate NaN.
}
else // < 1
{
if (signbit(y))
return F.infinity;
else
return +0.0;
}
}
if (isInfinity(x))
{
if (signbit(x))
{ long i;
i = cast(long)y;
if (y > 0)
{
if (i == y && i & 1)
return -F.infinity;
else
return F.infinity;
}
else if (y < 0)
{
if (i == y && i & 1)
return -0.0;
else
return +0.0;
}
}
else
{
if (y > 0)
return F.infinity;
else if (y < 0)
return +0.0;
}
}
if (x == 0.0)
{
if (signbit(x))
{ long i;
i = cast(long)y;
if (y > 0)
{
if (i == y && i & 1)
return -0.0;
else
return +0.0;
}
else if (y < 0)
{
if (i == y && i & 1)
return -F.infinity;
else
return F.infinity;
}
}
else
{
if (y > 0)
return +0.0;
else if (y < 0)
return F.infinity;
}
}
double sign = 1.0;
if (x < 0) {
// Result is real only if y is an integer
// Check for a non-zero fractional part
if (y > -1.0 / real.epsilon && y < 1.0 / real.epsilon)
{
long w = cast(long)y;
if (w != y)
return sqrt(x); // Complex result -- create a NaN
if (w & 1) sign = -1.0;
}
x = -x;
}
version(INLINE_YL2X) {
// If x > 0, x ^^ y == 2 ^^ ( y * log2(x) )
// TODO: This is not accurate in practice. A fast and accurate
// (though complicated) method is described in:
// "An efficient rounding boundary test for pow(x, y)
// in double precision", C.Q. Lauter and V. Lefèvre, INRIA (2007).
return sign * exp2( yl2x(x, y) );
} else {
return sign * core.stdc.math.powl(x, y);
}
}
return impl(x, y);
}
unittest
{
// Test all the special values. These unittests can be run on Windows
// by temporarily changing the version(linux) to version(all).
immutable float zero = 0;
immutable real one = 1;
immutable double two = 2;
immutable float three = 3;
immutable float fnan = float.nan;
immutable double dnan = double.nan;
immutable real rnan = real.nan;
immutable dinf = double.infinity;
immutable rninf = -real.infinity;
assert(pow(fnan, zero) == 1);
assert(pow(dnan, zero) == 1);
assert(pow(rnan, zero) == 1);
assert(pow(two, dinf) == double.infinity);
assert(isIdentical(pow(0.2f, dinf), +0.0));
assert(pow(0.99999999L, rninf) == real.infinity);
assert(isIdentical(pow(1.000000001, rninf), +0.0));
assert(pow(dinf, 0.001) == dinf);
assert(isIdentical(pow(dinf, -0.001), +0.0));
assert(pow(rninf, 3.0L) == rninf);
assert(pow(rninf, 2.0L) == real.infinity);
assert(isIdentical(pow(rninf, -3.0), -0.0));
assert(isIdentical(pow(rninf, -2.0), +0.0));
// @@@BUG@@@ somewhere
version(OSX) {} else assert(isNaN(pow(one, dinf)));
version(OSX) {} else assert(isNaN(pow(-one, dinf)));
assert(isNaN(pow(-0.2, PI)));
// boundary cases. Note that epsilon == 2^^-n for some n,
// so 1/epsilon == 2^^n is always even.
assert(pow(-1.0L, 1/real.epsilon - 1.0L) == -1.0L);
assert(pow(-1.0L, 1/real.epsilon) == 1.0L);
assert(isNaN(pow(-1.0L, 1/real.epsilon-0.5L)));
assert(isNaN(pow(-1.0L, -1/real.epsilon+0.5L)));
assert(pow(0.0, -3.0) == double.infinity);
assert(pow(-0.0, -3.0) == -double.infinity);
assert(pow(0.0, -PI) == double.infinity);
assert(pow(-0.0, -PI) == double.infinity);
assert(isIdentical(pow(0.0, 5.0), 0.0));
assert(isIdentical(pow(-0.0, 5.0), -0.0));
assert(isIdentical(pow(0.0, 6.0), 0.0));
assert(isIdentical(pow(-0.0, 6.0), 0.0));
// Now, actual numbers.
assert(approxEqual(pow(two, three), 8.0));
assert(approxEqual(pow(two, -2.5), 0.1767767));
// Test integer to float power.
immutable uint twoI = 2;
assert(approxEqual(pow(twoI, three), 8.0));
}
/**************************************
* To what precision is x equal to y?
*
* Returns: the number of mantissa bits which are equal in x and y.
* eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.
*
* $(TABLE_SV
* $(TR $(TH x) $(TH y) $(TH feqrel(x, y)))
* $(TR $(TD x) $(TD x) $(TD real.mant_dig))
* $(TR $(TD x) $(TD $(GT)= 2*x) $(TD 0))
* $(TR $(TD x) $(TD $(LT)= x/2) $(TD 0))
* $(TR $(TD $(NAN)) $(TD any) $(TD 0))
* $(TR $(TD any) $(TD $(NAN)) $(TD 0))
* )
*/
int feqrel(X)(X x, X y) @trusted pure nothrow
if (isFloatingPoint!(X))
{
/* Public Domain. Author: Don Clugston, 18 Aug 2005.
*/
static if (X.mant_dig == 106) // doubledouble
{
if (cast(double*)(&x)[MANTISSA_MSB] == cast(double*)(&y)[MANTISSA_MSB])
{
return double.mant_dig
+ feqrel(cast(double*)(&x)[MANTISSA_LSB],
cast(double*)(&y)[MANTISSA_LSB]);
}
else
{
return feqrel(cast(double*)(&x)[MANTISSA_MSB],
cast(double*)(&y)[MANTISSA_MSB]);
}
}
else
{
static assert( X.mant_dig == 64 || X.mant_dig == 113
|| X.mant_dig == double.mant_dig || X.mant_dig == float.mant_dig);
if (x == y)
return X.mant_dig; // ensure diff!=0, cope with INF.
X diff = fabs(x - y);
ushort *pa = cast(ushort *)(&x);
ushort *pb = cast(ushort *)(&y);
ushort *pd = cast(ushort *)(&diff);
alias floatTraits!(X) F;
// The difference in abs(exponent) between x or y and abs(x-y)
// is equal to the number of significand bits of x which are
// equal to y. If negative, x and y have different exponents.
// If positive, x and y are equal to 'bitsdiff' bits.
// AND with 0x7FFF to form the absolute value.
// To avoid out-by-1 errors, we subtract 1 so it rounds down
// if the exponents were different. This means 'bitsdiff' is
// always 1 lower than we want, except that if bitsdiff==0,
// they could have 0 or 1 bits in common.
static if (X.mant_dig == 64 || X.mant_dig == 113)
{ // real80 or quadruple
int bitsdiff = ( ((pa[F.EXPPOS_SHORT] & F.EXPMASK)
+ (pb[F.EXPPOS_SHORT] & F.EXPMASK) - 1) >> 1)
- pd[F.EXPPOS_SHORT];
}
else static if (X.mant_dig == double.mant_dig)
{ // double
int bitsdiff = (( ((pa[F.EXPPOS_SHORT]&0x7FF0)
+ (pb[F.EXPPOS_SHORT]&0x7FF0)-0x10)>>1)
- (pd[F.EXPPOS_SHORT]&0x7FF0))>>4;
}
else static if (X.mant_dig == float.mant_dig)
{ // float
int bitsdiff = (( ((pa[F.EXPPOS_SHORT]&0x7F80)
+ (pb[F.EXPPOS_SHORT]&0x7F80)-0x80)>>1)
- (pd[F.EXPPOS_SHORT]&0x7F80))>>7;
}
if ( (pd[F.EXPPOS_SHORT] & F.EXPMASK) == 0)
{ // Difference is subnormal
// For subnormals, we need to add the number of zeros that
// lie at the start of diff's significand.
// We do this by multiplying by 2^^real.mant_dig
diff *= F.RECIP_EPSILON;
return bitsdiff + X.mant_dig - pd[F.EXPPOS_SHORT];
}
if (bitsdiff > 0)
return bitsdiff + 1; // add the 1 we subtracted before
// Avoid out-by-1 errors when factor is almost 2.
static if (X.mant_dig == 64 || X.mant_dig == 113)
{ // real80 or quadruple
return (bitsdiff == 0) ? (pa[F.EXPPOS_SHORT] == pb[F.EXPPOS_SHORT]) : 0;
}
else static if (X.mant_dig == double.mant_dig || X.mant_dig == float.mant_dig)
{
if (bitsdiff == 0
&& !((pa[F.EXPPOS_SHORT] ^ pb[F.EXPPOS_SHORT]) & F.EXPMASK))
{
return 1;
} else return 0;
}
}
}
unittest
{
void testFeqrel(F)()
{
// Exact equality
assert(feqrel(F.max, F.max) == F.mant_dig);
assert(feqrel!(F)(0.0, 0.0) == F.mant_dig);
assert(feqrel(F.infinity, F.infinity) == F.mant_dig);
// a few bits away from exact equality
F w=1;
for (int i = 1; i < F.mant_dig - 1; ++i)
{
assert(feqrel!(F)(1.0 + w * F.epsilon, 1.0) == F.mant_dig-i);
assert(feqrel!(F)(1.0 - w * F.epsilon, 1.0) == F.mant_dig-i);
assert(feqrel!(F)(1.0, 1 + (w-1) * F.epsilon) == F.mant_dig - i + 1);
w*=2;
}
assert(feqrel!(F)(1.5+F.epsilon, 1.5) == F.mant_dig-1);
assert(feqrel!(F)(1.5-F.epsilon, 1.5) == F.mant_dig-1);
assert(feqrel!(F)(1.5-F.epsilon, 1.5+F.epsilon) == F.mant_dig-2);
// Numbers that are close
assert(feqrel!(F)(0x1.Bp+84, 0x1.B8p+84) == 5);
assert(feqrel!(F)(0x1.8p+10, 0x1.Cp+10) == 2);
assert(feqrel!(F)(1.5 * (1 - F.epsilon), 1.0L) == 2);
assert(feqrel!(F)(1.5, 1.0) == 1);
assert(feqrel!(F)(2 * (1 - F.epsilon), 1.0L) == 1);
// Factors of 2
assert(feqrel(F.max, F.infinity) == 0);
assert(feqrel!(F)(2 * (1 - F.epsilon), 1.0L) == 1);
assert(feqrel!(F)(1.0, 2.0) == 0);
assert(feqrel!(F)(4.0, 1.0) == 0);
// Extreme inequality
assert(feqrel(F.nan, F.nan) == 0);
assert(feqrel!(F)(0.0L, -F.nan) == 0);
assert(feqrel(F.nan, F.infinity) == 0);
assert(feqrel(F.infinity, -F.infinity) == 0);
assert(feqrel(F.max, -F.max) == 0);
}
assert(feqrel(7.1824L, 7.1824L) == real.mant_dig);
assert(feqrel(real.min_normal / 8, real.min_normal / 17) == 3);
testFeqrel!(real)();
testFeqrel!(double)();
testFeqrel!(float)();
}
package: // Not public yet
/* Return the value that lies halfway between x and y on the IEEE number line.
*
* Formally, the result is the arithmetic mean of the binary significands of x
* and y, multiplied by the geometric mean of the binary exponents of x and y.
* x and y must have the same sign, and must not be NaN.
* Note: this function is useful for ensuring O(log n) behaviour in algorithms
* involving a 'binary chop'.
*
* Special cases:
* If x and y are within a factor of 2, (ie, feqrel(x, y) > 0), the return value
* is the arithmetic mean (x + y) / 2.
* If x and y are even powers of 2, the return value is the geometric mean,
* ieeeMean(x, y) = sqrt(x * y).
*
*/
T ieeeMean(T)(T x, T y) @trusted pure nothrow
in {
// both x and y must have the same sign, and must not be NaN.
assert(signbit(x) == signbit(y));
assert(x<>=0 && y<>=0);
}
body {
// Runtime behaviour for contract violation:
// If signs are opposite, or one is a NaN, return 0.
if (!((x>=0 && y>=0) || (x<=0 && y<=0))) return 0.0;
// The implementation is simple: cast x and y to integers,
// average them (avoiding overflow), and cast the result back to a floating-point number.
alias floatTraits!(real) F;
T u;
static if (T.mant_dig==64) { // real80
// There's slight additional complexity because they are actually
// 79-bit reals...
ushort *ue = cast(ushort *)&u;
ulong *ul = cast(ulong *)&u;
ushort *xe = cast(ushort *)&x;
ulong *xl = cast(ulong *)&x;
ushort *ye = cast(ushort *)&y;
ulong *yl = cast(ulong *)&y;
// Ignore the useless implicit bit. (Bonus: this prevents overflows)
ulong m = ((*xl) & 0x7FFF_FFFF_FFFF_FFFFL) + ((*yl) & 0x7FFF_FFFF_FFFF_FFFFL);
// @@@ BUG? @@@
// Cast shouldn't be here
ushort e = cast(ushort) ((xe[F.EXPPOS_SHORT] & F.EXPMASK)
+ (ye[F.EXPPOS_SHORT] & F.EXPMASK));
if (m & 0x8000_0000_0000_0000L) {
++e;
m &= 0x7FFF_FFFF_FFFF_FFFFL;
}
// Now do a multi-byte right shift
uint c = e & 1; // carry
e >>= 1;
m >>>= 1;
if (c) m |= 0x4000_0000_0000_0000L; // shift carry into significand
if (e) *ul = m | 0x8000_0000_0000_0000L; // set implicit bit...
else *ul = m; // ... unless exponent is 0 (subnormal or zero).
ue[4]= e | (xe[F.EXPPOS_SHORT]& 0x8000); // restore sign bit
} else static if(T.mant_dig == 113) { //quadruple
// This would be trivial if 'ucent' were implemented...
ulong *ul = cast(ulong *)&u;
ulong *xl = cast(ulong *)&x;
ulong *yl = cast(ulong *)&y;
// Multi-byte add, then multi-byte right shift.
ulong mh = ((xl[MANTISSA_MSB] & 0x7FFF_FFFF_FFFF_FFFFL)
+ (yl[MANTISSA_MSB] & 0x7FFF_FFFF_FFFF_FFFFL));
// Discard the lowest bit (to avoid overflow)
ulong ml = (xl[MANTISSA_LSB]>>>1) + (yl[MANTISSA_LSB]>>>1);
// add the lowest bit back in, if necessary.
if (xl[MANTISSA_LSB] & yl[MANTISSA_LSB] & 1) {
++ml;
if (ml==0) ++mh;
}
mh >>>=1;
ul[MANTISSA_MSB] = mh | (xl[MANTISSA_MSB] & 0x8000_0000_0000_0000);
ul[MANTISSA_LSB] = ml;
} else static if (T.mant_dig == double.mant_dig) {
ulong *ul = cast(ulong *)&u;
ulong *xl = cast(ulong *)&x;
ulong *yl = cast(ulong *)&y;
ulong m = (((*xl) & 0x7FFF_FFFF_FFFF_FFFFL)
+ ((*yl) & 0x7FFF_FFFF_FFFF_FFFFL)) >>> 1;
m |= ((*xl) & 0x8000_0000_0000_0000L);
*ul = m;
} else static if (T.mant_dig == float.mant_dig) {
uint *ul = cast(uint *)&u;
uint *xl = cast(uint *)&x;
uint *yl = cast(uint *)&y;
uint m = (((*xl) & 0x7FFF_FFFF) + ((*yl) & 0x7FFF_FFFF)) >>> 1;
m |= ((*xl) & 0x8000_0000);
*ul = m;
} else {
assert(0, "Not implemented");
}
return u;
}
unittest {
assert(ieeeMean(-0.0,-1e-20)<0);
assert(ieeeMean(0.0,1e-20)>0);
assert(ieeeMean(1.0L,4.0L)==2L);
assert(ieeeMean(2.0*1.013,8.0*1.013)==4*1.013);
assert(ieeeMean(-1.0L,-4.0L)==-2L);
assert(ieeeMean(-1.0,-4.0)==-2);
assert(ieeeMean(-1.0f,-4.0f)==-2f);
assert(ieeeMean(-1.0,-2.0)==-1.5);
assert(ieeeMean(-1*(1+8*real.epsilon),-2*(1+8*real.epsilon))
==-1.5*(1+5*real.epsilon));
assert(ieeeMean(0x1p60,0x1p-10)==0x1p25);
static if (real.mant_dig==64) { // x87, 80-bit reals
assert(ieeeMean(1.0L,real.infinity)==0x1p8192L);
assert(ieeeMean(0.0L,real.infinity)==1.5);
}
assert(ieeeMean(0.5*real.min_normal*(1-4*real.epsilon),0.5*real.min_normal)
== 0.5*real.min_normal*(1-2*real.epsilon));
}
public:
/***********************************
* Evaluate polynomial A(x) = $(SUB a, 0) + $(SUB a, 1)x + $(SUB a, 2)$(POWER x,2)
* + $(SUB a,3)$(POWER x,3); ...
*
* Uses Horner's rule A(x) = $(SUB a, 0) + x($(SUB a, 1) + x($(SUB a, 2)
* + x($(SUB a, 3) + ...)))
* Params:
* A = array of coefficients $(SUB a, 0), $(SUB a, 1), etc.
*/
real poly(real x, const real[] A) @trusted pure nothrow
in
{
assert(A.length > 0);
}
body
{
version (D_InlineAsm_X86)
{
version (Windows)
{
// BUG: This code assumes a frame pointer in EBP.
asm // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX][ECX*8] ;
add EDX,ECX ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -10[EDX] ;
sub EDX,10 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
;
}
}
else version (linux)
{
asm // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
lea EDX,[EDX][ECX*4] ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -12[EDX] ;
sub EDX,12 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
;
}
}
else version (OSX)
{
asm // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
add EDX,EDX ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -16[EDX] ;
sub EDX,16 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
;
}
}
else version (FreeBSD)
{
asm // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
lea EDX,[EDX][ECX*4] ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -12[EDX] ;
sub EDX,12 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
;
}
}
else
{
static assert(0);
}
}
else
{
sizediff_t i = A.length - 1;
real r = A[i];
while (--i >= 0)
{
r *= x;
r += A[i];
}
return r;
}
}
unittest
{
debug (math) printf("math.poly.unittest\n");
real x = 3.1;
static real pp[] = [56.1, 32.7, 6];
assert( poly(x, pp) == (56.1L + (32.7L + 6L * x) * x) );
}
/**
Computes whether $(D lhs) is approximately equal to $(D rhs)
admitting a maximum relative difference $(D maxRelDiff) and a
maximum absolute difference $(D maxAbsDiff).
If the two inputs are ranges, $(D approxEqual) returns true if and
only if the ranges have the same number of elements and if $(D
approxEqual) evaluates to $(D true) for each pair of elements.
*/
bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff, V maxAbsDiff = 1e-5)
{
static if (isInputRange!T)
{
static if (isInputRange!U)
{
// Two ranges
for (;; lhs.popFront(), rhs.popFront())
{
if (lhs.empty) return rhs.empty;
if (rhs.empty) return lhs.empty;
if (!approxEqual(lhs.front, rhs.front, maxRelDiff, maxAbsDiff))
return false;
}
}
else
{
// lhs is range, rhs is number
for (; !lhs.empty; lhs.popFront())
{
if (!approxEqual(lhs.front, rhs, maxRelDiff, maxAbsDiff))
return false;
}
return true;
}
}
else
{
static if (isInputRange!U)
{
// lhs is number, rhs is array
return approxEqual(rhs, lhs, maxRelDiff, maxAbsDiff);
}
else
{
// two numbers
//static assert(is(T : real) && is(U : real));
if (rhs == 0)
{
return fabs(lhs) <= maxAbsDiff;
}
static if (is(typeof(lhs.infinity)) && is(typeof(rhs.infinity)))
{
if (lhs == lhs.infinity && rhs == rhs.infinity ||
lhs == -lhs.infinity && rhs == -rhs.infinity) return true;
}
return fabs((lhs - rhs) / rhs) <= maxRelDiff
|| maxAbsDiff != 0 && fabs(lhs - rhs) <= maxAbsDiff;
}
}
}
/**
Returns $(D approxEqual(lhs, rhs, 1e-2, 1e-5)).
*/
bool approxEqual(T, U)(T lhs, U rhs)
{
return approxEqual(lhs, rhs, 1e-2, 1e-5);
}
unittest
{
assert(approxEqual(1.0, 1.0099));
assert(!approxEqual(1.0, 1.011));
float[] arr1 = [ 1.0, 2.0, 3.0 ];
double[] arr2 = [ 1.001, 1.999, 3 ];
assert(approxEqual(arr1, arr2));
real num = real.infinity;
assert(num == real.infinity); // Passes.
assert(approxEqual(num, real.infinity)); // Fails.
num = -real.infinity;
assert(num == -real.infinity); // Passes.
assert(approxEqual(num, -real.infinity)); // Fails.
}
// Included for backwards compatibility with Phobos1
alias isNaN isnan;
alias isFinite isfinite;
alias isNormal isnormal;
alias isSubnormal issubnormal;
alias isInfinity isinf;
/* **********************************
* Building block functions, they
* translate to a single x87 instruction.
*/
real yl2x(real x, real y) @safe pure nothrow; // y * log2(x)
real yl2xp1(real x, real y) @safe pure nothrow; // y * log2(x + 1)
unittest
{
version (INLINE_YL2X)
{
assert(yl2x(1024, 1) == 10);
assert(yl2xp1(1023, 1) == 10);
}
}
unittest
{
real num = real.infinity;
assert(num == real.infinity); // Passes.
assert(approxEqual(num, real.infinity)); // Fails.
}
|
D
|
/Users/ins/Documents/Code/rust-study/vite-rust-wasm-linkedlist/@rsw/linkedlist/target/rls/debug/deps/wasm_bindgen_shared-95677271a2360eaf.rmeta: /Users/ins/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/wasm-bindgen-shared-0.2.73/src/lib.rs
/Users/ins/Documents/Code/rust-study/vite-rust-wasm-linkedlist/@rsw/linkedlist/target/rls/debug/deps/libwasm_bindgen_shared-95677271a2360eaf.rlib: /Users/ins/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/wasm-bindgen-shared-0.2.73/src/lib.rs
/Users/ins/Documents/Code/rust-study/vite-rust-wasm-linkedlist/@rsw/linkedlist/target/rls/debug/deps/wasm_bindgen_shared-95677271a2360eaf.d: /Users/ins/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/wasm-bindgen-shared-0.2.73/src/lib.rs
/Users/ins/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/wasm-bindgen-shared-0.2.73/src/lib.rs:
# env-dep:CARGO_PKG_VERSION=0.2.73
# env-dep:WBG_VERSION
|
D
|
// Vicfred
// https://atcoder.jp/contests/abc165/tasks/abc165_a
// simulation
import std.conv;
import std.stdio;
import std.string;
void main() {
int k = readln.chomp.to!int;
int a, b;
readf("%s %s\n", &a, &b);
for(int i = a; i <= b; ++i) {
if(i%k == 0) {
"OK".writeln;
return;
}
}
"NG".writeln;
}
|
D
|
instance NOV_1371_BaalNetbek(Npc_Default)
{
name[0] = "Baal Netbek";
npcType = npctype_main;
guild = GIL_NOV;
level = 3;
flags = 0;
voice = 3;
id = 1371;
attribute[ATR_STRENGTH] = 10;
attribute[ATR_DEXTERITY] = 10;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX] = 76;
attribute[ATR_HITPOINTS] = 76;
Mdl_SetVisual(self,"HUMANS.MDS");
Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds");
Mdl_SetVisualBody(self,"hum_body_Naked0",1,1,"Hum_Head_Fatbald",101,1,nov_armor_l);
B_Scale(self);
Mdl_SetModelFatness(self,3);
fight_tactic = FAI_HUMAN_Strong;
CreateInvItem(self,ItMw_1H_Hatchet_01);
daily_routine = Rtn_start_1371;
};
func void Rtn_start_1371()
{
TA_Stay(24,0,6,0,"PATH_TAKE_HERB_08");
TA_Stay(6,0,24,0,"PATH_TAKE_HERB_08");
};
|
D
|
import std.stdio;
void main()
{
void* p = null;
writefln("%08X", p);
}
|
D
|
struct Point(T)
{
T x, y;
typeof(this) opAdd(const ref typeof(this) other) const { return typeof(this)(cast(T)(x + other.x), cast(T)(y + other.y)); }
typeof(this) opSub(const ref typeof(this) other) const { return typeof(this)(cast(T)(x - other.x), cast(T)(y - other.y)); }
void opAddAssign(const ref typeof(this) other) { x += other.x; y += other.y; }
void opSubAssign(const ref typeof(this) other) { x -= other.x; y -= other.y; }
}
struct Size(T) { T width, height; }
struct Rect(PT, ST)
{
union
{
Point!(PT) position;
struct{ PT x, y; }
}
union
{
Size!(ST) size;
struct{ ST width, height; }
}
//this(const ref typeof(this.position) pt, const ref typeof(this.size) sz) { position=pt; size=sz; }
//this(PT x, PT y, ST width, ST height) { this.x = x; this.y = y; this.width = width; this.height = height; }
bool contains(const ref typeof(this.position) point) const
{
return this.x <= point.x && this.y <= point.y &&
point.x < this.x + this.width && point.y < this.y + this.height;
}
}
|
D
|
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/Fluent.build/Objects-normal/x86_64/QueryBuilder+Run.o : /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/ID.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Model+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/Deprecated.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/MigrateCommand.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/RevertCommand.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Decode.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Range.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/SoftDeletable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Aggregate.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationConfig.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Join/JoinSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Transaction/TransactionSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Query/QuerySupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationLog.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Model.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Model.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/AnyModel.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Children.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Join/QueryBuilder+Join.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting+Migration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/Migration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/AnyMigration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Run.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/FluentProvider.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaUpdater.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Filter.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/FluentError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaCreator.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/DatabasesConfig+References.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Siblings.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/Migrations.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/AnyMigrations.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Operators.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Parent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/CommandConfig+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Cache/KeyedCacheSupporting+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Database/DatabaseConnection+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/ModelEvent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Pivot.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Sort.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Cache/CacheEntry.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Query/FluentProperty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Command.framework/Modules/Command.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Console.framework/Modules/Console.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Logging.framework/Modules/Logging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/DatabaseKit.framework/Modules/DatabaseKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/Fluent.build/Objects-normal/x86_64/QueryBuilder+Run~partial.swiftmodule : /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/ID.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Model+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/Deprecated.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/MigrateCommand.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/RevertCommand.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Decode.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Range.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/SoftDeletable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Aggregate.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationConfig.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Join/JoinSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Transaction/TransactionSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Query/QuerySupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationLog.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Model.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Model.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/AnyModel.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Children.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Join/QueryBuilder+Join.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting+Migration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/Migration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/AnyMigration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Run.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/FluentProvider.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaUpdater.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Filter.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/FluentError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaCreator.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/DatabasesConfig+References.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Siblings.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/Migrations.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/AnyMigrations.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Operators.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Parent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/CommandConfig+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Cache/KeyedCacheSupporting+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Database/DatabaseConnection+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/ModelEvent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Pivot.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Sort.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Cache/CacheEntry.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Query/FluentProperty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Command.framework/Modules/Command.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Console.framework/Modules/Console.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Logging.framework/Modules/Logging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/DatabaseKit.framework/Modules/DatabaseKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/Fluent.build/Objects-normal/x86_64/QueryBuilder+Run~partial.swiftdoc : /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/ID.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Model+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+CRUD.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/Deprecated.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/MigrateCommand.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/RevertCommand.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Decode.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Range.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/SoftDeletable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Aggregate.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationConfig.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Join/JoinSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Transaction/TransactionSupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Query/QuerySupporting.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/MigrationLog.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Model.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Model.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/AnyModel.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Children.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Join/QueryBuilder+Join.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaSupporting+Migration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/Migration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/AnyMigration.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Run.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/FluentProvider.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaUpdater.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Filter.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/FluentError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/SchemaCreator.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Schema/DatabasesConfig+References.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Siblings.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/Migrations.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Migration/AnyMigrations.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Operators.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Utilities/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Relations/Parent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Service/CommandConfig+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Cache/KeyedCacheSupporting+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Database/DatabaseConnection+Fluent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/ModelEvent.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Model/Pivot.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/QueryBuilder/QueryBuilder+Sort.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Cache/CacheEntry.swift /Users/petercernak/vapor/TILApp/.build/checkouts/fluent.git-8387737201324173519/Sources/Fluent/Query/FluentProperty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Command.framework/Modules/Command.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Console.framework/Modules/Console.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Logging.framework/Modules/Logging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/DatabaseKit.framework/Modules/DatabaseKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
/*
* Translated from
* PETSC_DIR/src/sys/examples/tutorials/ex1.c
*
*/
auto help = "Synchronized printing.\n\n";
import petsc.c.sys;
int main(string[] args) {
PetscErrorCode ierr;
/*
Every PETSc routine should begin with the PetscInitialize() routine.
args - These command line arguments are taken to extract the options
supplied to PETSc and options supplied to MPI.
help - When PETSc executable is invoked with the option -help,
it prints the various options that can be applied at
runtime. The user can use the "help" variable place
additional help messages in this printout.
*/
PetscInitialize(args, help);
/*
The following MPI calls return the number of processes
being used and the rank of this process in the group.
*/
PetscMPIInt size = MPI_Comm_size(PETSC_COMM_WORLD);
PetscMPIInt rank = MPI_Comm_rank(PETSC_COMM_WORLD);
/*
Here we would like to print only one message that represents
all the processes in the group. We use PetscPrintf() with the
communicator PETSC_COMM_WORLD. Thus, only one message is
printed representing PETSC_COMM_WORLD, i.e., all the processors.
*/
ierr = PetscPrintf(PETSC_COMM_WORLD,"Number of processors = %d, rank = %d\n",size,rank);CHKERRQ(ierr);
/*
Here we would like to print info from each process, such that
output from process "n" appears after output from process "n-1".
To do this we use a combination of PetscSynchronizedPrintf() and
PetscSynchronizedFlush() with the communicator PETSC_COMM_WORLD.
All the processes print the message, one after another.
PetscSynchronizedFlush() indicates that the current process in the
given communicator has concluded printing, so that the next process
in the communicator can begin printing to the screen.
*/
ierr = PetscSynchronizedPrintf(PETSC_COMM_WORLD,"[%d] Synchronized Hello World.\n",rank);CHKERRQ(ierr);
ierr = PetscSynchronizedPrintf(PETSC_COMM_WORLD,"[%d] Synchronized Hello World - Part II.\n",rank);CHKERRQ(ierr);
ierr = PetscSynchronizedFlush(PETSC_COMM_WORLD);CHKERRQ(ierr);
/*
Here a barrier is used to separate the two states.
*/
ierr = MPI_Barrier(PETSC_COMM_WORLD);CHKERRQ(ierr);
/*
Here we simply use PetscPrintf() with the communicator PETSC_COMM_SELF
(where each process is considered separately). Thus, this time the
output from different processes does not appear in any particular order.
*/
ierr = PetscPrintf(PETSC_COMM_SELF,"[%d] Jumbled Hello World\n",rank);CHKERRQ(ierr);
/*
Always call PetscFinalize() before exiting a program. This routine
- finalizes the PETSc libraries as well as MPI
- provides summary and diagnostic information if certain runtime
options are chosen (e.g., -log_summary).
See the PetscFinalize() manpage for more information.
*/
PetscFinalize();
return 0;
}
|
D
|
module krepel.physics.system;
import krepel;
import krepel.engine;
import krepel.game_framework;
import krepel.physics.rigid_body;
import krepel.physics.collision_detection;
import krepel.input;
class PhysicsSystem : Subsystem
{
Array!RigidBody RigidBodies;
IAllocator Allocator;
Engine ParentEngine;
Vector3 Gravity = Vector3(0,0,-9.81f);
this(IAllocator Allocator)
{
this.Allocator = Allocator;
RigidBodies.Allocator = Allocator;
}
void RegisterRigidBody(RigidBody Body)
{
RigidBodies ~= Body;
}
void UnregisterRigidBody(RigidBody Body)
{
auto Position = RigidBodies[].CountUntil(Body);
if (Position >= 0)
{
RigidBodies.RemoveAtSwap(Position);
}
}
override void Initialize(Engine ParentEngine)
{
this.ParentEngine = ParentEngine;
ParentEngine.InputContexts[0].RegisterInputSlot(InputType.Button, "Resolve");
ParentEngine.InputContexts[0].AddSlotMapping(Keyboard.Space, "Resolve");
}
override void Destroy()
{
}
bool WasUp = false;
override void Tick(TickData Tick)
{
if ((ParentEngine.InputContexts[0]["Resolve"].ButtonIsDown && WasUp) || true)
{
WasUp = false;
Vector3 DeltaGravity = Gravity * Tick.ElapsedTime;
foreach(Body; RigidBodies)
{
if (Body.BodyMovability == Movability.Dynamic)
{
Body.Velocity += DeltaGravity;
Body.Owner.MoveWorld(Body.Velocity * Tick.ElapsedTime);
}
}
foreach(Index1, Body1; RigidBodies)
{
foreach(Index2, Body2; RigidBodies[Index1+1..$])
{
if (Body1.BodyMovability == Movability.Dynamic || Body2.BodyMovability == Movability.Dynamic )
{
auto CollisionResult = CollisionDetection.CheckCollision(Body1, Body2);
if (CollisionResult.DoesCollide)
{
Vector3 ResolvanceVector = CollisionResult.PenetrationDepth * CollisionResult.CollisionNormal;
float Body1ResolvanceFactor = 1.0f;
float Body2ResolvanceFactor = 0.0f;
if (Body1.BodyMovability == Movability.Dynamic && Body2.BodyMovability.Dynamic)
{
Body1ResolvanceFactor = Body1.Mass / (Body1.Mass + Body2.Mass);
Body2ResolvanceFactor = 1.0f - Body1ResolvanceFactor;
}
else if(Body1.BodyMovability == Movability.Static)
{
Body1ResolvanceFactor = 0.0f;
Body2ResolvanceFactor = 1.0f;
}
Body1.Velocity = Body1.Velocity.ReflectVector(ResolvanceVector.SafeNormalizedCopy) * Body1.Restitution;
Body2.Velocity = Body2.Velocity.ReflectVector(ResolvanceVector.SafeNormalizedCopy) * Body2.Restitution;
if (Body1.Movable)
{
Body1.Owner.MoveWorld(ResolvanceVector * Body1ResolvanceFactor);
}
if (Body2.Movable)
{
Body2.Owner.MoveWorld(-ResolvanceVector * Body2ResolvanceFactor);
}
}
}
}
}
}
else if(!ParentEngine.InputContexts[0]["Resolve"].ButtonIsDown)
{
WasUp = true;
}
}
}
|
D
|
module luad.table;
import luad.c.all;
import luad.base;
import luad.stack;
import luad.conversions.structs;
/// Represents a Lua table.
struct LuaTable
{
/// LuaTable sub-types $(DPREF base, LuaObject) through this reference.
LuaObject object;
alias object this;
package this(lua_State* L, int idx)
{
LuaObject.checkType(L, idx, LUA_TTABLE, "LuaTable");
object = LuaObject(L, idx);
}
/**
* Lookup a value in this table or in a sub-table of this table.
* Params:
* T = type of value
* args = list of keys, where all keys but the last one should result in a table
* Returns:
* $(D t[k]) where $(D t) is the table for the second-to-last parameter, and $(D k) is the last parameter
*
* Examples:
* ----------------------
auto execute = lua.get!LuaFunction("os", "execute");
execute(`echo hello, world!`);
* ----------------------
*/
T get(T, U...)(U args) @trusted
{
this.push();
foreach(key; args)
{
pushValue(this.state, key);
lua_gettable(this.state, -2);
}
auto ret = getValue!T(this.state, -1);
lua_pop(this.state, args.length + 1);
return ret;
}
/**
* Read a string value in this table without making a copy of the string.
* The read string is passed to $(D dg), and should not be escaped.
* If the value for $(D key) is not a string, $(D dg) is not called.
* Params:
* key = lookup _key
* dg = delegate to receive string
* Returns:
* $(D true) if the value for $(D key) was a string and passed to $(D dg), $(D false) otherwise
* Examples:
--------------------
t[2] = "two";
t.readString(2, str => assert(str == "two"));
--------------------
*/
bool readString(T)(T key, scope void delegate(in char[] str) dg) @trusted
{
this.push();
scope(exit) lua_pop(this.state, 1);
pushValue(this.state, key);
lua_gettable(this.state, -2);
scope(exit) lua_pop(this.state, 1);
if(lua_isstring(this.state, -1) == 0)
return false;
size_t len;
const(char)* cstr = lua_tolstring(this.state, -1, &len);
dg(cstr[0 .. len]);
return true;
}
/**
* Same as calling $(D get!LuaObject) with the same arguments.
* Examples:
* ---------------------
auto luapath = lua["package", "path"];
writefln("LUA_PATH:\n%s", luapath);
* ---------------------
* See_Also:
* $(MREF LuaTable.get)
*/
LuaObject opIndex(T...)(T args)
{
return get!LuaObject(args);
}
/**
* Set a key-value pair in this table.
* Params:
* key = key to _set
* value = value for $(D key)
*/
void set(T, U)(T key, U value) @trusted
{
this.push();
scope(success) lua_pop(this.state, 1);
pushValue(this.state, key);
pushValue(this.state, value);
lua_settable(this.state, -3);
}
/**
* Set a key-value pair this table or in a sub-table of this table.
* Params:
* value = value to set
* args = list of keys, where all keys but the last one should result in a table
* Returns:
* $(D t[k] = value), where $(D t) is the table for the second-to-last parameter in args,
* and $(D k) is the last parameter in args
*
* Examples:
* ----------------------
lua["string", "empty"] = (in char[] s){ return s.length == 0; };
lua.doString(`assert(string.empty(""))`);
* ----------------------
*/
void opIndexAssign(T, U...)(T value, U args) @trusted
{
this.push();
scope(success) lua_pop(this.state, 1);
foreach(i, arg; args)
{
static if(i != args.length - 1)
{
pushValue(this.state, arg);
lua_gettable(this.state, -2);
}
}
pushValue(this.state, args[$-1]);
pushValue(this.state, value);
lua_settable(this.state, -3);
lua_pop(this.state, args.length - 1);
}
/**
* Create struct of type $(D T) and fill its members with fields from this table.
*
* Struct fields that are not present in this table are left at their default value.
*
* Params:
* T = any struct type
*
* Returns:
* Newly created struct
*/
T toStruct(T)() @trusted if (is(T == struct))
{
push();
return popValue!T(this.state);
}
/**
* Fill a struct's members with fields from this table.
* Params:
* s = struct to fill
*/
void copyTo(T)(ref T s) @trusted if (is(T == struct))
{
push();
fillStruct(this.state, -1, s);
lua_pop(L, 1);
}
/**
* Set the metatable for this table.
* Params:
* meta = new metatable
*/
void setMetaTable(ref LuaTable meta) @trusted
in{ assert(this.state == meta.state); }
body
{
this.push();
meta.push();
lua_setmetatable(this.state, -2);
lua_pop(this.state, 1);
}
/**
* Get the metatable for this table.
* Returns:
* A reference to the metatable for this table. The reference is nil if this table has no metatable.
*/
LuaTable getMetaTable() @trusted
{
this.push();
scope(success) lua_pop(this.state, 1);
return lua_getmetatable(this.state, -1) == 0? LuaTable() : popValue!LuaTable(this.state);
}
/**
* Iterate over the values in this table.
*/
int opApply(T)(int delegate(ref T value) dg) @trusted
{
this.push();
lua_pushnil(this.state);
while(lua_next(this.state, -2) != 0)
{
auto value = popValue!T(this.state);
int result = dg(value);
if(result != 0)
{
lua_pop(this.state, 2);
return result;
}
}
lua_pop(this.state, 1);
return 0;
}
/**
* Iterate over the key-value pairs in this table.
*/
int opApply(T, U)(int delegate(ref U key, ref T value) dg) @trusted
{
this.push();
lua_pushnil(this.state);
while(lua_next(this.state, -2) != 0)
{
auto value = popValue!T(this.state);
auto key = getValue!U(this.state, -1);
int result = dg(key, value);
if(result != 0)
{
lua_pop(this.state, 2);
return result;
}
}
lua_pop(this.state, 1);
return 0;
}
}
unittest
{
lua_State* L = luaL_newstate();
scope(success)
{
assert(lua_gettop(L) == 0);
lua_close(L);
}
lua_newtable(L);
auto t = popValue!LuaTable(L);
assert(t.type == LuaType.Table);
t.set("foo", "bar");
assert(t.get!string("foo") == "bar");
t.set("foo", nil);
assert(t.get!LuaObject("foo").isNil);
t.set("foo", ["outer": ["inner": "hi!"]]);
auto s = t.get!(string)("foo", "outer", "inner");
assert(s == "hi!");
auto o = t["foo", "outer"];
assert(o.type == LuaType.Table);
t["foo", "outer", "inner"] = "hello!";
auto s2 = t.get!(string)("foo", "outer", "inner");
assert(s2 == "hello!");
// readString
t[2] = "two";
bool success = t.readString(2, (in char[] str) {
assert(str == "two");
});
assert(success);
t[2] = true;
success = t.readString(2, (in char[] str) { assert(false); });
assert(!success);
// metatable
pushValue(L, ["__index": (LuaObject self, string key){
return key;
}]);
auto meta = popValue!LuaTable(L);
lua_newtable(L);
auto t2 = popValue!LuaTable(L);
t2.setMetaTable(meta);
auto test = t2.get!string("foobar");
assert(test == "foobar");
assert(t2.getMetaTable() == meta);
// opApply
auto input = [1, 2, 3];
pushValue(L, input);
auto applyTest = popValue!LuaTable(L);
int i = 0;
foreach(int v; applyTest)
{
assert(input[i++] == v);
}
auto inputWithKeys = ["one": 1, "two": 2, "three": 3];
pushValue(L, inputWithKeys);
auto applyTestKeys = popValue!LuaTable(L);
foreach(string key, int value; applyTestKeys)
{
assert(inputWithKeys[key] == value);
}
}
|
D
|
module DryGame.ecs.ecswrapper;
import std.stdio;
import std.string;
import std.exception;
/*
import DryGame.ecs.libutil;
Library lib;
public void LoadECS()
{
UnloadECS();
writeln("Loading ECS Library...");
version(linux)
{
lib = enforce(loadLib("./libdryecs.so"));
}
version(Windows)
{
lib = enforce(loadLib("dryecs.dll"));
}
writeln("Done");
auto Init = lib.loadFunc!(void function(), "DryECS.systemshandler.Init");
Update = lib.loadFunc!(typeof(Update), "DryECS.systemshandler.Update");
CreateEntity = lib.loadFunc!(typeof(CreateEntity), "DryECS.systemshandler.CreateEntity");
writefln("Init = %X", Init);
writefln("Update = %X", Update);
writefln("CreateEntity = %X", CreateEntity);
Init();
import core.sys.windows.windows;
import std.string;
string msg = "fisk";
DWORD charsWritten;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), msg.toStringz(), cast(uint)msg.length, &charsWritten, null);
}
public void UnloadECS()
{
if (lib)
{
writeln("Unloading ECS Library...");
unloadLib(lib);
writeln("Done");
lib = null;
}
}
public void function(float) Update;
public size_t function(size_t) CreateEntity;
*/
import DryECS.systemshandler;
public void LoadECS()
{
DryECS.systemshandler.Init();
}
public void UnloadECS()
{
}
public void Update(float dt)
{
DryECS.systemshandler.Update(dt);
}
public size_t CreateEntity(size_t key)
{
return DryECS.systemshandler.CreateEntity(key);
}
|
D
|
module android.java.android.view.animation.GridLayoutAnimationController_AnimationParameters;
public import android.java.android.view.animation.GridLayoutAnimationController_AnimationParameters_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!GridLayoutAnimationController_AnimationParameters;
import import0 = android.java.java.lang.Class;
|
D
|
// REQUIRED_ARGS: -w
/*
TEST_OUTPUT:
---
fail_compilation/fail8724.d(14): Error: `object.Exception` is thrown but not caught
fail_compilation/fail8724.d(12): Error: `nothrow` constructor `fail8724.Foo.this` may throw
---
*/
struct Foo
{
this(int) nothrow
{
throw new Exception("something");
}
}
|
D
|
module game.core.chatarea;
/* This is typically never hidden.
* Only label and texttype are hidden while not typing.
* The chat console can be empty and we can be not typing, then we don't
* draw anything.
*/
import basics.user;
import file.language;
import graphic.color;
import gui;
class ChatArea : Element {
private:
Console _console;
Label _label;
Texttype _texttype;
RichClient _network; // not owned. May be null.
public:
this(Geom g, RichClient netw)
{
g.yl = 20f;
super(g);
_network = netw;
_label = new Label(new Geom(gui.thickg, 0,
50 - gui.thickg, 20, From.BOTTOM_LEFT));
_label.text = Lang.winLobbyChat.transl;
_label.undrawColor = color.transp;
_label.shown = false;
_texttype = new Texttype(new Geom(0, 0, xlg-50, 20, From.BOT_RIG));
_texttype.allowScrolling = true;
_texttype.undrawColor = color.transp;
_texttype.onEsc = () { _texttype.text = ""; };
_texttype.onEnter = () { this.maybeSendText; };
_texttype.shown = false;
_console = createConsole();
addChildren(_console, _label, _texttype);
if (_network) {
_network.console = _console;
_texttype.text = _network.unsentChat;
_network.unsentChat = "";
}
on = _texttype.text != "";
}
@property bool on() const { return _texttype.shown; }
void saveUnsentMessageAndDispose()
{
if (_network)
_network.unsentChat = on ? _texttype.text : "";
on = false;
assert (! hasFocus(_texttype), "on() = false didn't go through");
_network = null;
// We leave a reference to our console in _network, so that _network
// can later copy the lines. That's OK, the console is GC-allocated.
}
// To draw something else onto the console during game, e.g.
// announce that overtime has started. Leave it to the network to get
// lines out of the console and into the lobby console.
@property inout(Console) console() inout { return _console; }
protected:
override void calcSelf()
{
super.calcSelf();
if (keyChat.keyTapped && _network && ! on)
on = true;
on = _texttype.on;
}
@property bool on(in bool b)
{
if (on == b)
return b;
if (! b)
gui.requireCompleteRedraw(); // is this still necessary?
_label.shown = b;
_texttype.shown = b;
_texttype.on = b;
return b;
}
private:
auto createConsole()
{
return new class TransparentConsole {
this() { super(new Geom(0, 0, this.outer.geom.xlg, 0)); }
override void onLineChange()
{
super.onLineChange();
this.outer.resize(xlg, ylg + 20);
}
};
}
void maybeSendText()
{
if (_texttype.text != "" && _network !is null)
_network.sendChatMessage(_texttype.text);
_texttype.text = "";
}
}
|
D
|
#!/usr/bin/env rdmd-dev-module
/** Reference Counted Array.
See_Also: http://dpaste.dzfl.pl/817283c163f5
*/
module rcstring;
import core.memory : GC;
// import core.stdc.stdlib;
// import core.stdc.string;
// import std.algorithm;
/** Reference Counted (RC) version of string.
*/
alias RCString = RCXString!(immutable char);
/** Reference Counted Array.
Configured with character type `E`, maximum length for the small string optimization,
and the allocation function, which must have the same semantics as `realloc`.
See_Also: https://github.com/burner/std.rcstring
*/
struct RCXString(E = immutable char, size_t maxSmallSize = 23, alias realloc = GC.realloc)
{
pure nothrow:
// Preconditions
static assert(is(E == immutable), "Only immutable characters supported for now.");
static assert(E.alignof <= 4, "Character type must be 32-bit aligned at most.");
static assert(E.min == 0, "Character type must be unsigned.");
static assert((maxSmallSize + 1) * E.sizeof % size_t.sizeof == 0,
"maxSmallSize + 1 must be a multiple of size_t.sizeof.");
static assert((maxSmallSize + 1) * E.sizeof >= 3 * size_t.sizeof,
"maxSmallSize + 1 must be >= size_t.sizeof * 3.");
static assert(maxSmallSize < E.max, "maxSmallSize must be less than E.max");
enum maxSmallLength = maxSmallSize;
private:
// import std.utf;
import std.conv : emplace;
import std.traits: isSomeChar, Unqual;
version(unittest) import std.stdio;
alias ME = Unqual!E; // mutable E
enum isString = isSomeChar!E;
// Simple reference-counted buffer. The reference count itself is a E. Layout is a size_t (the capacity)
// followed by the reference count followed by the payload.
struct RCBuffer
{
size_t capacity;
uint refCount;
// Data starts right after the refcount, no padding because of the static assert above
ME* mptr() @nogc { return cast(ME*) (&refCount + 1); }
E* ptr() @nogc { return cast(E*) mptr; }
// Create a new buffer given capacity and initializes payload. Capacity must be large enough.
static RCBuffer* make(size_t capacity, const(ME)[] content)
{
assert(capacity >= content.length);
auto result = cast(RCBuffer*) realloc(null, size_t.sizeof + uint.sizeof + capacity * E.sizeof);
result || assert(0);
result.capacity = capacity;
result.refCount = 1;
result.mptr[0 .. content.length] = content;
return result;
}
// Resize the buffer. It is assumed the reference count is 1.
static void resize(ref RCBuffer* p, size_t capacity)
{
assert(p.refCount == 1);
p = cast(RCBuffer*) realloc(p, size_t.sizeof + uint.sizeof + capacity * E.sizeof);
p || assert(0);
p.capacity = capacity;
}
unittest
{
auto p = make(101, null);
assert(p.refCount == 1);
assert(p.capacity == 101);
resize(p, 203);
assert(p.refCount == 1);
assert(p.capacity == 203);
realloc(p, 0);
}
}
// Hosts a large string
struct Large
{
// <layout>
union
{
immutable RCBuffer* buf;
RCBuffer* mbuf;
}
union
{
E* ptr;
ME* mptr;
}
static if ((maxSmallSize + 1) * E.sizeof == 3 * size_t.sizeof)
{
/* The small buffer and the large buffer overlap. This means the large buffer must give up its last byte
* as a discriminator.
*/
size_t _length;
enum maxLarge = size_t.max >> (8 * E.sizeof);
version(BigEndian)
{
// Use the LSB to store the marker
size_t length() const @safe @nogc { return _length >> 8 * E.sizeof; }
void length(size_t s) @safe @nogc { _length = Marker.isRefCounted | (s << (8 * E.sizeof)); }
}
else version(LittleEndian)
{
// Use the MSB to store the marker
private enum size_t mask = size_t(E.max) << (8 * (size_t.sizeof - E.sizeof));
size_t length() const @safe @nogc { return _length & ~mask; }
void length(size_t s) @safe @nogc { assert(s <= maxLarge); _length = s | mask; }
}
else
{
static assert(0, "Unspecified endianness.");
}
}
else
{
// No tricks needed, store the size plainly
size_t _length;
size_t length() const @safe @nogc
{
return _length;
}
void length(size_t s) @safe @nogc
{
_length = s;
}
}
// </layout>
// Get length
alias opDollar = length;
// Initializes a Large given capacity and content. Capacity must be at least as large as content's size.
this(size_t capacity, const(ME)[] content)
{
assert(capacity >= content.length);
mbuf = RCBuffer.make(capacity, content);
mptr = mbuf.mptr;
length = content.length;
}
// Initializes a Large from a string by copying it.
this(const(ME)[] s)
{
this(s.length, s);
}
static if (isString) unittest
{
const(ME)[] s1 = "hello, world";
auto lrg1 = Large(s1);
assert(lrg1.length == 12);
immutable lrg2 = immutable Large(s1);
assert(lrg2.length == 12);
const lrg3 = const Large(s1);
assert(lrg3.length == 12);
}
// Initializes a Large from a static string by referring to it.
this(immutable(ME)[] s)
{
assert(buf is null);
ptr = s.ptr;
length = s.length;
}
static if (isString) unittest
{
immutable ME[] s = "abcdef";
auto lrg1 = Large(s);
assert(lrg1.length == 6);
assert(lrg1.buf is null);
}
// Decrements the reference count and frees buf if it goes down to zero.
void decRef() nothrow
{
if (!mbuf) return;
if (mbuf.refCount == 1) realloc(mbuf, 0);
else --mbuf.refCount;
}
auto opSlice() inout return
{
assert(ptr);
return ptr[0 .. length];
}
// Makes sure there's room for at least newCap Chars.
void reserve(size_t newCap)
{
if (mbuf && mbuf.refCount == 1 && mbuf.capacity >= newCap) return;
immutable size = this.length;
version(assert) scope(exit) assert(size == this.length);
if (!mbuf)
{
// Migrate from static string to allocated string
mbuf = RCBuffer.make(newCap, ptr[0 .. size]);
ptr = mbuf.ptr;
return;
}
if (mbuf.refCount > 1)
{
// Split this guy making its buffer unique
--mbuf.refCount;
mbuf = RCBuffer.make(newCap, ptr[0 .. size]);
ptr = mbuf.ptr;
// size stays untouched
}
else
{
immutable offset = ptr - mbuf.ptr;
// If offset is too large, it's worth decRef()ing and then allocating a new buffer
if (offset * 2 >= newCap)
{
auto newBuf = RCBuffer.make(newCap, ptr[0 .. size]);
decRef;
mbuf = newBuf;
ptr = mbuf.ptr;
}
else
{
RCBuffer.resize(mbuf, newCap);
ptr = mbuf.ptr + offset;
}
}
}
unittest
{
Large obj;
obj.reserve(1);
assert(obj.mbuf !is null);
assert(obj.mbuf.capacity >= 1);
obj.reserve(1000);
assert(obj.mbuf.capacity >= 1000);
obj.reserve(10000);
assert(obj.mbuf.capacity >= 10000);
}
}
// <layout>
union
{
Large large;
struct
{
union
{
E[maxSmallSize] small;
ME[maxSmallSize] msmall;
}
ME smallLength;
}
size_t[(maxSmallSize + 1) / size_t.sizeof] ancillary; // used internally
}
// </layout>
size_t toHash() const @trusted
{
import core.internal.hash : hashOf;
return this.asSlice.hashOf;
}
static if (isString) unittest
{
assert(RCXString("a").toHash ==
RCXString("a").toHash);
assert(RCXString("a").toHash !=
RCXString("b").toHash);
assert(RCXString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").toHash ==
RCXString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").toHash);
assert(RCXString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").toHash !=
RCXString("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb").toHash);
}
static if (isString) unittest
{
RCXString x;
assert(x.smallLength == 0);
assert(x.length == 0);
x.large.length = 133;
assert(x.smallLength == E.max);
assert(x.large.length == 133);
x.large.length = 0x0088_8888_8888_8888;
assert(x.large.length == 0x0088_8888_8888_8888);
assert(x.smallLength == E.max);
}
// is this string small?
bool isSmall() const @safe @nogc
{
return smallLength <= maxSmallSize;
}
// release all memory associated with this
private void decRef()
{
if (!isSmall) large.decRef;
}
// Return a slice with the string's contents
// Not public because it leaks the internals
auto asSlice() inout @nogc
{
immutable s = smallLength;
if (s <= maxSmallSize) return small.ptr[0 .. s];
return large[];
}
public:
/// Returns the length of the string
size_t length() const @nogc
{
immutable s = smallLength;
return s <= maxSmallSize ? s : large.length;
}
/// Ditto
alias opDollar = length;
static if (isString) unittest
{
auto s1 = RCXString("123456789_");
assert(s1.length == 10);
s1 ~= RCXString("123456789_123456789_123456789_123456789_12345");
assert(s1.length == 55);
}
/// Needed for correct printing in other modules
static if (isString)
{
string toArray() const @trusted
{
return this.asSlice;
}
}
/** Construct a `RCXString` from a slice `s`.
If the slice is immutable, assumes the slice is a literal or
GC-allocated and does NOT copy it internally.
Warning: Subsequently deallocating `s` will cause the `RCXString`
to dangle. If the slice has `const` or mutable characters, creates
and manages a copy internally.
*/
this(C)(C[] s)
if (is(Unqual!C == ME))
{
// Contents is immutable, we may assume it won't go away ever
if (s.length <= maxSmallSize)
{
// fits in small
small[0 .. s.length] = s[]; // so copy it
smallLength = cast(E)s.length;
}
else
{
emplace(&large, s);
}
}
// Test construction from immutable(ME)[], const(ME)[], and ME[]
static if (isString) unittest
{
immutable(E)[] a = "123456789_";
auto s1 = RCXString(a);
assert(s1 == a);
assert(s1.asSlice !is a, "Small strings must be copied");
a = "123456789_123456789_123456789_123456789_";
auto s2 = RCXString(a);
assert(s2 == a);
assert(s2.asSlice is a, "Large immutable strings shall not be copied");
const(char)[] b = "123456789_";
auto s3 = RCXString(b);
assert(s3 == b);
assert(s3.isSmall, "Small strings must be copied");
b = "123456789_123456789_123456789_123456789_";
auto s4 = RCXString(b);
assert(s4 == b);
assert(s4.asSlice !is b, "Large non-immutable strings shall be copied");
char[] c = "123456789_".dup;
auto s5 = RCXString(c);
assert(s5 == c);
assert(s5.isSmall, "Small strings must be copied");
c = "123456789_123456789_123456789_123456789_".dup;
auto s6 = RCXString(c);
assert(s6 == c);
assert(s6.asSlice !is c, "Large non-immutable strings shall be copied");
}
static if (isString) unittest
{
const(ME)[] s = "123456789_123456789_123456789_123456789_";
auto s1 = RCXString(s);
assert(s1.large.mbuf);
auto s2 = s1;
assert(s1.large.mbuf is s2.large.mbuf);
assert(s1.large.mbuf.refCount == 2);
s1 = s ~ "123";
assert(s1.large.mbuf.refCount == 1);
assert(s2.large.mbuf.refCount == 1);
assert(s2 == s);
assert(s1 == s ~ "123");
const s3 = s1;
assert(s1.large.mbuf.refCount == 2);
immutable s4 = s1;
//immutable s5 = s3;
assert(s1.large.mbuf.refCount == 3);
}
// Postblit
this(this) @nogc
{
if (!isSmall && large.mbuf) ++large.mbuf.refCount;
}
// Dtor decrements refcount and may deallocate
~this()
{
decRef;
}
// Assigns another string
void opAssign(immutable(ME)[] s)
{
decRef;
// Contents is immutable, we may assume it won't go away ever
emplace(&this, s);
}
static if (isString) unittest
{
immutable(ME)[] s = "123456789_";
RCXString rcs;
rcs = s;
assert(rcs.isSmall);
s = "123456789_123456789_123456789_123456789_";
rcs = s;
assert(!rcs.isSmall);
assert(rcs.large.mbuf is null);
}
// Assigns another string
void opAssign(const(ME)[] s)
{
if (capacity >= s.length)
{
// Noice, there's room
if (s.length <= maxSmallSize)
{
// Fits in small
msmall[0 .. s.length] = s[];
smallLength = cast(E) s.length;
}
else
{
// Large it is
assert(!isSmall);
large.mptr[0 .. s.length] = s;
large.length = s.length;
}
}
else
{
// Tear down and rebuild
decRef;
emplace(&this, s);
}
}
static if (isString) unittest
{
const(ME)[] s = "123456789_123456789_123456789_123456789_";
RCXString s1;
s1 = s;
assert(!s1.isSmall && s1.large.buf !is null);
auto p = s1.ptr;
s1 = s;
assert(s1.ptr is p, "Wasteful reallocation");
RCXString s2;
s2 = s1;
assert(s1.large.mbuf is s2.large.mbuf);
assert(s1.large.mbuf.refCount == 2);
s1 = "123456789_123456789_123456789_123456789_123456789_";
assert(s1.large.mbuf !is s2.large.mbuf);
assert(s1.large.mbuf is null);
assert(s2.large.mbuf.refCount == 1);
assert(s1 == "123456789_123456789_123456789_123456789_123456789_");
assert(s2 == "123456789_123456789_123456789_123456789_");
}
bool opEquals(const(ME)[] s) const @nogc
{
if (isSmall) return s.length == smallLength && small[0 .. s.length] == s;
return large[] == s;
}
bool opEquals(in RCXString s) const
{
return this == s.asSlice;
}
static if (isString) unittest
{
const s1 = RCXString("123456789_123456789_123456789_123456789_123456789_");
RCXString s2 = s1[0 .. 10];
auto s3 = RCXString("123456789_");
assert(s2 == s3);
}
/** Returns the maximum number of character this string can store without
requesting more memory.
*/
size_t capacity() const @nogc
{
/** This is subtle: if large.mbuf is null (i.e. the string had been constructed from a literal), then the
capacity is maxSmallSize because that's what we can store without a memory (re)allocation. Same if refCount is
greater than 1 - we can't reuse the memory.
*/
return isSmall || !large.mbuf || large.mbuf.refCount > 1 ? maxSmallSize : large.mbuf.capacity;
}
static if (isString) unittest
{
auto s = RCXString("abc");
assert(s.capacity == maxSmallSize);
s = "123456789_123456789_123456789_123456789_123456789_";
assert(s.capacity == maxSmallSize);
const char[] lit = "123456789_123456789_123456789_123456789_123456789_";
s = lit;
assert(s.capacity >= 50);
}
void reserve(size_t capacity)
{
if (isSmall)
{
if (capacity <= maxSmallSize)
{
// stays small
return;
}
// small to large
immutable length = smallLength;
auto newLayout = Large(capacity, small.ptr[0 .. length]);
large = newLayout;
}
else
{
// large to large
if (large.mbuf && large.mbuf.capacity >= capacity) return;
large.reserve(capacity);
}
}
static if (isString) unittest
{
RCXString s1;
s1.reserve(1);
assert(s1.capacity >= 1);
s1.reserve(1023);
assert(s1.capacity >= 1023);
s1.reserve(10230);
assert(s1.capacity >= 10230);
}
/** Appends `s` to `this`.
*/
void opOpAssign(string s : "~")(const(ME)[] s)
{
immutable length = this.length;
immutable newLen = length + s.length;
if (isSmall)
{
if (newLen <= maxSmallSize)
{
// stays small
msmall[length .. newLen] = s;
smallLength = cast(E) newLen;
}
else
{
// small to large
auto newLayout = Large(newLen, small.ptr[0 .. length]);
newLayout.mptr[length .. newLen][] = s;
newLayout.length = newLen;
large = newLayout;
assert(!isSmall);
assert(this.length == newLen);
}
}
else
{
// large to large
large.reserve(newLen);
large.mptr[length .. newLen][] = s;
large.length = newLen;
}
}
static if (isString) unittest
{
auto s1 = RCXString("123456789_123456789_123456789_123456789_");
s1 ~= s1;
assert(s1 == "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_");
foreach (i; 0 .. 70) s1.popFront();
assert(s1 == "123456789_");
s1 ~= "abc";
assert(s1 == "123456789_abc");
}
/// Ditto
void opOpAssign(string s : "~")(const auto ref RCXString s)
{
this ~= s.asSlice;
}
static if (isString) unittest
{
RCXString s1;
s1 = "hello";
assert(s1 == "hello");
s1 ~= ", world! ";
assert(s1 == "hello, world! ");
s1 ~= s1;
assert(s1 == "hello, world! hello, world! ");
s1 ~= s1;
assert(s1 == "hello, world! hello, world! hello, world! hello, world! ");
auto s2 = RCXString("yah! ");
assert(s2 == "yah! ");
s2 ~= s1;
assert(s2 == "yah! hello, world! hello, world! hello, world! hello, world! ");
s2 = "123456789_123456789_123456789_123456789_";
s2 ~= s2;
assert(s2 == "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_");
auto s3 = s2;
assert(s3.large.mbuf.refCount == 2);
s2 ~= "123456789_";
assert(s2.large.mbuf.refCount == 1);
assert(s3.large.mbuf.refCount == 1);
assert(s3 == "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_");
s2 = "123456789_123456789_123456789_123456789_";
const s4 = RCXString(", world");
s2 ~= s4;
assert(s2 == "123456789_123456789_123456789_123456789_, world");
s2 ~= const RCXString("!!!");
assert(s2 == "123456789_123456789_123456789_123456789_, world!!!");
}
/// Returns `true` iff `this` is empty
bool empty() const @nogc
{
return !length;
}
static if (isString)
{
private dchar unsafeDecode(const(ME)* p) const @nogc
{
byte c = *p;
dchar res = c & 0b0111_1111;
if (c >= 0) return res;
assert(c < 0b1111_1000);
dchar cover = 0b1000_0000;
c <<= 1;
assert(c < 0);
do
{
++p;
assert((*p >> 6) == 0b10);
cover <<= 5;
res = (res << 6) ^ *p ^ cover ^ 0b1000_0000;
c <<= 1;
} while(c < 0);
return res;
}
}
/// Returns the first code point of `this`.
auto front() const @nogc
{
assert(!empty);
// TODO: make safe
static if (isString)
{
return unsafeDecode(ptr);
}
else
{
return ptr[0];
}
}
/// Returns the last code point of `this`.
static if (isString)
{
dchar back() const @nogc
{
assert(!empty);
auto p = ptr + length - 1;
if (*p < 0b1000_0000) return *p;
// TODO: make safe
do
{
--p;
} while (!(*p & 0b0100_0000));
return unsafeDecode(p);
}
}
else
{
E back() const @nogc
{
return ptr[length - 1];
}
}
/// Returns the `n`th code unit in `this`.
E opIndex(size_t n) const @nogc
{
assert(n < length);
return ptr[n];
}
static if (isString) unittest
{
auto s1 = RCXString("hello");
assert(s1.front == 'h');
assert(s1[1] == 'e');
assert(s1.back == 'o');
assert(s1[$ - 1] == 'o');
s1 = RCXString("Ü");
assert(s1.length == 2);
assert(s1.front == 'Ü');
assert(s1.back == 'Ü');
}
/// Discards the first code point
void popFront() @nogc
{
assert(!empty && ptr);
uint toPop = 1;
auto b = *ptr;
if (b >= 0b1000_0000)
{
toPop = (b | 0b0010_0000) != b ? 2
: (b | 0b0001_0000) != b ? 3
: 4;
}
if (isSmall)
{
// Must shuffle in place
// TODO: make faster
foreach (i; 0 .. length - toPop)
{
msmall[i] = small[i + toPop];
}
smallLength -= toPop;
}
else
{
large.ptr += toPop;
large.length = large.length - toPop;
}
}
static if (isString) unittest
{
auto s1 = RCXString("123456789_");
auto s2 = s1;
s1.popFront();
assert(s1 == "23456789_");
assert(s2 == "123456789_");
s1 = RCXString("123456789_123456789_123456789_123456789_");
s2 = s1;
s1.popFront();
assert(s1 == "23456789_123456789_123456789_123456789_");
assert(s2 == "123456789_123456789_123456789_123456789_");
s1 = "öü";
s2 = s1;
s1.popFront();
assert(s1 == "ü");
assert(s2 == "öü");
}
/// Discards the last code point
void popBack() @nogc
{
assert(!empty && ptr);
auto p = ptr + length - 1;
if (*p < 0b1000_0000)
{
// hot path
if (isSmall) --smallLength;
else large.length = large.length - 1;
return;
}
// TODO: make safe
auto p1 = p;
do
{
--p;
} while (!(*p & 0b0100_0000));
immutable diff = p1 - p + 1;
assert(diff > 1 && diff <= length);
if (isSmall) smallLength -= diff;
else large.length = large.length - diff;
}
static if (isString) unittest
{
auto s1 = RCXString("123456789_");
auto s2 = s1;
s1.popBack;
assert(s1 == "123456789");
assert(s2 == "123456789_");
s1 = RCXString("123456789_123456789_123456789_123456789_");
s2 = s1;
s1.popBack;
assert(s1 == "123456789_123456789_123456789_123456789");
assert(s2 == "123456789_123456789_123456789_123456789_");
s1 = "öü";
s2 = s1;
s1.popBack;
assert(s1 == "ö");
assert(s2 == "öü");
}
/// Returns a slice to the entire string or a portion of it.
auto opSlice() inout @nogc
{
return this;
}
/// Ditto
auto opSlice(size_t b, size_t e) inout
{
assert(b <= e && e <= length);
auto ptr = this.ptr;
auto sz = e - b;
if (sz <= maxSmallSize)
{
// result is small
RCXString result = void;
result.msmall[0 .. sz] = ptr[b .. e];
result.smallLength = cast(E) sz;
return result;
}
assert(!isSmall);
RCXString result = this;
result.large.ptr += b;
result.large.length = e - b;
return result;
}
static if (isString) unittest
{
immutable s = RCXString("123456789_123456789_123456789_123456789");
RCXString s1 = s[0 .. 38];
assert(!s1.isSmall && s1.large.buf is null);
}
// Unsafe! Returns a pointer to the beginning of the payload.
auto ptr() inout @nogc
{
return isSmall ? small.ptr : large.ptr;
}
static if (isString) unittest
{
auto s1 = RCXString("hello");
auto s2 = s1[1 .. $ - 1];
assert(s2 == "ell");
s1 = "123456789_123456789_123456789_123456789_";
s2 = s1[1 .. $ - 1];
assert(s2 == "23456789_123456789_123456789_123456789");
}
/// Returns the concatenation of `this` with `s`.
RCXString opBinary(string s = "~")(const auto ref RCXString s) const
{
return this ~ s.asSlice;
}
/// Ditto
RCXString opBinary(string s = "~")(const(ME)[] s) const
{
immutable length = this.length;
auto resultLen = length + s.length;
RCXString result = void;
if (resultLen <= maxSmallSize)
{
// noice
result.msmall.ptr[0 .. length] = ptr[0 .. length];
result.msmall.ptr[length .. resultLen] = s[];
result.smallLength = cast(E) resultLen;
return result;
}
emplace(&result.large, resultLen, this.asSlice);
result ~= s;
return result;
}
/// Returns the concatenation of `s` with `this`.
RCXString opBinaryRight(string s = "~")(const(E)[] s) const
{
immutable length = this.length, resultLen = length + s.length;
RCXString result = void;
if (resultLen <= maxSmallSize)
{
// noice
result.msmall.ptr[0 .. s.length] = s[];
result.msmall.ptr[s.length .. resultLen] = small.ptr[0 .. length];
result.smallLength = cast(E) resultLen;
return result;
}
emplace(&result.large, resultLen, s);
result ~= this;
return result;
}
static if (isString) unittest
{
auto s1 = RCXString("hello");
auto s2 = s1 ~ ", world!";
assert(s2 == "hello, world!");
s1 = "123456789_123456789_123456789_123456789_";
s2 = s1 ~ "abcdefghi_";
assert(s2 == "123456789_123456789_123456789_123456789_abcdefghi_");
s2 = s1 ~ s1;
assert(s2 == "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_");
s2 = "abcdefghi_" ~ s1;
assert(s2 == "abcdefghi_123456789_123456789_123456789_123456789_");
}
}
unittest
{
alias RCI = RCXString!(immutable uint);
RCI x;
}
/// verify UTF-8 storage
unittest
{
string s = "åäö";
RCString rcs = s;
assert(rcs.length == 6);
import std.algorithm : count;
assert(rcs.count == 3);
assert(rcs.front == 'å');
rcs.popFront();
assert(rcs.front == 'ä');
rcs.popFront();
assert(rcs.front == 'ö');
rcs.popFront();
assert(rcs.empty);
}
version = profile;
/// shows performance increase for SSO over built-in string
version(profile) unittest
{
enum maxSmallSize = 23;
alias S = RCXString!(immutable char, maxSmallSize);
import std.datetime: StopWatch, Duration;
import std.conv : to;
import std.stdio;
enum n = 2^^21;
StopWatch sw;
sw.reset;
sw.start;
char[maxSmallSize] ss;
foreach (i; 0 .. n)
{
auto x = S(ss);
}
sw.stop;
auto timeRCString = sw.peek().msecs;
writeln("> RCString took ", sw.peek().to!Duration);
sw.reset;
sw.start;
foreach (i; 0 .. n)
{
string x = ss.idup;
}
sw.stop;
auto timeString = sw.peek().msecs;
writeln("> Builtin string took ", sw.peek().to!Duration);
writeln("> Speedup: ", timeString/timeRCString);
}
|
D
|
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/SQLUpdateBuilder.swift.o : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoinMethod.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSerializable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDelete.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDefaultLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoin.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKeyAction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDirection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnDefinition.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDeleteBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsertBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLRawBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndexBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryFetcher.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIndexModifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDistinct.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunctionArgument.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLGroupBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLOrderBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/SQLUpdateBuilder~partial.swiftmodule : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoinMethod.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSerializable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDelete.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDefaultLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoin.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKeyAction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDirection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnDefinition.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDeleteBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsertBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLRawBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndexBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryFetcher.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIndexModifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDistinct.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunctionArgument.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLGroupBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLOrderBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/SQLUpdateBuilder~partial.swiftdoc : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoinMethod.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSerializable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDelete.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDefaultLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoin.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKeyAction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDirection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnDefinition.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDeleteBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsertBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLRawBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndexBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryFetcher.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIndexModifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDistinct.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunctionArgument.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLGroupBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLOrderBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/SQLUpdateBuilder~partial.swiftsourceinfo : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoinMethod.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSerializable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDelete.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDefaultLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLJoin.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectExpression.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKeyAction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDirection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnDefinition.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLAlterTableBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLUpdateBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDeleteBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelectBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsertBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLRawBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndexBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryBuilder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQueryFetcher.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIndexModifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnIdentifier.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLSelect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDistinct.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLFunctionArgument.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLTableConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLColumnConstraint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLCreateIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLGroupBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLOrderBy.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLForeignKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/sql/Sources/SQL/SQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
/Users/lilinbo/Documents/origin/rust/coding-dojo-rust-001/target/debug/deps/coding_dojo_rust_001-3c2f1fb9aa7af8e4: src/main.rs
/Users/lilinbo/Documents/origin/rust/coding-dojo-rust-001/target/debug/deps/coding_dojo_rust_001-3c2f1fb9aa7af8e4.d: src/main.rs
src/main.rs:
|
D
|
/**
* Copyright: Copyright (c) 2011 Jacob Carlborg. All rights reserved.
* Authors: Jacob Carlborg
* Version: Initial created: Oct 1, 2011
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
*/
module dstep.core.Exceptions;
class DStepException : Exception
{
this (string message, string file = __FILE__, size_t line = __LINE__)
{
super(message, file, line);
}
}
|
D
|
/**
* This module crawl the AST to resolve identifiers and process types.
*/
module d.semantic.semantic;
public import util.visitor;
import d.semantic.dmodule;
import d.semantic.evaluator;
import d.semantic.scheduler;
import d.ast.base;
import d.ast.declaration;
import d.ast.dmodule;
import d.ast.expression;
import d.ast.statement;
import d.ast.type;
import d.ir.expression;
import d.ir.dscope;
import d.ir.statement;
import d.ir.symbol;
import d.ir.type;
import d.parser.base;
import d.context;
import d.exception;
import d.lexer;
import d.location;
import d.object;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.range;
alias AstModule = d.ast.dmodule.Module;
alias Module = d.ir.symbol.Module;
alias FunctionType = d.ir.type.FunctionType;
alias CallExpression = d.ir.expression.CallExpression;
alias BlockStatement = d.ir.statement.BlockStatement;
alias ExpressionStatement = d.ir.statement.ExpressionStatement;
alias ReturnStatement = d.ir.statement.ReturnStatement;
final class SemanticPass {
private ModuleVisitor moduleVisitor;
Context context;
Evaluator evaluator;
ObjectReference object;
//Name[] versions = [BuiltinName!"SDC", BuiltinName!"D_LP64"];
Name[] versions = [BuiltinName!"SDC"];
static struct State {
Scope currentScope;
ParamType returnType;
ParamType thisType;
ContextType ctxType;
string manglePrefix;
mixin(bitfields!(
bool, "buildErrorNode", 1,
uint, "", 7,
));
uint fieldIndex;
uint methodIndex;
}
State state;
alias state this;
Scheduler scheduler;
alias Step = d.ir.symbol.Step;
this(Context context, Source delegate(Name[]) sourceFactory, string[] versions=[], Evaluator evaluator = null) {
this.context = context;
moduleVisitor = new ModuleVisitor(this, sourceFactory);
scheduler = new Scheduler(this);
foreach(ver;versions) {
this.versions ~= context.getName(ver);
}
auto obj = importModule([BuiltinName!"object"]);
object = new ObjectReference(obj);
scheduler.require(obj, Step.Populated);
}
void setEvaluator(Evaluator evaluator) {
assert(this.evaluator is null,"evaluator is a singleton can't be set twice!");
this.evaluator = evaluator;
}
AstModule parse(S)(S source, Name[] packages) if(is(S : Source)) {
auto trange = lex!((line, index, length) => Location(source, line, index, length))(source.content, context);
return trange.parse(packages[$ - 1], packages[0 .. $-1]);
}
Module add(Source source, Name[] packages) {
auto astm = parse(source, packages);
auto mod = moduleVisitor.modulize(astm);
moduleVisitor.preregister(mod);
scheduler.schedule(astm, mod);
return mod;
}
void terminate() {
scheduler.terminate();
}
auto evaluate(Expression e) {
return evaluator.evaluate(e);
}
auto importModule(Name[] pkgs) {
return moduleVisitor.importModule(pkgs);
}
auto raiseCondition(T)(Location location, string message) {
if(buildErrorNode) {
static if(is(T == Type)) {
return QualType(new ErrorType(location, message));
} else static if(is(T == Expression) || is(T == CompileTimeExpression)) {
return new ErrorExpression(location, message);
} else static if(is(T == Symbol)) {
return new ErrorSymbol(location, message);
} else {
static assert(false, "compilationCondition only works for Types and Expressions.");
}
} else {
throw new CompileException(location, message);
}
}
Function buildMain(Module[] mods) {
auto candidates = mods.map!(m => m.members).joiner.map!((s) {
if(auto fun = cast(Function) s) {
if(fun.name == BuiltinName!"main") {
return fun;
}
}
return null;
}).filter!(s => !!s).array();
assert(candidates.length < 2, "Several main functions");
assert(candidates.length == 1, "No main function");
auto main = candidates[0];
auto location = main.fbody.location;
auto type = main.type;
auto returnType = cast(BuiltinType) type.returnType.type;
import std.array;
import d.semantic.expression;
auto params = main.params.map!(p => new ParameterExpression(p.location,p)).array;
auto pTypes = main.params.map!(p => p.type).array;
auto call = new CallExpression(location, QualType(returnType), new FunctionExpression(location, main), cast (Expression[]) params);
Statement[] fbody;
if(returnType && returnType.kind == TypeKind.Void) {
fbody ~= new ExpressionStatement(call);
fbody ~= new ReturnStatement(location, new IntegerLiteral!true(location, 0, TypeKind.Int));
} else {
fbody ~= new ReturnStatement(location, call);
}
type = new FunctionType(Linkage.C, ParamType(getBuiltin(TypeKind.Int), false), pTypes, false);
auto bootstrap = new Function(main.location, type, BuiltinName!"_Dmain", main.params, new BlockStatement(location, fbody));
bootstrap.storage = Storage.Enum;
bootstrap.visibility = Visibility.Public;
bootstrap.step = Step.Processed;
bootstrap.mangle = "_Dmain";
return bootstrap;
}
}
|
D
|
ï;
|
D
|
module io.stream.Delimiters;
private import io.stream.Iterator;
class Разграничители(T) : Обходчик!(T)
{
private T[] разделитель;
this (T[] разделитель, ИПотокВвода поток = пусто)
{
this.разделитель = разделитель;
super (поток);
}
protected т_мера скан (проц[] данные);
}
debug(UnitTest)
{
private import io.device.Array;
unittest
{
auto p = new Разграничители!(сим) (", ", new Массив("blah"));
}
}
|
D
|
/Users/benjaminrees/Desktop/Rust/Section 2/guessing_game/target/debug/deps/guessing_game-157173a31b2d695f.rmeta: src/main.rs
/Users/benjaminrees/Desktop/Rust/Section 2/guessing_game/target/debug/deps/guessing_game-157173a31b2d695f.d: src/main.rs
src/main.rs:
|
D
|
/**
* Handle a user connection
*/
module chat.UserHandler;
import net.server.handler.model.ISendReceiveHandler;
import std.socket;
import std.stdio;
/**
* User handler class
*/
class UserHandler : ISendReceiveHandler
{
/**
* The received message
*/
private string msg;
/**
* The user address
*/
private string address;
/**
* onConnect implementation
*/
override protected void onConnect ( Socket client )
{
this.address = client.remoteAddress().toString();
writefln("Accepted connection from %s", this.address);
}
/**
* onClose implementation
*/
override protected void onClose ( )
{
writefln("Connection closed: %s", this.address);
}
/**
* onReceive implementation
*/
override protected void onReceive ( string msg )
{
writefln("%s received: %s", this.toString(), msg);
this.msg = msg;
}
/**
* onSend implementation
*/
override protected string onSend ( )
{
writefln("%s response: %s", this.toString(), this.msg);
return this.msg;
}
/**
* toString implementation
*/
override public string toString ( )
{
return this.address;
}
}
|
D
|
/******************************************************************************
* Sub-module for numeric.sekitk.qvm
*
* Authors: 新井 浩平 (Kohei ARAI), arai-kohei-xg@ynu.jp
* Version: 1.0
******************************************************************************/
module sekitk.qvm.quaternion;
import std.traits: isFloatingPoint;
mixin template QuaternionImpl(T, T Threshold)
if(isFloatingPoint!T){
import sekitk.qvm.common: TypeOfSize;
import sekitk.qvm.impl.vectorbase;
/************************************************************
* Quaternion type
************************************************************/
struct Quaternion{
mixin(VECTOR_BASE_IMPL);
private:
enum TypeOfSize Size= 4u;
public:
// constructors
@safe pure nothrow @nogc{
/****************************************
* Initialize with each elements
*
* Params:
* w= scalar part
* x= coefficient of base i
* y= coefficient of base j
* z= coefficient of base k
****************************************/
this(in T w, in T x, in T y, in T z){
this._cmpn[0]= w;
this._cmpn[1]= x;
this._cmpn[2]= y;
this._cmpn[3]= z;
}
/****************************************
* Initialize by a scalar and a vector
*
* Params:
* w= scalar part
* vec= vector part
****************************************/
this(in T w, in Vector!3u vec){
this._cmpn[0]= w;
this._cmpn[1]= vec._cmpn[0];
this._cmpn[2]= vec._cmpn[1];
this._cmpn[3]= vec._cmpn[2];
}
}
// Operators & reserved methods
@safe pure nothrow @nogc{
/// quaternion *= quaternion or quaternion /= quaternion
void opOpAssign(string Op)(in TypeOfThis rhs)
if(Op == "*" || Op = "/"){
this= this.opBinary!Op(rhs);
}
/// Hamilton product
TypeOfThis opBinary(string Op: "*")(in TypeOfThis rhs) const{
T[4] num= void;
num[0]= this._cmpn[0]*rhs._cmpn[0]
-this._cmpn[1]*rhs._cmpn[1]
-this._cmpn[2]*rhs._cmpn[2]
-this._cmpn[3]*rhs._cmpn[3];
num[1]= this._cmpn[0]*rhs._cmpn[1]
+this._cmpn[1]*rhs._cmpn[0]
+this._cmpn[2]*rhs._cmpn[3]
-this._cmpn[3]*rhs._cmpn[2];
num[2]= this._cmpn[0]*rhs._cmpn[2]
-this._cmpn[1]*rhs._cmpn[3]
+this._cmpn[2]*rhs._cmpn[0]
+this._cmpn[3]*rhs._cmpn[1];
num[3]= this._cmpn[0]*rhs._cmpn[3]
+this._cmpn[1]*rhs._cmpn[2]
-this._cmpn[2]*rhs._cmpn[1]
+this._cmpn[3]*rhs._cmpn[0];
return typeof(return)(num);
}
/// quaternion / quaternion
TypeOfThis opBinary(string Op: "/")(in TypeOfThis rhs) const{
T[4] num= void;
T k= rhs.norm;
num[0]= this.dotProdImpl(rhs);
num[1]= rhs._cmpn[0]*this._cmpn[1]
-rhs._cmpn[1]*this._cmpn[0]
-rhs._cmpn[2]*this._cmpn[3]
+rhs._cmpn[3]*this._cmpn[2];
num[2]= rhs._cmpn[0]*this._cmpn[2]
+rhs._cmpn[1]*this._cmpn[3]
-rhs._cmpn[2]*this._cmpn[0]
-rhs._cmpn[3]*this._cmpn[1];
num[3]= rhs._cmpn[0]*this._cmpn[3]
-rhs._cmpn[1]*this._cmpn[2]
+rhs._cmpn[2]*this._cmpn[1]
-rhs._cmpn[3]*this._cmpn[0];
foreach(ref elm; num) elm /= k;
return typeof(return)(num);
}
}
// Reserved methods
@safe const{
/****************************************
* convert to string
****************************************/
void toString(Writer, Char)(scope Writer wrt, scope const ref FormatSpec!Char formatSpec)
if(isOutputRange!(Writer, const(Char)[])){
import std.format: formatValue;
import std.range.primitives: put;
wrt.put(PAREN_START);
wrt.formatValue(_cmpn[0], formatSpec);
wrt.put("; ");
wrt.formatValue(_cmpn[1], formatSpec);
wrt.put("i, ");
wrt.formatValue(_cmpn[2], formatSpec);
wrt.put("j, ");
wrt.formatValue(_cmpn[3], formatSpec);
wrt.put("k" ~PAREN_END);
}
unittest{
double[4] foo= [1.0, 2.0, 3.0, 4.0];
auto bar= SekiTK!double.Quaternion(foo);
assert(bar.toString == "Quaternion(1; 2i, 3j, 4k)");
}
/// ditto
string toString(){
import std.exception: assumeUnique;
char[] buf;
{
enum size_t RESERVE_SIZE= PAREN_START.length
+"; i, j, k".length
+"-123.45678".length*4
+PAREN_END.length;
buf.reserve(RESERVE_SIZE);
}
auto fmt= FormatSpec!char("%s");
toString((const(char)[] s){buf ~= s;}, fmt);
return (char[] bufMutable) @trusted{return assumeUnique(bufMutable);}(buf);
}
}
// Other methods
@property @safe pure nothrow @nogc const{
/****************************************
* Each elements
****************************************/
T w(){return _cmpn[0];}
T x(){return _cmpn[1];}
T y(){return _cmpn[2];}
T z(){return _cmpn[3];}
/****************************************
* Conjugate quaternion
****************************************/
TypeOfThis conj(){
T[4] num= void;
num[0]= this._cmpn[0];
num[1 .. 3] = -this._cmpn[1 .. 3];
return typeof(return)(num);
}
/****************************************
* Vector part
****************************************/
Vector!3u vec(){
import std.array: staticArray;
return typeof(return)(_cmpn[1..4].staticArray!3u);
}
}
private:
enum string PAREN_START= "Quaternion(";
enum string PAREN_END= ")";
}
}
|
D
|
<?xml version="1.0" encoding="ASCII"?>
<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
<pageList>
<availablePage>
<emfPageIdentifier href="48e525d3-4e4a-4a04-acf1-067f1e82a803-BDD.notation#_wvb_oGfLEem_x6w7Vlf7EA"/>
</availablePage>
</pageList>
<sashModel currentSelection="//@sashModel/@windows.0/@children.0">
<windows>
<children xsi:type="di:TabFolder">
<children>
<emfPageIdentifier href="48e525d3-4e4a-4a04-acf1-067f1e82a803-BDD.notation#_wvb_oGfLEem_x6w7Vlf7EA"/>
</children>
</children>
</windows>
</sashModel>
</di:SashWindowsMngr>
|
D
|
be larger in number, quantity, power, status or importance
be in control
have dominance or the power to defeat over
be greater in significance than
look down on
|
D
|
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
struct UFTree(T)
{
struct Node
{
T parent;
T rank = 1;
}
///
this(T n)
{
nodes.length = n;
sizes.length = n;
foreach (i, ref node; nodes) {
node = Node(i.to!T);
sizes[i] = 1;
}
}
///
bool unite(T a, T b)
{
a = root(a);
b = root(b);
if (a == b) return false;
if (nodes[a].rank < nodes[b].rank) {
sizes[nodes[a].parent] += sizes[nodes[b].parent];
nodes[b].parent = nodes[a].parent;
} else {
sizes[nodes[b].parent] += sizes[nodes[a].parent];
nodes[a].parent = nodes[b].parent;
if (nodes[a].rank == nodes[b].rank) nodes[a].rank += 1;
}
return true;
}
///
bool is_same(T a, T b)
{
return root(a) == root(b);
}
///
T size(T i)
{
return sizes[root(i)];
}
T size()
{
bool[T] memo;
foreach (node; this.nodes) {
memo[root(node.parent)] = true;
}
T cnt;
foreach (_; memo) ++cnt;
return cnt;
}
Node[] nodes;
T[] sizes;
T root(T i)
{
if (nodes[i].parent == i) return i;
return nodes[i].parent = root(nodes[i].parent);
}
}
///
UFTree!T uftree(T)(T n)
{
return UFTree!T(n);
}
alias Cost = Tuple!(int, "i", long, "a");
Cost[10^^5] CS;
void main()
{
auto nm = readln.split.to!(int[]);
auto N = nm[0];
auto M = nm[1];
foreach (i, a; readln.split.to!(long[])) {
CS[i] = Cost(i.to!int, a);
}
sort!"a.a < b.a"(CS[0..N]);
auto uftree = uftree(N);
foreach (_; 0..M) {
auto xy = readln.split.to!(int[]);
uftree.unite(xy[0], xy[1]);
}
if (uftree.size() == 1) {
writeln(0);
return;
}
int[int] PS;
foreach (node; uftree.nodes) {
PS[uftree.root(node.parent)] = 0;
}
int max_n = -1;
foreach (_; PS) ++max_n;
int cnt;
long r;
foreach (ref c; CS[0..N]) {
auto t = uftree.root(c.i);
if (!PS[t]) {
r += c.a;
++cnt;
++PS[t];
c.a = -1;
}
}
foreach (c; CS[0..N]) {
if (cnt == max_n*2) break;
auto t = uftree.root(c.i);
if (c.a < 0) continue;
++cnt;
r += c.a;
}
if (cnt == max_n*2) {
writeln(r);
} else {
writeln("Impossible");
}
}
|
D
|
/*
REQUIRED_ARGS: -unittest
TEST_OUTPUT:
---
fail_compilation/test19176.d(13): Error: argument `foo()` to __traits(getUnitTests) must be a module or aggregate, not a template
---
*/
// https://issues.dlang.org/show_bug.cgi?id=19176
void main()
{
__traits(getUnitTests, foo);
}
template foo()
{
static if(true)
{
enum bar;
}
else
{
enum bar;
}
}
|
D
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.