code stringlengths 3 10M | language stringclasses 31 values |
|---|---|
/Users/jaison/Documents/Drive/custom-api/.build/debug/Socks.build/Socks.swift.o : /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/Socks.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/SynchronousTCPServer.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/SynchronousUDPServer.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/TCPClient.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/UDPClient.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/jaison/Documents/Drive/custom-api/.build/debug/SocksCore.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 /Users/jaison/Documents/Drive/custom-api/.build/debug/CLibreSSL.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule
/Users/jaison/Documents/Drive/custom-api/.build/debug/Socks.build/Socks~partial.swiftmodule : /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/Socks.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/SynchronousTCPServer.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/SynchronousUDPServer.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/TCPClient.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/UDPClient.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/jaison/Documents/Drive/custom-api/.build/debug/SocksCore.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 /Users/jaison/Documents/Drive/custom-api/.build/debug/CLibreSSL.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule
/Users/jaison/Documents/Drive/custom-api/.build/debug/Socks.build/Socks~partial.swiftdoc : /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/Socks.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/SynchronousTCPServer.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/SynchronousUDPServer.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/TCPClient.swift /Users/jaison/Documents/Drive/custom-api/Packages/Socks-1.2.7/Sources/Socks/UDPClient.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/jaison/Documents/Drive/custom-api/.build/debug/SocksCore.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 /Users/jaison/Documents/Drive/custom-api/.build/debug/CLibreSSL.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule
| D |
/* Converted to D from include/sysapp/launch.h by htod */
module sysapp.launch;
//C #pragma once
//C #include <wut.h>
import wut;
/**
* \defgroup sysapp_launch SYSAPP Launch
* \ingroup sysapp
* @{
*/
//C #ifdef __cplusplus
//C extern "C" {
//C #endif
//C void
//C SYSRelaunchTitle(uint32_t argc,
//C char *pa_Argv[]);
extern (C):
void SYSRelaunchTitle(uint argc, char **pa_Argv);
//C void
//C SYSLaunchMenu();
void SYSLaunchMenu();
//C void
//C SYSLaunchTitle(uint64_t TitleId);
void SYSLaunchTitle(ulong TitleId);
//C void
//C _SYSLaunchMiiStudio();
void _SYSLaunchMiiStudio();
//C void
//C _SYSLaunchSettings();
void _SYSLaunchSettings();
//C void
//C _SYSLaunchParental();
void _SYSLaunchParental();
//C void
//C _SYSLaunchNotifications();
void _SYSLaunchNotifications();
//C #ifdef __cplusplus
//C }
//C #endif
/** @} */
| D |
// Copyright Ferdinand Majerech 2011.
// Copyright Cameron Ross 2016.
// 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 wyaml.tests.representer;
unittest {
import std.array : array;
import std.conv : text;
import std.exception : enforce;
import std.outbuffer : OutBuffer;
import std.range : lockstep, StoppingPolicy;
import std.typecons : AliasSeq;
import wyaml.constructor : Constructor;
import wyaml.dumper : Dumper;
import wyaml.loader : Loader;
import wyaml.node : Node;
import wyaml.representer : Representer;
import wyaml.tag : Tag;
import wyaml.tests.common : run2, writeComparison;
import wyaml.tests.constructor : constructClass, constructStruct, expected, representClass, representStruct, TestClass, TestStruct;
/// Representer unittest.
///
/// Params: testName = Name of the test being run.
void testRepresenterTypes(string testName) {
enforce((testName in expected) !is null, new Exception("Unimplemented representer test: " ~ testName));
Node[] expectedNodes = expected[testName];
string output;
Node[] readNodes;
scope (failure) {
writeComparison!("Expected nodes", "Read nodes", "Output")(testName, expectedNodes, readNodes, output);
}
auto emitStream = new OutBuffer;
auto representer = new Representer;
representer.addRepresenter!TestClass(&representClass);
representer.addRepresenter!TestStruct(&representStruct);
auto dumper = Dumper();
dumper.representer = representer;
dumper.dump(emitStream, expectedNodes);
output = emitStream.text;
auto constructor = new Constructor;
constructor.addConstructorMapping!constructClass(Tag("!tag1"));
constructor.addConstructorScalar!constructStruct(Tag("!tag2"));
auto loader = Loader(emitStream.text);
loader.name = "TEST";
loader.constructor = constructor;
readNodes = loader.loadAll().array;
foreach (expected, read; lockstep(expectedNodes, readNodes, StoppingPolicy.requireSameLength)) {
assert(expected == read);
}
}
alias testGroup = AliasSeq!("aliases-cdumper-bug", "construct-binary", "construct-bool", "construct-custom", "construct-float", "construct-int", "construct-map", "construct-merge", "construct-null", "construct-omap", "construct-pairs", "construct-seq", "construct-set", "construct-str-ascii", "construct-str-utf8", "construct-str", "construct-timestamp", "construct-value", "duplicate-merge-key", "float-representer-2.3-bug", "invalid-single-quote-bug", "more-floats", "negative-float-bug", "single-dot-is-not-float-bug", "timestamp-bugs", "utf8");
run2!(testRepresenterTypes, [], testGroup)("Representer");
}
| D |
instance DIA_Halvor_EXIT(C_Info)
{
npc = VLK_469_Halvor;
nr = 999;
condition = DIA_Halvor_EXIT_Condition;
information = DIA_Halvor_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Halvor_EXIT_Condition()
{
return TRUE;
};
func void DIA_Halvor_EXIT_Info()
{
B_EquipTrader(self);
AI_StopProcessInfos(self);
};
instance DIA_Halvor_InPrison(C_Info)
{
npc = VLK_469_Halvor;
nr = 2;
condition = DIA_Halvor_InPrison_Condition;
information = DIA_Halvor_InPrison_Info;
permanent = TRUE;
important = TRUE;
};
func int DIA_Halvor_InPrison_Condition()
{
if(Npc_IsInState(self,ZS_Talk) && (Halvor_Ausgeliefert == TRUE))
{
return TRUE;
};
};
func void DIA_Halvor_InPrison_Info()
{
AI_Output(self,other,"DIA_Halvor_MESSAGE_PRISON_06_03"); //Ты пожалеешь об этом.
AI_StopProcessInfos(self);
};
instance DIA_Halvor_Hallo(C_Info)
{
npc = VLK_469_Halvor;
nr = 2;
condition = DIA_Halvor_Hallo_Condition;
information = DIA_Halvor_Hallo_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Halvor_Hallo_Condition()
{
if(Npc_IsInState(self,ZS_Talk) && Wld_IsTime(5,0,20,0) && (Halvor_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_Hallo_Info()
{
AI_Output(self,other,"DIA_Halvor_Hallo_06_00"); //Эй, тебе нужна рыба? У меня очень хорошая рыба - с самых глубин моря!
Log_CreateTopic(TOPIC_CityTrader,LOG_NOTE);
B_LogEntry(TOPIC_CityTrader,"Халвор торгует рыбой в гавани.");
};
instance DIA_Halvor_TRADE(C_Info)
{
npc = VLK_469_Halvor;
nr = 2;
condition = DIA_Halvor_TRADE_Condition;
information = DIA_Halvor_TRADE_Info;
permanent = TRUE;
trade = TRUE;
description = "Покажи мне свою рыбу.";
};
func int DIA_Halvor_TRADE_Condition()
{
if(Npc_KnowsInfo(hero,DIA_Halvor_Hallo) && Wld_IsTime(5,0,20,0) && (Halvor_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_TRADE_Info()
{
AI_Output(other,self,"DIA_Halvor_TRADE_15_00"); //Покажи мне свою рыбу.
B_GiveTradeInv(self);
Trade_IsActive = TRUE;
};
instance DIA_Halvor_Night(C_Info)
{
npc = VLK_469_Halvor;
nr = 2;
condition = DIA_Halvor_Night_Condition;
information = DIA_Halvor_Night_Info;
permanent = TRUE;
important = TRUE;
};
func int DIA_Halvor_Night_Condition()
{
if(Wld_IsTime(20,0,5,0) && Npc_IsInState(self,ZS_Talk) && (Halvor_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_Night_Info()
{
if(Wld_IsTime(20,0,0,0))
{
AI_Output(self,other,"DIA_Halvor_Night_06_00"); //Эй, если ты хочешь купить рыбу, заходи ко мне завтра. Хорошо?
}
else
{
B_Say(self,other,"$NOTNOW");
};
};
instance DIA_Addon_Halvor_MissingPeople(C_Info)
{
npc = VLK_469_Halvor;
nr = 5;
condition = DIA_Addon_Halvor_MissingPeople_Condition;
information = DIA_Addon_Halvor_MissingPeople_Info;
description = "Ты знаешь что-нибудь о пропавших людях?";
};
func int DIA_Addon_Halvor_MissingPeople_Condition()
{
if((SC_HearedAboutMissingPeople == TRUE) && (MissingPeopleReturnedHome == FALSE) && (Halvor_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Addon_Halvor_MissingPeople_Info()
{
AI_Output(other,self,"DIA_Addon_Halvor_MissingPeople_15_00"); //Ты знаешь что-нибудь о пропавших людях?
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_06_01"); //Пропавших людях? Это порт, приятель. Такие события здесь не в диковинку.
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_06_02"); //Море жестоко. Оно нередко забирает человеческие жизни.
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_06_03"); //В крупных портах, таких как Хоринис, капитаны больших кораблей набирают матросов для пополнения команды.
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_06_04"); //А если они не находят добровольцев, людей могут затащить на корабль и против их воли. Так они исчезают.
Info_ClearChoices(DIA_Addon_Halvor_MissingPeople);
Info_AddChoice(DIA_Addon_Halvor_MissingPeople,Dialog_Back,DIA_Addon_Halvor_MissingPeople_Back);
Info_AddChoice(DIA_Addon_Halvor_MissingPeople,"Но что это мог быть за корабль?",DIA_Addon_Halvor_MissingPeople_schiff);
Info_AddChoice(DIA_Addon_Halvor_MissingPeople,"Ты знаешь кого-нибудь, кто пропал?",DIA_Addon_Halvor_MissingPeople_wer);
Info_AddChoice(DIA_Addon_Halvor_MissingPeople,"А у тебя кто-нибудь пропал?",DIA_Addon_Halvor_MissingPeople_you);
};
func void DIA_Addon_Halvor_MissingPeople_Back()
{
Info_ClearChoices(DIA_Addon_Halvor_MissingPeople);
};
func void DIA_Addon_Halvor_MissingPeople_wer()
{
AI_Output(other,self,"DIA_Addon_Halvor_MissingPeople_wer_15_00"); //Ты знаешь кого-нибудь, кто пропал?
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_wer_06_01"); //Нет. Попробуй спросить у корабельщиков.
Log_CreateTopic(TOPIC_Addon_WhoStolePeople,LOG_MISSION);
Log_SetTopicStatus(TOPIC_Addon_WhoStolePeople,LOG_Running);
B_LogEntry(TOPIC_Addon_WhoStolePeople,"Единственное, что смог мне посоветовать торговец рыбой Халвор - это обратиться к кораблестроителям.");
};
func void DIA_Addon_Halvor_MissingPeople_schiff()
{
AI_Output(other,self,"DIA_Addon_Halvor_MissingPeople_schiff_15_00"); //Но что это мог быть за корабль?
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_schiff_06_01"); //Хороший вопрос. Ты прав, в последнее время корабли в Хоринис не заходят.
};
func void DIA_Addon_Halvor_MissingPeople_you()
{
AI_Output(other,self,"DIA_Addon_Halvor_MissingPeople_you_15_00"); //А у тебя кто-нибудь пропал?
AI_Output(self,other,"DIA_Addon_Halvor_MissingPeople_you_06_01"); //У меня? Нет.
};
instance DIA_Halvor_MESSAGE(C_Info)
{
npc = VLK_469_Halvor;
nr = 2;
condition = DIA_Halvor_MESSAGE_Condition;
information = DIA_Halvor_MESSAGE_Info;
permanent = FALSE;
description = "Я думаю, этот клочок бумаги имеет отношение к тебе...";
// trade = FALSE;
};
func int DIA_Halvor_MESSAGE_Condition()
{
if(Npc_HasItems(other,ItWr_HalvorMessage) && (Knows_Halvor == TRUE) && (Halvor_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_MESSAGE_Info()
{
AI_Output(other,self,"DIA_Halvor_MESSAGE_15_00"); //Я думаю, этот клочок бумаги имеет отношение к тебе...
AI_Output(self,other,"DIA_Halvor_MESSAGE_06_01"); //Что?.. Дай посмотрю.
DIA_Common_NotSoFastMyFriend();
// B_ReadFakeItem(self,other,Fakescroll,1);
AI_Output(self,other,"DIA_Halvor_MESSAGE_06_02"); //(в испарине) Э-э... Хорошо, давай поговорим спокойно об этом - э-э... послушай. Я перепродал товары, полученные от бандитов.
AI_Output(self,other,"DIA_Halvor_MESSAGE_06_03"); //(торопливо) Но нет необходимости сообщать об этом ополчению, правда? Я уверен, мы можем прийти к взаимопониманию, разве нет?
Info_ClearChoices(DIA_Halvor_MESSAGE);
Info_AddChoice(DIA_Halvor_MESSAGE,"Ну, попробуй сделать мне предложение.",DIA_Halvor_MESSAGE_OFFER);
Info_AddChoice(DIA_Halvor_MESSAGE,"Похоже, тебе светит тюрьма.",DIA_Halvor_MESSAGE_PRISON);
};
func void DIA_Halvor_MESSAGE_OFFER()
{
AI_Output(other,self,"DIA_Halvor_MESSAGE_OFFER_15_00"); //Ну, попробуй сделать мне предложение.
AI_Output(self,other,"DIA_Halvor_MESSAGE_OFFER_06_01"); //Хорошо. Послушай меня. Я могу продать тебе не только рыбу.
AI_Output(self,other,"DIA_Halvor_MESSAGE_OFFER_06_03"); //Если ты отдашь мне этот клочок бумаги, э-э... и забудешь об этом, ты и я можем стать отличными торговыми партнерами.
Info_ClearChoices(DIA_Halvor_MESSAGE);
Info_AddChoice(DIA_Halvor_MESSAGE,"Хорошо, договорились.",DIA_Halvor_MESSAGE_Okay);
Info_AddChoice(DIA_Halvor_MESSAGE,"Похоже, тебе светит тюрьма.",DIA_Halvor_MESSAGE_PRISON);
Info_AddChoice(DIA_Halvor_MESSAGE,"Да ну?! И что это за товары?",DIA_Halvor_MESSAGE_DEAL);
};
func void DIA_Halvor_MESSAGE_PRISON()
{
AI_Output(other,self,"DIA_Halvor_MESSAGE_PRISON_15_00"); //Похоже, тебе светит тюрьма.
AI_Output(self,other,"DIA_Halvor_MESSAGE_PRISON_06_01"); //Нет, подожди, ты не можешь поступить так! Ведь я... я... ты же понимаешь... я мелкая рыбешка.
AI_Output(other,self,"DIA_Halvor_MESSAGE_PRISON_15_02"); //Тебе стоило подумать об этом раньше. А теперь я собираюсь сообщить о тебе лорду Андрэ.
AI_Output(self,other,"DIA_Halvor_MESSAGE_PRISON_06_03"); //Ты пожалеешь об этом.
Betrayal_Halvor = TRUE;
AI_StopProcessInfos(self);
};
func void DIA_Halvor_MESSAGE_DEAL()
{
AI_Output(other,self,"DIA_Halvor_MESSAGE_DEAL_15_00"); //Да ну?! И что это за товары?
AI_Output(self,other,"DIA_Halvor_MESSAGE_DEAL_06_01"); //Ну, я мог бы предложить тебе... особенную рыбу, понимаешь? Не простую рыбешку, которая годится только для еды.
AI_Output(other,self,"DIA_Halvor_MESSAGE_DEAL_15_02"); //Ты имеешь в виду что-то вроде рыбы, содержащей твое тайное послание?
AI_Output(self,other,"DIA_Halvor_MESSAGE_DEAL_06_03"); //Ты все правильно понимаешь. У меня есть несколько таких... рыб.
};
func void DIA_Halvor_MESSAGE_Okay()
{
AI_Output(other,self,"DIA_Halvor_MESSAGE_Okay_15_00"); //Хорошо, договорились. Я думаю, мы сохраним все это в тайне.
AI_Output(self,other,"DIA_Halvor_MESSAGE_Okay_06_01"); //Спасибо. Заходи, когда опять будешь неподалеку. Я приготовлю очень интересные вещички для тебя.
B_GiveInvItems(other,self,ItWr_HalvorMessage,1);
Npc_RemoveInvItems(self,ItWr_HalvorMessage,1);
Halvor_Deal = TRUE;
Diebesgilde_Okay += 1;
CreateInvItems(self,ItSe_ErzFisch,1);
CreateInvItems(self,ItSe_GoldFisch,1);
CreateInvItems(self,ItSe_RingFisch,1);
CreateInvItems(self,ItSe_LockpickFisch,1);
Info_ClearChoices(DIA_Halvor_MESSAGE);
};
instance DIA_Halvor_Zeichen(C_Info)
{
npc = VLK_469_Halvor;
nr = 800;
condition = DIA_Halvor_Zeichen_Condition;
information = DIA_Halvor_Zeichen_Info;
permanent = FALSE;
description = DIALOG_SecretSign;
};
func int DIA_Halvor_Zeichen_Condition()
{
if((Knows_SecretSign == TRUE) && (Betrayal_Halvor == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_Zeichen_Info()
{
AI_PlayAni(other,"T_YES");
AI_Output(self,other,"DIA_Halvor_Zeichen_06_00"); //Понимаю. Ты пришел не просто купить рыбу.
AI_Output(self,other,"DIA_Halvor_Zeichen_06_01"); //(тихо) Я готов сделать тебе предложение. Если у тебя есть серебряные тарелки или кубки, я возьму их по хорошей цене.
CreateInvItems(self,ItKe_Lockpick,20);
B_LogEntry(Topic_Diebesgilde,"Халвор купит серебряные тарелки и кубки по очень хорошей цене.");
};
instance DIA_Halvor_Hehlerei(C_Info)
{
npc = VLK_469_Halvor;
nr = 2;
condition = DIA_Halvor_Hehlerei_Condition;
information = DIA_Halvor_Hehlerei_Info;
permanent = TRUE;
description = "(продать все тарелки и кубки)";
};
func int DIA_Halvor_Hehlerei_Condition()
{
if(Npc_KnowsInfo(other,DIA_Halvor_Zeichen) && (Betrayal_Halvor == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_Hehlerei_Info()
{
DIA_Common_LookWhatIGot();
Halvor_Score = 0;
if(Halvor_Day != Wld_GetDay())
{
if(Npc_HasItems(other,ItMi_SilverPlate) || Npc_HasItems(other,ItMi_SilverCup))
{
Halvor_Score = (Npc_HasItems(other,ItMi_SilverPlate) * (Value_SilverPlate / 2)) + (Npc_HasItems(other,ItMi_SilverCup) * (Value_SilverCup / 2));
if(Halvor_Score <= 1000)
{
AI_Output(self,other,"DIA_Halvor_Zeichen_06_05"); //За твои вещички я дам тебе...
B_Say_Gold(self,other,Halvor_Score);
Info_ClearChoices(DIA_Halvor_Hehlerei);
Info_AddChoice(DIA_Halvor_Hehlerei,"Хорошо. Продано!",DIA_Halvor_Hehlerei_Annehmen);
Info_AddChoice(DIA_Halvor_Hehlerei,"Я подумаю над этим.",DIA_Halvor_Hehlerei_Ablehnen);
}
else
{
AI_Output(self,other,"DIA_Halvor_Zeichen_06_06"); //Ты принес слишком много. У меня нет столько золота сразу.
Info_ClearChoices(DIA_Halvor_Hehlerei);
};
}
else
{
AI_Output(self,other,"DIA_Halvor_Zeichen_06_02"); //Заходи, когда у тебя будут серебряные тарелки или кубки.
Info_ClearChoices(DIA_Halvor_Hehlerei);
};
}
else if(Wld_GetDay() == 0)
{
AI_Output(self,other,"DIA_Halvor_Zeichen_06_03"); //Ты можешь отдать мне свое серебро завтра. Сегодня слишком рано.
}
else
{
AI_Output(self,other,"DIA_Halvor_Zeichen_06_04"); //Извини, но сегодня я не готов вести дела. Заходи завтра, хорошо?
};
};
func void DIA_Halvor_Hehlerei_Annehmen()
{
var int amount;
var string concatText;
amount = Npc_HasItems(other,ItMi_SilverPlate) + Npc_HasItems(other,ItMi_SilverCup);
concatText = ConcatStrings(IntToString(amount),PRINT_ItemsGiven);
AI_PrintScreen(concatText,-1,YPOS_ItemGiven,FONT_ScreenSmall,2);
B_RemoveEveryInvItem(other,ItMi_SilverCup);
B_RemoveEveryInvItem(other,ItMi_SilverPlate);
B_GiveInvItems(self,other,ItMi_Gold,Halvor_Score);
AI_Output(other,self,"DIA_Halvor_Zeichen_Annehmen_15_00"); //Хорошо. Продано!
AI_Output(self,other,"DIA_Halvor_Zeichen_Annehmen_06_01"); //Мы заключили несколько хороших сделок сегодня. Лучше не приходи ко мне до завтра, это может вызвать подозрения, понимаешь?
Halvor_Day = Wld_GetDay();
Info_ClearChoices(DIA_Halvor_Hehlerei);
};
func void DIA_Halvor_Hehlerei_Ablehnen()
{
DIA_Common_IWillThinkAboutIt();
Info_ClearChoices(DIA_Halvor_Hehlerei);
};
instance DIA_Halvor_Crew(C_Info)
{
npc = VLK_469_Halvor;
nr = 51;
condition = DIA_Halvor_Crew_Condition;
information = DIA_Halvor_Crew_Info;
permanent = FALSE;
description = "Я набираю команду.";
};
func int DIA_Halvor_Crew_Condition()
{
if((MIS_SCKnowsWayToIrdorath == TRUE) && (Halvor_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Halvor_Crew_Info()
{
AI_Output(other,self,"DIA_Halvor_Crew_15_00"); //Я набираю команду.
if(Betrayal_Halvor == FALSE)
{
AI_Output(self,other,"DIA_Halvor_Crew_06_01"); //А как ты планируешь уплыть отсюда?
Info_ClearChoices(DIA_Halvor_Crew);
Info_AddChoice(DIA_Halvor_Crew,"Это мое дело.",DIA_Halvor_Crew_MyThing);
Info_AddChoice(DIA_Halvor_Crew,"Здесь есть подходящий корабль.",DIA_Halvor_Crew_StealShip);
}
else
{
B_Say(self,other,"$NOTNOW");
AI_StopProcessInfos(self);
};
};
func void DIA_Halvor_Crew_MyThing()
{
AI_Output(other,self,"DIA_Halvor_Crew_MyThing_15_00"); //Это мое дело.
AI_Output(self,other,"DIA_Halvor_Crew_MyThing_06_01"); //Как знаешь. Это действительно не мое дело.
Info_ClearChoices(DIA_Halvor_Crew);
Info_AddChoice(DIA_Halvor_Crew,Dialog_Back,DIA_Halvor_Crew_BACK);
Info_AddChoice(DIA_Halvor_Crew,"Хочешь плыть со мной?",DIA_Halvor_Crew_JoinMe);
Info_AddChoice(DIA_Halvor_Crew,"Ты можешь помочь мне?",DIA_Halvor_Crew_HelpMe);
};
func void DIA_Halvor_Crew_StealShip()
{
AI_Output(other,self,"DIA_Halvor_Crew_StealShip_15_00"); //Здесь есть подходящий корабль.
if(other.guild != GIL_PAL)
{
AI_Output(self,other,"DIA_Halvor_Crew_StealShip_06_01"); //Да, точно. Ты это серьезно? Паладины сделают из тебя котлету, если доберутся до тебя.
};
AI_Output(self,other,"DIA_Halvor_Crew_StealShip_06_02"); //Поступай как знаешь, но я не собираюсь рисковать своей шкурой.
Info_ClearChoices(DIA_Halvor_Crew);
Info_AddChoice(DIA_Halvor_Crew,Dialog_Back,DIA_Halvor_Crew_BACK);
Info_AddChoice(DIA_Halvor_Crew,"Хочешь плыть со мной?",DIA_Halvor_Crew_JoinMe);
Info_AddChoice(DIA_Halvor_Crew,"Ты можешь помочь мне?",DIA_Halvor_Crew_HelpMe);
};
func void DIA_Halvor_Crew_JoinMe()
{
AI_Output(other,self,"DIA_Halvor_Crew_JoinMe_15_00"); //Хочешь плыть со мной?
AI_Output(self,other,"DIA_Halvor_Crew_JoinMe_06_01"); //Неет, спасибо. У меня и здесь работы хватает. Кроме того, если честно, я не хочу повстречаться с галерой, полной орков.
AI_Output(self,other,"DIA_Halvor_Crew_JoinMe_06_02"); //Но я все же желаю тебе удачи.
};
func void DIA_Halvor_Crew_HelpMe()
{
AI_Output(other,self,"DIA_Halvor_Crew_HelpMe_15_00"); //Ты можешь помочь мне?
if(!Npc_IsDead(Jack))
{
AI_Output(self,other,"DIA_Halvor_Crew_HelpMe_06_01"); //Я не очень подхожу для этого. Лучше поговори с Джеком, он должен ошиваться где-то здесь, в гавани. Он лучше знает, что тебе нужно для этого путешествия.
}
else
{
DIA_Common_06_IKnowNothingAboutIt();
};
};
func void DIA_Halvor_Crew_BACK()
{
Info_ClearChoices(DIA_Halvor_Crew);
};
| D |
enum VK_NULL_HANDLE = null;
alias uint8_t = ubyte;
alias uint32_t = uint;
alias uint64_t = ulong;
alias int32_t = int;
alias VkSampleMask = uint32_t;
alias VkBool32 = uint32_t;
alias VkFlags = uint32_t;
alias VkDeviceSize = uint32_t;
| D |
/takaya_workspace/self_study/rust_practice/gcd/target/debug/deps/gcd-a6b822b1aa0ef26d: src/main.rs
/takaya_workspace/self_study/rust_practice/gcd/target/debug/deps/gcd-a6b822b1aa0ef26d.d: src/main.rs
src/main.rs:
| D |
// Copyright © 2012, Jakob Bornecrantz. All rights reserved.
// See copyright notice in src/volt/license.d (BOOST ver. 1.0).
module volt.ir.context;
import std.string : format;
import volt.errors;
import volt.ir.base;
import volt.ir.type;
import volt.ir.toplevel;
import volt.ir.declaration;
import volt.ir.expression;
/**
* @defgroup irContext IR Context Classes
*
* These non-nodes handles the symbol space of nodes.
* These provide 'mechanism' over 'policy'; how look
* ups are performed, where they're performed. Parameter
* shadowing parent Scopes is allowed by these, that
* error has to come from another layer. The main
* restriction provided by these classes is that you can't
* have multiple Stores associated with the same name in
* a single Scope.
*
* Some passes that deal with context are the Context pass,
* the DeclGatherer pass, and the ScopeManager pass.
*
* In addition most of the semantic passes will lookup
* things in Scopes.
*
* @ingroup irNode
*/
/**
* A container class for a various things that can be stored
* in a Scope.
*
* If kind is Value, node is a Variable. If it's Type, the
* node is a Type. Scope means s is a named scope, and node
* contains the node that introduced the scope. Functions
* means that functions contain an overload set of a function.
*
* Note: not a node.
*
* @ingroup irNode irContext
*/
final class Store
{
public:
/**
* Class specifier.
*/
enum Kind
{
Alias,
Value,
Type,
Scope,
Function,
Template,
EnumDeclaration,
FunctionParam,
}
public:
/// Exported name.
string name;
/// Parent node, never null.
Scope parent;
/// Type contained within store.
Kind kind;
/**
* Owning node, for all types.
* For function the first encountered one.
*/
Node node;
/**
* For Scope this context, node might point to owning node.
* For Alias the scope into which the alias should be resolved from.
*/
Scope s;
/**
* Overloaded functions.
*/
Function[] functions;
/**
* Store pointed to by alias.
*/
Store myAlias;
public:
/**
* Used for Value, Type and Scope stores. Not really intended
* for general consumption but are instead called from the
* add members in Scope.
*/
this(Scope s, Node n, string name, Kind kind)
in {
assert(kind != Kind.Function);
}
body {
this.name = name;
this.node = n;
this.kind = kind;
this.parent = s;
}
/**
* Used for Aliases Not really intended for general consumption
* but are instead called from the addAlias function on Scope.
*/
this(Scope parent, Node n, string name, Scope look, Kind kind)
in {
assert(kind == Kind.Alias);
}
body {
this.name = name;
this.node = n;
this.kind = kind;
this.parent = parent;
if (look is null) {
this.s = parent;
} else {
this.s = look;
}
}
/**
* Used for functions. Not really intended for general
* consumption but are instead called from the addFunction
* member in Scope.
*/
this(Scope s, Function fn, string name)
{
this.name = name;
this.node = fn;
this.parent = s;
this.functions = [fn];
this.kind = Kind.Function;
}
/**
* Used for enums.
* The name will usually be the name of the enum declaration.
* Not really intended for general consumption, but called from the
* addEnumDeclaration member in Scope.
*/
this(Scope parent, EnumDeclaration ed, string name)
{
this.parent = parent;
this.node = ed;
this.kind = Kind.EnumDeclaration;
}
void markAliasResolved(Store s)
{
assert(kind == Kind.Alias);
assert(myAlias is null);
myAlias = s;
}
void markAliasResolved(Type t)
{
assert(kind == Kind.Alias);
assert(myAlias is null);
kind = Kind.Type;
node = t;
}
}
/**
* A single scope containing declared items and their identifiers.
*
* See store for what can be held in a scope. These things are
* associated with a string. Scopes have parent Scopes, but these
* don't affect getStores lookup -- write a look up function for
* your specific needs.
*
* Structs, Classes, Interfaces, Functions, and Modules all have scopes.
*
* Note: not a node.
*
* @ingroup irNode irContext
*/
final class Scope
{
public:
/// "Anonymous" identifier uniquifier value.
uint anon;
/// Name of this scope, needed for toplevel modules.
string name;
/// Owning node.
Node node;
/// Parent scope, if null toplevel module.
Scope parent;
/// Declared symbols in this scope.
Store[string] symbols;
/**
* Modules to implicitly look up symbols in.
*
* Currently only populated on module scopes.
*/
Module[] importedModules;
Access[] importedAccess;
int nestedDepth;
public:
/**
* For toplevel modules.
*
* Side-effects:
* None.
*/
this(Module m, string name)
{
this.name = name;
this.node = m;
}
/**
* For named imports, classes, structs and unions.
*
* Side-effects:
* None.
*/
this(Scope parent, Node node, string name)
{
this.name = name;
this.node = node;
this.parent = parent;
}
void remove(string name)
{
symbols.remove(name);
}
string genAnonIdent()
{
return "__anon" ~ to!string(anon++);
}
/**
* Add a unresolved Alias to this scope. The scope in which the
* alias is resolved to is default this scope, can be changed
* with the look argument, used by import rebinds.
*
* Throws:
* CompilerPanic if another symbol of same name is found.
*
* Side-effects:
* None.
*/
Store addAlias(Alias n, string name, Scope look = null)
in {
assert(n !is null);
assert(name !is null);
}
body {
errorOn(n, name);
auto store = new Store(this, n, name, look, Store.Kind.Alias);
symbols[name] = store;
return store;
}
/**
* Add a named scope, @n is the node which introduced
* this scope, must not be null.
*
* Throws:
* CompilerPanic if another symbol of same name is found.
*
* Side-effects:
* None.
*/
Store addScope(Node n, Scope s, string name)
in {
assert(n !is null);
assert(name !is null);
}
body {
errorOn(n, name);
auto store = new Store(this, n, name, Store.Kind.Scope);
symbols[name] = store;
store.s = s;
return store;
}
/**
* Add a user defined type.
*
* Throws:
* CompilerPanic if another symbol of same name is found.
*
* Side-effects:
* None.
*/
Store addType(Node n, string name)
in {
assert(n !is null);
assert(name !is null);
}
body {
errorOn(n, name);
auto store = new Store(this, n, name, Store.Kind.Type);
symbols[name] = store;
return store;
}
/**
* Add a value like a constant or a function variable.
*
* Throws:
* CompilerPanic if another symbol of same name is found.
*
* Side-effects:
* None.
*/
Store addValue(Node n, string name)
in {
assert(n !is null);
assert(name !is null);
}
body {
errorOn(n, name);
ir.Store store;
if (n.nodeType == ir.NodeType.FunctionParam) {
store = new Store(this, n, name, Store.Kind.FunctionParam);
} else {
store = new Store(this, n, name, Store.Kind.Value);
}
symbols[name] = store;
return store;
}
/**
* Add a function to this scope, will append function if one of
* declared function of the same name is found.
*
* Throws:
* CompilerPanic if a non-function of the same name is found.
*
* Side-effects:
* None.
*/
Store addFunction(Function fn, string name)
in {
assert(fn !is null);
assert(name !is null);
}
body {
auto ret = name in symbols;
if (ret is null) {
auto store = new Store(this, fn, name);
symbols[name] = store;
return store;
} else if (ret.kind == Store.Kind.Function) {
ret.functions ~= fn;
return *ret;
}
errorDefined(fn, name);
assert(false);
}
/**
* Add a user defined template.
*
* Throws:
* CompilerPanic if another symbol of same name is found.
*
* Side-effects:
* None.
*/
Store addTemplate(Node n, string name)
in {
assert(n !is null);
assert(name !is null);
}
body {
errorOn(n, name);
auto store = new Store(this, n, name, Store.Kind.Template);
symbols[name] = store;
return store;
}
/**
* Add a named expression to the scope.
*
* Throws:
* CompilerPanic if another symbol of the same name is found.
*
* Side-effects:
* None.
*/
Store addEnumDeclaration(EnumDeclaration e)
in {
assert(e !is null);
assert(e.name.length > 0);
}
body {
errorOn(e, e.name);
auto store = new Store(this, e, e.name);
symbols[e.name] = store;
return store;
}
/**
* Add a pre-existing store to the scope.
*
* Throws:
* CompilerPanic if another symbol of the same name is found.
*
* Side-effects:
* None.
*/
void addStore(Store s, string name)
in {
assert(s !is null);
assert(s.node !is null);
assert(name !is null);
}
body {
errorOn(s.node, name);
symbols[name] = s;
}
/**
* Doesn't look in parent scopes, just this Store.
*
* Returns: the Store found, store pointed to by alias,
* or null on lookup failure.
*
* Side-effects:
* None.
*/
Store getStore(string name)
{
auto ret = name in symbols;
if (ret is null)
return null;
auto s = *ret;
while (s.myAlias !is null) {
s = s.myAlias;
}
return s;
}
/**
* Get all Variables in the Scope the have Nested storage.
*/
Declaration[] getNestedDeclarations()
{
Declaration[] variables;
foreach (store; symbols.values) {
auto variable = cast(ir.Variable) store.node;
if (variable is null || variable.storage != Variable.Storage.Nested) {
continue;
}
variables ~= variable;
}
return variables;
}
private:
void errorOn(Node n, string name)
in {
assert(n !is null);
assert(name !is null);
}
body {
auto ret = name in symbols;
if (ret is null)
return;
errorDefined(n, name);
}
void errorDefined(Node n, string name)
{
auto str = format("\"%s\" already defined", name);
throw panic(n.location, str);
}
}
| D |
/home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOOpenSSL.build/SSLPointerTricks.swift.o : /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/ByteBufferBIO.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPKCS12Bundle.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLCertificate.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/IdentityVerification.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/TLSConfiguration.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLConnection.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLServerHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLClientHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLVerificationCallbacks.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPointerTricks.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLErrors.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLInit.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/PosixPort.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLContext.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPublicKey.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPrivateKey.swift /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIO.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOTLS.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Glibc.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Dispatch.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOConcurrencyHelpers.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Swift.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/SwiftOnoneSupport.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/share/swift/usr/lib/swift/linux/x86_64/glibc.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOSHA1.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOOpenSSL.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CCryptoOpenSSL.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOZlib.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIODarwin.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOHTTPParser.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOAtomics.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOLinux.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-zlib-support/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl-support/module.modulemap
/home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOOpenSSL.build/SSLPointerTricks~partial.swiftmodule : /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/ByteBufferBIO.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPKCS12Bundle.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLCertificate.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/IdentityVerification.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/TLSConfiguration.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLConnection.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLServerHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLClientHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLVerificationCallbacks.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPointerTricks.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLErrors.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLInit.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/PosixPort.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLContext.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPublicKey.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPrivateKey.swift /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIO.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOTLS.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Glibc.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Dispatch.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOConcurrencyHelpers.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Swift.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/SwiftOnoneSupport.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/share/swift/usr/lib/swift/linux/x86_64/glibc.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOSHA1.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOOpenSSL.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CCryptoOpenSSL.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOZlib.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIODarwin.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOHTTPParser.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOAtomics.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOLinux.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-zlib-support/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl-support/module.modulemap
/home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOOpenSSL.build/SSLPointerTricks~partial.swiftdoc : /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/ByteBufferBIO.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPKCS12Bundle.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLCertificate.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/IdentityVerification.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/TLSConfiguration.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLConnection.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLServerHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/OpenSSLClientHandler.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLVerificationCallbacks.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPointerTricks.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLErrors.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLInit.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/PosixPort.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLContext.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPublicKey.swift /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/NIOOpenSSL/SSLPrivateKey.swift /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIO.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOTLS.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Glibc.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Dispatch.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/NIOConcurrencyHelpers.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/Swift.swiftmodule /usr/share/swift/usr/lib/swift/linux/x86_64/SwiftOnoneSupport.swiftmodule /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/share/swift/usr/lib/swift/linux/x86_64/glibc.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOSHA1.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOOpenSSL.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CCryptoOpenSSL.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOZlib.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIODarwin.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOHTTPParser.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOAtomics.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/x86_64-unknown-linux/debug/CNIOLinux.build/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-zlib-support/module.modulemap /home/juliobrz/Git/PixelCanvas/.build/checkouts/swift-nio-ssl-support/module.modulemap
| D |
belonging to or characteristic of a dialect
| D |
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/build/parking_lot_core-b22344692b98cb1b/build_script_build-b22344692b98cb1b: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.6.2/build.rs
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/build/parking_lot_core-b22344692b98cb1b/build_script_build-b22344692b98cb1b.d: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.6.2/build.rs
/Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.6.2/build.rs:
| D |
/**
Generates offline documentation in the form of HTML files.
Copyright: © 2012 RejectedSoftware e.K.
License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Authors: Sönke Ludwig
*/
module ddox.htmlgenerator;
import ddox.api;
import ddox.entities;
import ddox.settings;
import std.array;
import std.variant;
import vibe.core.log;
import vibe.core.file;
import vibe.core.stream;
import vibe.inet.path;
import vibe.http.server;
import vibe.templ.diet;
/*
structure:
/index.html
/pack1/pack2/module1.html
/pack1/pack2/module1/member.html
/pack1/pack2/module1/member.submember.html
*/
void generateHtmlDocs(Path dst_path, Package root, GeneratorSettings settings = null)
{
if( !settings ) settings = new GeneratorSettings;
string linkTo(Entity ent, size_t level)
{
auto dst = appender!string();
if( level ) foreach( i; 0 .. level ) dst.put("../");
else dst.put("./");
if( ent !is null ){
if( !ent.parent ){
dst.put("index.html");
return dst.data();
}
auto dp = cast(VariableDeclaration)ent;
auto dfn = ent.parent ? cast(FunctionDeclaration)ent.parent : null;
if( dp && dfn ) ent = ent.parent;
Entity[] nodes;
size_t mod_idx = 0;
while( ent ){
if( cast(Module)ent ) mod_idx = nodes.length;
nodes ~= ent;
ent = ent.parent;
}
foreach_reverse(i, n; nodes[mod_idx .. $-1]){
dst.put(n.name);
if( i > 0 ) dst.put('/');
}
if( mod_idx == 0 ) dst.put(".html");
else {
dst.put('/');
foreach_reverse(n; nodes[0 .. mod_idx]){
dst.put(n.name);
dst.put('.');
}
dst.put("html");
}
if( dp && dfn ){
dst.put('#');
dst.put(dp.name);
}
}
return dst.data();
}
void visitDecl(Module mod, Declaration decl, Path path)
{
if( auto ctd = cast(CompositeTypeDeclaration)decl ){
foreach( m; ctd.members )
visitDecl(mod, m, path);
} else if( auto td = cast(TemplateDeclaration)decl ){
foreach( m; td.members )
visitDecl(mod, m, path);
}
auto file = openFile(path ~ PathEntry(decl.nestedName~".html"), FileMode.CreateTrunc);
scope(exit) file.close();
generateDeclPage(file, root, mod, decl, settings, ent => linkTo(ent, path.length-dst_path.length));
}
void visitModule(Module mod, Path pack_path)
{
auto modpath = pack_path ~ PathEntry(mod.name);
if( !existsFile(modpath) ) createDirectory(modpath);
foreach( decl; mod.members ) visitDecl(mod, decl, modpath);
logInfo("Generating module: %s", mod.qualifiedName);
auto file = openFile(pack_path ~ PathEntry(mod.name~".html"), FileMode.CreateTrunc);
scope(exit) file.close();
generateModulePage(file, root, mod, settings, ent => linkTo(ent, pack_path.length-dst_path.length));
}
void visitPackage(Package p, Path path)
{
auto packpath = p.parent ? path ~ PathEntry(p.name) : path;
if( !packpath.empty && !existsFile(packpath) ) createDirectory(packpath);
foreach( sp; p.packages ) visitPackage(sp, packpath);
foreach( m; p.modules ) visitModule(m, packpath);
}
dst_path.normalize();
if( !dst_path.empty && !existsFile(dst_path) ) createDirectory(dst_path);
{
auto idxfile = openFile(dst_path ~ PathEntry("index.html"), FileMode.CreateTrunc);
scope(exit) idxfile.close();
generateApiIndex(idxfile, root, settings, ent => linkTo(ent, 0));
}
{
auto smfile = openFile(dst_path ~ PathEntry("sitemap.xml"), FileMode.CreateTrunc);
scope(exit) smfile.close();
generateSitemap(smfile, root, settings, ent => linkTo(ent, 0));
}
visitPackage(root, dst_path);
}
class DocPageInfo {
string delegate(Entity ent) linkTo;
GeneratorSettings settings;
Package rootPackage;
Entity node;
@property NavigationType navigationType() const { return settings.navigationType; }
string formatType(Type tp) { return .formatType(tp, linkTo); }
string formatDoc(DocGroup group, int hlevel, bool delegate(string) display_section)
{
return group.comment.renderSections(new DocGroupContext(group, linkTo), display_section, hlevel);
}
}
class DocModulePageInfo : DocPageInfo {
Module mod;
}
class DocDeclPageInfo : DocModulePageInfo {
Declaration item;
DocGroup docGroup;
DocGroup[] docGroups; // for multiple doc groups with the same name
}
void generateSitemap(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(Entity) link_to, HttpServerRequest req = null)
{
dst.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", false);
dst.write("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n", false);
void writeEntry(string[] parts...){
dst.write("<url><loc>", false);
foreach( p; parts )
dst.write(p, false);
dst.write("</loc></url>\n", false);
}
void writeEntityRec(Entity ent){
import std.string;
if( !cast(Package)ent || ent is root_package ){
auto link = link_to(ent);
if( indexOf(link, '#') < 0 ) // ignore URLs with anchors
writeEntry((settings.siteUrl ~ Path(link)).toString());
}
ent.iterateChildren((ch){ writeEntityRec(ch); return true; });
}
writeEntityRec(root_package);
dst.write("</urlset>\n");
}
void generateApiIndex(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(Entity) link_to, HttpServerRequest req = null)
{
auto info = new DocPageInfo;
info.linkTo = link_to;
info.settings = settings;
info.rootPackage = root_package;
info.node = root_package;
dst.parseDietFileCompat!("ddox.overview.dt",
HttpServerRequest, "req",
DocPageInfo, "info")
(Variant(req), Variant(info));
}
void generateModulePage(OutputStream dst, Package root_package, Module mod, GeneratorSettings settings, string delegate(Entity) link_to, HttpServerRequest req = null)
{
auto info = new DocModulePageInfo;
info.linkTo = link_to;
info.settings = settings;
info.rootPackage = root_package;
info.mod = mod;
info.node = mod;
dst.parseDietFileCompat!("ddox.module.dt",
HttpServerRequest, "req",
DocModulePageInfo, "info")
(Variant(req), Variant(info));
}
void generateDeclPage(OutputStream dst, Package root_package, Module mod, Declaration item, GeneratorSettings settings, string delegate(Entity) link_to, HttpServerRequest req = null)
{
auto info = new DocDeclPageInfo;
info.linkTo = link_to;
info.settings = settings;
info.rootPackage = root_package;
info.node = item;
info.mod = mod;
info.item = item;
info.docGroup = item.docGroup;
info.docGroups = docGroups(mod.lookupAll!Declaration(item.nestedName));
switch( info.item.kind ){
default: logWarn("Unknown API item kind: %s", item.kind); return;
case DeclarationKind.Variable:
case DeclarationKind.EnumMember:
case DeclarationKind.Alias:
dst.parseDietFileCompat!("ddox.variable.dt", HttpServerRequest, "req", DocDeclPageInfo, "info")(Variant(req), Variant(info));
break;
case DeclarationKind.Function:
dst.parseDietFileCompat!("ddox.function.dt", HttpServerRequest, "req", DocDeclPageInfo, "info")(Variant(req), Variant(info));
break;
case DeclarationKind.Interface:
case DeclarationKind.Class:
case DeclarationKind.Struct:
case DeclarationKind.Union:
dst.parseDietFileCompat!("ddox.composite.dt", HttpServerRequest, "req", DocDeclPageInfo, "info")(Variant(req), Variant(info));
break;
case DeclarationKind.Template:
dst.parseDietFileCompat!("ddox.template.dt", HttpServerRequest, "req", DocDeclPageInfo, "info")(Variant(req), Variant(info));
break;
case DeclarationKind.Enum:
dst.parseDietFileCompat!("ddox.enum.dt", HttpServerRequest, "req", DocDeclPageInfo, "info")(Variant(req), Variant(info));
break;
}
}
| D |
func void B_CreateAmbientInv_VLK(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(16) + 2;
if(goldAmount > 10)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Blueplant,richboy);
CreateInvItems(self,ItMi_SilverRing,1);
CreateInvItems(self,ItFo_Water,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Fish,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItMi_Flask,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItFo_Water,1);
CreateInvItems(self,ItFoMutton,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItPo_Health_01,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount * 2);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Beer,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void b_createambientinv_xbs(var int InventorySet)
{
var int richboy;
richboy = Hlp_Random(2) + 1;
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Blueplant,richboy);
CreateInvItems(self,ItMi_SilverRing,1);
CreateInvItems(self,ItFo_Water,1);
CreateInvItems(self,ItMi_Gold,Hlp_Random(16) + 2);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPl_Forestberry,1);
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Fish,1);
CreateInvItems(self,ItMi_Joint,2);
CreateInvItems(self,ItMi_OldCoin,1);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItMi_Flask,1);
CreateInvItems(self,ItFo_Beer,2);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItFo_Water,1);
CreateInvItems(self,ItFoMutton,richboy);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_FishSoup,1);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItFo_Beer,1);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItFo_Apple,1);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItPo_Health_01,richboy);
CreateInvItems(self,ItFo_Honey,1);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Forestberry,2);
CreateInvItems(self,ItFo_Apple,1);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItFo_Beer,richboy);
};
};
func void B_CreateAmbientInv_BAU(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(10) + 7;
if(goldAmount > 12)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Forestberry,richboy);
CreateInvItems(self,ItFo_Water,1);
CreateInvItems(self,ItFo_Milk,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPl_Forestberry,1);
CreateInvItems(self,ItPl_Planeberry,richboy);
CreateInvItems(self,ItFo_Apple,1);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItPo_Health_01,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItPl_Blueplant,richboy);
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItFo_Bread,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItPl_Forestberry,richboy);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPl_Forestberry,1);
CreateInvItems(self,ItMi_Joint,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Cheese,4);
CreateInvItems(self,ItFo_Beer,1);
};
};
func void B_CreateAmbientInv_NOV(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(10) + 7;
if(goldAmount > 12)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Forestberry,richboy);
CreateInvItems(self,ItFo_Water,3);
CreateInvItems(self,ItPl_Blueplant,1);
CreateInvItems(self,ItFo_Fish,1);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItMi_Flask,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Apple,3);
CreateInvItems(self,ItFo_Cheese,2);
CreateInvItems(self,ItFo_Beer,2 + richboy);
CreateInvItems(self,ItMi_Sulfur,1);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItPl_Blueplant,richboy);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItFo_Water,1);
CreateInvItems(self,ItMi_Coal,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Bread,2);
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPl_Forestberry,1);
CreateInvItems(self,ItFo_Fish,1);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItPo_Mana_01,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Planeberry,2 + richboy);
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItFo_Beer,1);
};
};
func void B_CreateAmbientInv_SLD(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(10) + 10;
if(goldAmount > 15)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItFoMutton,richboy);
CreateInvItems(self,ItPl_Mushroom_01,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPl_Health_Herb_01,richboy);
CreateInvItems(self,ItFo_Booze,2);
CreateInvItems(self,ItFo_Sausage,1);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Stew,1);
CreateInvItems(self,ItMi_Joint,1 + richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItFo_Stew,1);
CreateInvItems(self,ItFo_Booze,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Sausage,richboy);
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItFo_Booze,richboy);
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItFo_FishSoup,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Mushroom_02,3);
CreateInvItems(self,ItFo_Booze,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
CreateInvItems(self,ItFoMutton,2);
};
};
func void B_CreateAmbientInv_KDF(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(20) + 30;
if(goldAmount > 41)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItFoMutton,richboy);
CreateInvItems(self,ItMi_Quartz,1);
CreateInvItems(self,ItMi_Coal,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPo_Mana_02,richboy);
CreateInvItems(self,ItMi_Sulfur,1);
CreateInvItems(self,ItMi_Flask,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItMi_SilverRing,1);
CreateInvItems(self,ItPl_Mushroom_01,richboy);
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItMi_Rockcrystal,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItFo_Sausage,1);
CreateInvItems(self,ItPo_Health_03,richboy);
CreateInvItems(self,ItFo_Booze,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItPl_Health_Herb_01,richboy);
CreateInvItems(self,ItPl_Mushroom_01,1);
CreateInvItems(self,ItPl_Mana_Herb_01,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItFo_Booze,1);
CreateInvItems(self,ItMi_Sulfur,1);
CreateInvItems(self,ItPl_Blueplant,richboy * 2);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Mushroom_02,richboy);
CreateInvItems(self,ItMi_Quartz,1);
CreateInvItems(self,ItMi_Pitch,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void B_CreateAmbientInv_MIL(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(20) + 15;
if(goldAmount > 23)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItFoMutton,3);
CreateInvItems(self,ItPl_Mushroom_01,1);
CreateInvItems(self,ItFo_Stew,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPo_Health_01,richboy);
CreateInvItems(self,ItPl_Health_Herb_01,3);
CreateInvItems(self,ItFoMutton,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItPl_Mushroom_01,1);
CreateInvItems(self,ItPl_Health_Herb_01,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItPl_Mushroom_01,richboy);
CreateInvItems(self,ItFo_Sausage,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Booze,3);
CreateInvItems(self,ItFo_FishSoup,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPl_Health_Herb_01,richboy);
CreateInvItems(self,ItFo_FishSoup,1);
CreateInvItems(self,ItPl_Mushroom_02,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_Mushroom_02,1);
CreateInvItems(self,ItFo_Booze,richboy);
CreateInvItems(self,ItFo_Sausage,3);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void B_CreateAmbientInv_DJG(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(15) + 35;
if(goldAmount > 47)
{
richboy = 3;
}
else if(goldAmount > 44)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItFo_Wine,richboy);
CreateInvItems(self,ItPl_Mana_Herb_01,1);
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItAt_WolfFur,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItFo_Milk,1);
CreateInvItems(self,ItMi_Joint,richboy);
CreateInvItems(self,ItPl_Health_Herb_02,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Bacon,richboy);
CreateInvItems(self,ItPl_Speed_Herb_01,1);
CreateInvItems(self,ItAt_BugMandibles,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItFoMutton,1);
CreateInvItems(self,ItPl_SwampHerb,1);
CreateInvItems(self,ItFo_Bacon,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Stew,1);
CreateInvItems(self,ItPl_Health_Herb_02,richboy);
CreateInvItems(self,ItMi_Joint,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPo_Health_02,1);
CreateInvItems(self,ItFo_Booze,2);
CreateInvItems(self,ItFo_Wine,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
if(richboy > 2)
{
CreateInvItems(self,ItPo_Health_02,1);
}
else if(richboy > 1)
{
CreateInvItems(self,ItPo_Health_01,1);
};
CreateInvItems(self,ItFo_Sausage,1);
CreateInvItems(self,ItFoMuttonRaw,2);
CreateInvItems(self,ItAt_SheepFur,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void B_CreateAmbientInv_PAL(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(30) + 20;
if(goldAmount > 45)
{
richboy = 3;
}
else if(goldAmount > 38)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItFo_Wine,richboy);
CreateInvItems(self,ItFo_Bacon,1);
CreateInvItems(self,ItPl_Speed_Herb_01,1);
CreateInvItems(self,ItMi_Pitch,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItFo_Booze,richboy);
CreateInvItems(self,ItFo_Milk,1);
CreateInvItems(self,ItMi_Rockcrystal,1);
CreateInvItems(self,ItPl_Mana_Herb_02,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Bacon,richboy);
CreateInvItems(self,ItPl_Mana_Herb_01,2);
CreateInvItems(self,ItMi_Sulfur,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItMi_Rockcrystal,1);
CreateInvItems(self,ItMi_SilverRing,1);
CreateInvItems(self,ItMi_Pitch,1);
CreateInvItems(self,ItPl_Health_Herb_03,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Stew,1);
CreateInvItems(self,ItPl_Health_Herb_02,richboy);
CreateInvItems(self,ItMi_Rockcrystal,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPo_Health_02,richboy);
CreateInvItems(self,ItPl_Speed_Herb_01,2);
CreateInvItems(self,ItMi_Coal,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItFo_Sausage,1);
CreateInvItems(self,ItMi_Coal,1);
CreateInvItems(self,ItPl_Health_Herb_02,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void B_CreateAmbientInv_DMT(var int InventorySet)
{
var int richboy;
if(InventorySet == 1)
{
CreateInvItems(self,ItPo_Mana_01,richboy);
CreateInvItems(self,ItMi_Pitch,1);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItPo_Mana_02,richboy);
CreateInvItems(self,ItMi_Aquamarine,1);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItMi_Sulfur,1);
CreateInvItems(self,ItPo_Mana_01,richboy);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItMi_Rockcrystal,1);
CreateInvItems(self,ItPo_Health_01,richboy);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItMi_Quartz,1);
CreateInvItems(self,ItPo_Health_02,richboy);
}
else if(InventorySet == 6)
{
if(richboy > 1)
{
CreateInvItems(self,itpo_speed_02,1);
}
else
{
CreateInvItems(self,ItPo_Speed,1);
};
CreateInvItems(self,ItMi_Coal,1);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItMi_Rockcrystal,1);
CreateInvItems(self,ItPo_Health_01,richboy);
};
};
func void B_CreateAmbientInv_STRF(var int InventorySet)
{
if(InventorySet == 1)
{
CreateInvItems(self,ItMi_Addon_GoldNugget,1);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItMi_Joint,1);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ITMI_SNUGGET,1);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItMi_OldCoin,1);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItMi_Sulfur,1);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItMi_Coal,1);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItPl_SwampHerb,1);
};
};
func void B_CreateAmbientInv_PIR(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(25) + 25;
if(goldAmount > 39)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Planeberry,1);
CreateInvItems(self,ItMw_1h_Vlk_Sword,1);
CreateInvItems(self,ItFo_Addon_Grog,richboy);
CreateInvItems(self,ItPl_Health_Herb_02,1);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Addon_Grog,2);
CreateInvItems(self,ItMi_Gold,goldAmount);
CreateInvItems(self,ItMi_Joint,3);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Beer,richboy);
CreateInvItems(self,ItPo_Health_01,1);
CreateInvItems(self,ItMi_RingGold,1);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItFo_Addon_Grog,2);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItMi_Joint,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Beer,1);
CreateInvItems(self,ItFo_Addon_Rum,richboy);
CreateInvItems(self,ItFo_Addon_Pfeffer_01,1);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItMi_Gold,goldAmount);
CreateInvItems(self,ItPl_Forestberry,richboy);
CreateInvItems(self,ItMw_1h_Vlk_Sword,1);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItFo_Fish,1);
CreateInvItems(self,ItFo_Addon_Grog,richboy);
CreateInvItems(self,ItFo_Bread,1);
if(richboy > 1)
{
CreateInvItems(self,ItPo_Health_01,1);
};
};
};
func void B_CreateAmbientInv_BDT(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(25) + 25;
if(goldAmount > 45)
{
richboy = 3;
}
else if(goldAmount > 37)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Planeberry,richboy);
CreateInvItems(self,ItKE_lockpick,1 + richboy);
CreateInvItems(self,ItPl_Health_Herb_02,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Booze,2);
CreateInvItems(self,ItMi_Joint,3);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Beer,richboy);
CreateInvItems(self,ItPo_Health_01,1);
if(richboy > 2)
{
CreateInvItems(self,ItPo_Health_01,1);
};
CreateInvItems(self,ItMi_SilverRing,1);
CreateInvItems(self,ItFo_Beer,2);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItKE_lockpick,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItMi_Joint,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Beer,1);
CreateInvItems(self,ItFo_Addon_Rum,1);
if(richboy > 2)
{
CreateInvItems(self,ItPo_Health_01,1);
};
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPl_Forestberry,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItFo_Addon_Grog,1);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItKE_lockpick,2 + richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void B_CreateAmbientInvAssasins(var int InventorySet)
{
var int goldAmount;
var int richboy;
goldAmount = Hlp_Random(25) + 25;
if(goldAmount > 45)
{
richboy = 3;
}
else if(goldAmount > 37)
{
richboy = 2;
}
else
{
richboy = 1;
};
if(InventorySet == 1)
{
CreateInvItems(self,ItPl_Planeberry,richboy);
CreateInvItems(self,ItKE_lockpick,1 + richboy);
CreateInvItems(self,ItPl_Health_Herb_02,1);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 2)
{
CreateInvItems(self,ItFo_Apple,richboy);
CreateInvItems(self,ItFo_Booze,2);
CreateInvItems(self,ItMi_Joint,3);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 3)
{
CreateInvItems(self,ItFo_Beer,richboy);
CreateInvItems(self,ItPo_Health_01,1);
if(richboy > 2)
{
CreateInvItems(self,ItPo_Health_01,1);
};
CreateInvItems(self,ItMi_SilverRing,1);
CreateInvItems(self,ItFo_Beer,2);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 4)
{
CreateInvItems(self,ItKE_lockpick,richboy);
CreateInvItems(self,ItFo_Cheese,1);
CreateInvItems(self,ItMi_Joint,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 5)
{
CreateInvItems(self,ItFo_Beer,1);
CreateInvItems(self,ItFo_Addon_Rum,1);
if(richboy > 2)
{
CreateInvItems(self,ItPo_Health_01,1);
};
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 6)
{
CreateInvItems(self,ItPl_Forestberry,richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
}
else if(InventorySet == 0)
{
CreateInvItems(self,ItFo_Fish,richboy);
CreateInvItems(self,ItFo_Addon_Grog,1);
CreateInvItems(self,ItFo_Bread,1);
CreateInvItems(self,ItKE_lockpick,2 + richboy);
CreateInvItems(self,ItMi_Gold,goldAmount);
};
};
func void B_CreateAmbientInv(var C_Npc slf)
{
var int zufall;
zufall = Hlp_Random(7);
if(slf.guild == GIL_VLK)
{
B_CreateAmbientInv_VLK(zufall);
}
else if(c_npcbelongstocoast(slf) == TRUE)
{
b_createambientinv_xbs(zufall);
}
else if(slf.guild == GIL_BAU)
{
B_CreateAmbientInv_BAU(zufall);
}
else if(slf.guild == GIL_NOV)
{
B_CreateAmbientInv_NOV(zufall);
}
else if(slf.guild == GIL_SLD)
{
B_CreateAmbientInv_SLD(zufall);
}
else if(slf.guild == GIL_KDF)
{
B_CreateAmbientInv_KDF(zufall);
}
else if(slf.guild == GIL_MIL)
{
B_CreateAmbientInv_MIL(zufall);
}
else if(slf.guild == GIL_DJG)
{
B_CreateAmbientInv_DJG(zufall);
}
else if(slf.guild == GIL_PAL)
{
B_CreateAmbientInv_PAL(zufall);
}
else if(slf.guild == GIL_DMT)
{
B_CreateAmbientInv_DMT(zufall);
}
else if(slf.guild == GIL_STRF)
{
B_CreateAmbientInv_STRF(zufall);
}
else if(slf.guild == GIL_PIR)
{
B_CreateAmbientInv_PIR(zufall);
}
else if(slf.guild == GIL_BDT)
{
if(slf.npcType == NPCTYPE_PALMORA)
{
B_CreateAmbientInv_PAL(zufall);
}
else
{
B_CreateAmbientInv_BDT(zufall);
};
}
else
{
B_CreateAmbientInv_BAU(zufall);
};
};
func void B_CreateAmbientInv_Ass(var C_Npc slf)
{
var int zufall;
zufall = Hlp_Random(7);
B_CreateAmbientInvAssasins(zufall);
};
func void b_createambientinv_om(var int rich)
{
var int goldAmount;
goldAmount = Hlp_Random(50);
CreateInvItems(self,ITMI_ZOMBIECORPSE,1);
if(goldAmount > 0)
{
CreateInvItems(self,ItMi_Gold,goldAmount);
};
}; | D |
module frontend;
import std.conv: text;
import std.concurrency: thisTid, Tid, send, prioritySend, receiveTimeout, OwnerTerminated, Variant;
import std.datetime: dur, StopWatch;
import std.stdio: stderr, writeln, writefln;
import std.exception: enforce;
import std.traits: isUnsigned;
import core.thread: Thread;
import sdlapp: SDLApp;
import renderer: Renderer;
import tile: Tile, world2tile, tile2geodetic, geodetic2tile, tile2world;
import backend: BackEnd;
// Frontend receives user input from OS and sends it to backend,
// receves from backend processed data and renders it
class FrontEnd : SDLApp
{
private:
Renderer renderer_;
BackEnd backend_;
Tid backend_tid_;
string url_, cache_path_;
/// current requested tile batch id
size_t batch_id_;
static assert(isUnsigned!(typeof(batch_id_)), "batch_id_ shall have unsigned type!");
void launchBackend()
{
static ubyte count;
if(count > 2)
{
stderr.writefln("****************************************");
stderr.writefln("Too many attemps to launch backend: %s.", count);
stderr.writefln("No more attempts will be performed.");
stderr.writefln("****************************************\n\n");
throw new Exception("BackEnd launching failed.");
}
writeln("Backend launching...");
backend_ = new BackEnd(url_, cache_path_);
backend_tid_ = backend_.runAsync();
backend_tid_.send(thisTid);
count++;
}
public:
this(uint width, uint height, double lon, double lat, string url, string cache_path)
{
super("Geoviewer", width, height);
renderer_ = new Renderer(width, height);
renderer_.camera.eyes = geodetic2tile(lon, lat, 0).tile2world;
url_ = url;
cache_path_ = cache_path;
launchBackend();
mouseMotionHandler = (int x, int y, bool rbtn_pressed)
{
//auto t = renderer_.camera.mouse2world(x, y, 0).world2tile;
//writefln("tile: %s", t);
//writefln("geodetic: %s", t.tile2geodetic);
if (rbtn_pressed) {
renderer_.camera.scrollingEnabled = true;
} else {
renderer_.camera.scrollingEnabled = false;
}
if(renderer_.camera.doScrolling(x, y))
{
requestNewTileBatch();
}
};
mouseWheelHandler = (int x, int y)
{
if(y)
{
if (y > 0)
{
renderer_.camera.multiplyScale(1.025);
requestNewTileBatch();
}
else
{
renderer_.camera.multiplyScale(.975);
requestNewTileBatch();
}
}
};
drawHandler = ()
{
// process messages from BackEnd
receiveMsg();
// draw result of processing events and
// receiving messages
renderer_.draw(mouse_x_, mouse_y_);
};
}
override void close()
{
renderer_.close();
super.close();
}
// run frontend in the current thread
override void run()
{
enforce(backend_tid_ != Tid.init);
// without delay messages can be missed by backend TODO: the reason isn't known
Thread.sleep(dur!"msecs"(100));
// init the first tile batch loading
requestNewTileBatch();
super.run();
}
/// using camera defines tiles that are in camera frustum and therefore should be loaded
void requestNewTileBatch()
{
/// start loading new tile set using new camera view
/// id of request lets us to recognize different requests and skip old request data
/// if requests are generated too quickly (next before previous isn't finished)
auto viewable_tile_set = renderer_.camera.getViewableTiles();
renderer_.startTileset(viewable_tile_set.length);
batch_id_++; // intended integer overflow
// send new tile batch id to let backend to skip old batches
backend_tid_.prioritySend(batch_id_);
foreach(tile; viewable_tile_set)
{
// request tile image from backend
backend_tid_.send(batch_id_, tile.x, tile.y, tile.zoom);
}
}
void receiveMsg()
{
// talk to logic thread
bool msg;
StopWatch timer;
timer.start();
do{
msg = receiveTimeout(dur!"usecs"(1),
// getting tiles from backend
(size_t batch_id, shared(Tile) shared_tile)
{
if(batch_id != batch_id_) // ignore tile of other requests
return;
auto tile = cast(Tile) shared_tile;
assert(tile !is null);
renderer_.setTile(tile);
},
(BackEnd.Status status)
{
if(status == BackEnd.Status.backendCrashed)
{
// back end crashed, restart it
launchBackend();
return;
}
stderr.writefln("Message unprocessed: %s", status);
},
(OwnerTerminated ot)
{
writeln(__FILE__ ~ "\t" ~ text(__LINE__) ~ ": Owner terminated");
},
(Variant any)
{
stderr.writeln("Unknown message received by frontend thread: " ~ any.type.text);
}
);
} while(msg && (timer.peek.msecs < 5)); // do not process longer than 5 milliseconds at once
timer.stop();
}
}
| D |
/Users/hiro/Desktop/SwiftPractic/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/String+MD5.o : /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/String+MD5.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Resource.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Image.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageCache.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Placeholder.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Filter.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Indicator.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Box.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Accelerate.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.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/Accelerate.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/os.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/hiro/Desktop/SwiftPractic/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Kingfisher.h /Users/hiro/Desktop/SwiftPractic/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/hiro/Desktop/SwiftPractic/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/String+MD5~partial.swiftmodule : /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/String+MD5.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Resource.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Image.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageCache.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Placeholder.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Filter.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Indicator.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Box.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Accelerate.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.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/Accelerate.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/os.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/hiro/Desktop/SwiftPractic/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Kingfisher.h /Users/hiro/Desktop/SwiftPractic/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/hiro/Desktop/SwiftPractic/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/String+MD5~partial.swiftdoc : /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/String+MD5.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Resource.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Image.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageCache.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Placeholder.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Filter.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Indicator.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Box.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Accelerate.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.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/Accelerate.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/os.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/hiro/Desktop/SwiftPractic/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hiro/Desktop/SwiftPractic/Pods/Kingfisher/Sources/Kingfisher.h /Users/hiro/Desktop/SwiftPractic/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
| D |
/Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/DerivedData/CryptoLive/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/Animator.o : /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Filters/DataApproximator+N.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/Legend.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/Description.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/DerivedData/CryptoLive/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
/Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/DerivedData/CryptoLive/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/Animator~partial.swiftmodule : /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Filters/DataApproximator+N.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/Legend.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/Description.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/DerivedData/CryptoLive/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
/Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/DerivedData/CryptoLive/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/Animator~partial.swiftdoc : /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Filters/DataApproximator+N.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/Legend.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/Description.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/Jaskeerat/Desktop/CryptoLive/CryptoLive/DerivedData/CryptoLive/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
| D |
/Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/HTTP.build/Body/HTTPBodyRepresentable.swift.o : /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/RFC1123.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/URL+HTTP.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPHeaders+Basic.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/Forwarded.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/MediaTypePreference.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBodyStorage.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPMessage.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBodyRepresentable.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPHeaderName.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPScheme.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPResponse.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Cookies/HTTPCookieValue.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPChunkedStream.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPClientProtocolUpgrader.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPServerResponder.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Codable/HTTPMessageCoder.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPHeaders+Bearer.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPServer.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPError.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Cookies/HTTPCookies.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPHeaders.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Exports.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPClient.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPRequest.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBody.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOTLS.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /usr/local/Cellar/libressl/2.7.4/include/openssl/asn1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/tls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/md5.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509.h /usr/local/Cellar/libressl/2.7.4/include/openssl/sha.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rsa.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOZlib/include/c_nio_zlib.h /usr/local/Cellar/libressl/2.7.4/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/hmac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ec.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/cpp_magic.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rand.h /usr/local/Cellar/libressl/2.7.4/include/openssl/conf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/lhash.h /usr/local/Cellar/libressl/2.7.4/include/openssl/stack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/safestack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-ssl.git--4203122085816746094/Sources/CNIOOpenSSL/include/c_nio_openssl.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bn.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIODarwin/include/c_nio_darwin.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bio.h /usr/local/Cellar/libressl/2.7.4/include/openssl/crypto.h /usr/local/Cellar/libressl/2.7.4/include/openssl/srtp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/evp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.7.4/include/openssl/buffer.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.7.4/include/openssl/err.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/c-atomics.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.7.4/include/openssl/objects.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslv.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOLinux/include/c_nio_linux.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509_vfy.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-zlib-support.git--4783613459776704231/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-ssl-support.git--7591788603050871532/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/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/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/HTTP.build/HTTPBodyRepresentable~partial.swiftmodule : /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/RFC1123.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/URL+HTTP.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPHeaders+Basic.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/Forwarded.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/MediaTypePreference.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBodyStorage.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPMessage.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBodyRepresentable.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPHeaderName.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPScheme.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPResponse.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Cookies/HTTPCookieValue.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPChunkedStream.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPClientProtocolUpgrader.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPServerResponder.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Codable/HTTPMessageCoder.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPHeaders+Bearer.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPServer.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPError.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Cookies/HTTPCookies.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPHeaders.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Exports.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPClient.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPRequest.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBody.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOTLS.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /usr/local/Cellar/libressl/2.7.4/include/openssl/asn1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/tls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/md5.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509.h /usr/local/Cellar/libressl/2.7.4/include/openssl/sha.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rsa.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOZlib/include/c_nio_zlib.h /usr/local/Cellar/libressl/2.7.4/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/hmac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ec.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/cpp_magic.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rand.h /usr/local/Cellar/libressl/2.7.4/include/openssl/conf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/lhash.h /usr/local/Cellar/libressl/2.7.4/include/openssl/stack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/safestack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-ssl.git--4203122085816746094/Sources/CNIOOpenSSL/include/c_nio_openssl.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bn.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIODarwin/include/c_nio_darwin.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bio.h /usr/local/Cellar/libressl/2.7.4/include/openssl/crypto.h /usr/local/Cellar/libressl/2.7.4/include/openssl/srtp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/evp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.7.4/include/openssl/buffer.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.7.4/include/openssl/err.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/c-atomics.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.7.4/include/openssl/objects.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslv.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOLinux/include/c_nio_linux.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509_vfy.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-zlib-support.git--4783613459776704231/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-ssl-support.git--7591788603050871532/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/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/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/HTTP.build/HTTPBodyRepresentable~partial.swiftdoc : /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/RFC1123.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/URL+HTTP.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPHeaders+Basic.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/Forwarded.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/MediaTypePreference.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBodyStorage.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPMessage.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBodyRepresentable.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPHeaderName.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPScheme.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPResponse.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Cookies/HTTPCookieValue.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPChunkedStream.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPClientProtocolUpgrader.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPServerResponder.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Codable/HTTPMessageCoder.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPHeaders+Bearer.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPServer.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Utilities/HTTPError.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Cookies/HTTPCookies.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPHeaders.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Exports.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Responder/HTTPClient.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Message/HTTPRequest.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/http.git--6227123644269730208/Sources/HTTP/Body/HTTPBody.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOTLS.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /usr/local/Cellar/libressl/2.7.4/include/openssl/asn1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/tls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/md5.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509.h /usr/local/Cellar/libressl/2.7.4/include/openssl/sha.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rsa.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOZlib/include/c_nio_zlib.h /usr/local/Cellar/libressl/2.7.4/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/hmac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ec.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/cpp_magic.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rand.h /usr/local/Cellar/libressl/2.7.4/include/openssl/conf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/lhash.h /usr/local/Cellar/libressl/2.7.4/include/openssl/stack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/safestack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-ssl.git--4203122085816746094/Sources/CNIOOpenSSL/include/c_nio_openssl.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bn.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIODarwin/include/c_nio_darwin.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bio.h /usr/local/Cellar/libressl/2.7.4/include/openssl/crypto.h /usr/local/Cellar/libressl/2.7.4/include/openssl/srtp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/evp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.7.4/include/openssl/buffer.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.7.4/include/openssl/err.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/c-atomics.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.7.4/include/openssl/objects.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslv.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOLinux/include/c_nio_linux.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509_vfy.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-zlib-support.git--4783613459776704231/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-ssl-support.git--7591788603050871532/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/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 |
// D import file generated from 'derelict\util\xtypes.d'
module derelict.util.xtypes;
version (freebsd)
{
version = GLX;
}
else
{
version (FreeBSD)
{
version = GLX;
}
else
{
version (linux)
{
version = GLX;
}
}
}
version (GLX)
{
alias int Bool;
alias uint VisualID;
alias byte* XPointer;
alias void Display;
alias uint XID;
alias XID Pixmap;
alias XID Font;
alias XID Window;
struct XExtData
{
int number;
XExtData* next;
extern (C) int function(XExtData*) free_private;
XPointer private_data;
}
struct Visual
{
XExtData* ext_data;
VisualID visualid;
int _class;
uint red_mask;
uint green_mask;
uint blue_mask;
int bits_per_rgb;
int map_entries;
}
struct XVisualInfo
{
Visual* visual;
VisualID visualid;
int screen;
int depth;
int _class;
uint red_mask;
uint green_mask;
uint blue_mask;
int colormap_size;
int bits_per_rgb;
}
}
| D |
module android.java.android.app.ActivityManager_RunningTaskInfo;
public import android.java.android.app.ActivityManager_RunningTaskInfo_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!ActivityManager_RunningTaskInfo;
import import1 = android.java.java.lang.Class;
| 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 vtkFloatTuple1TN;
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;
class vtkFloatTuple1TN {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(vtkFloatTuple1TN obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin vtkd_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
vtkd_im.delete_vtkFloatTuple1TN(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public this() {
this(vtkd_im.new_vtkFloatTuple1TN__SWIG_0(), true);
}
public this(float scalar) {
this(vtkd_im.new_vtkFloatTuple1TN__SWIG_1(scalar), true);
}
public this(float* init) {
this(vtkd_im.new_vtkFloatTuple1TN__SWIG_2(cast(void*)init), true);
}
public int GetSize() const {
auto ret = vtkd_im.vtkFloatTuple1TN_GetSize(cast(void*)swigCPtr);
return ret;
}
public float* GetData() {
auto ret = cast(float*)vtkd_im.vtkFloatTuple1TN_GetData__SWIG_0(cast(void*)swigCPtr);
return ret;
}
public float* opIndex(int i) {
auto ret = cast(float*)vtkd_im.vtkFloatTuple1TN_opIndex__SWIG_0(cast(void*)swigCPtr, i);
return ret;
}
public float opCall(int i) const {
auto ret = vtkd_im.vtkFloatTuple1TN_opCall(cast(void*)swigCPtr, i);
return ret;
}
public bool Compare(vtkFloatTuple1TN other, float tol) const {
bool ret = vtkd_im.vtkFloatTuple1TN_Compare(cast(void*)swigCPtr, vtkFloatTuple1TN.swigGetCPtr(other), tol) ? true : false;
if (vtkd_im.SwigPendingException.isPending) throw vtkd_im.SwigPendingException.retrieve();
return ret;
}
}
| D |
module hunt.http.codec.http.encode.PushPromiseGenerator;
import hunt.collection;
import hunt.http.codec.http.frame.Flags;
import hunt.http.codec.http.frame.Frame;
import hunt.http.codec.http.frame.FrameType;
import hunt.http.codec.http.frame.PushPromiseFrame;
import hunt.http.codec.http.hpack.HpackEncoder;
import hunt.http.HttpMetaData;
import hunt.http.codec.http.encode.FrameGenerator;
import hunt.http.codec.http.encode.HeaderGenerator;
import hunt.Exceptions;
import std.conv;
/**
*/
class PushPromiseGenerator :FrameGenerator {
private HpackEncoder encoder;
this(HeaderGenerator headerGenerator, HpackEncoder encoder) {
super(headerGenerator);
this.encoder = encoder;
}
override
List!(ByteBuffer) generate(Frame frame) {
PushPromiseFrame pushPromiseFrame = cast(PushPromiseFrame) frame;
return generatePushPromise(pushPromiseFrame.getStreamId(), pushPromiseFrame.getPromisedStreamId(),
pushPromiseFrame.getMetaData());
}
List!(ByteBuffer) generatePushPromise(int streamId, int promisedStreamId, HttpMetaData metaData) {
if (streamId < 0)
throw new IllegalArgumentException("Invalid stream id: " ~ streamId.to!string);
if (promisedStreamId < 0)
throw new IllegalArgumentException("Invalid promised stream id: " ~ promisedStreamId.to!string);
List!(ByteBuffer) list = new LinkedList!(ByteBuffer)();
int maxFrameSize = getMaxFrameSize();
// The promised streamId space.
int extraSpace = 4;
maxFrameSize -= extraSpace;
ByteBuffer hpacked = BufferUtils.allocate(maxFrameSize);
BufferUtils.clearToFill(hpacked);
encoder.encode(hpacked, metaData);
int hpackedLength = hpacked.position();
BufferUtils.flipToFlush(hpacked, 0);
int length = hpackedLength + extraSpace;
int flags = Flags.END_HEADERS;
ByteBuffer header = generateHeader(FrameType.PUSH_PROMISE, length, flags, streamId);
header.put!int(promisedStreamId);
BufferUtils.flipToFlush(header, 0);
list.add(header);
list.add(hpacked);
return list;
}
}
| D |
module android.java.android.content.res.AssetManager_AssetInputStream;
public import android.java.android.content.res.AssetManager_AssetInputStream_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!AssetManager_AssetInputStream;
import import0 = android.java.java.lang.Class;
| D |
// This file is part of Visual D
//
// Visual D integrates the D programming language into Visual Studio
// Copyright (c) 2010-2011 by Rainer Schuetze, All Rights Reserved
//
// 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 vdc.ast.expr;
import vdc.util;
import vdc.lexer;
import vdc.semantic;
import vdc.interpret;
import vdc.ast.node;
import vdc.ast.decl;
import vdc.ast.misc;
import vdc.ast.tmpl;
import vdc.ast.aggr;
import vdc.ast.mod;
import vdc.ast.type;
import vdc.ast.writer;
import vdc.parser.engine;
import stdext.util;
import std.conv;
import std.string;
////////////////////////////////////////////////////////////////
// Operator precedence - greater values are higher precedence
enum PREC
{
zero,
expr,
assign,
cond,
oror,
andand,
or,
xor,
and,
equal,
rel,
shift,
add,
mul,
pow,
unary,
primary,
}
shared static PREC precedence[NumTokens];
shared static char recursion[NumTokens];
////////////////////////////////////////////////////////////////
void writeExpr(CodeWriter writer, Expression expr, bool paren)
{
if(paren)
writer("(");
writer(expr);
if(paren)
writer(")");
}
enum Spaces
{
None = 0,
Left = 1,
Right = 2,
LeftRight = Left | Right
}
void writeOperator(CodeWriter writer, TokenId op, int spaces)
{
if(spaces & Spaces.Left)
writer(" ");
writer(op);
if(spaces & Spaces.Right)
writer(" ");
}
////////////////////////////////////////////////////////////////
//Expression:
class Expression : Node
{
// semantic data
Type type;
mixin ForwardCtor!();
abstract PREC getPrecedence();
override Type calcType()
{
if(!type)
return semanticErrorType(this, ".calcType not implemented");
return type;
}
}
//BinaryExpression:
// [Expression Expression]
class BinaryExpression : Expression
{
mixin ForwardCtor!();
TokenId getOperator() { return id; }
Expression getLeftExpr() { return getMember!Expression(0); }
Expression getRightExpr() { return getMember!Expression(1); }
override PREC getPrecedence() { return precedence[id]; }
bool isAssign() { return false; }
override void _semantic(Scope sc)
{
getLeftExpr().semantic(sc);
getRightExpr().semantic(sc);
}
override void toD(CodeWriter writer)
{
Expression exprL = getLeftExpr();
Expression exprR = getRightExpr();
bool parenL = (exprL.getPrecedence() < getPrecedence() + (recursion[id] == 'L' ? 0 : 1));
bool parenR = (exprR.getPrecedence() < getPrecedence() + (recursion[id] == 'R' ? 0 : 1));
writeExpr(writer, exprL, parenL);
writeOperator(writer, id, Spaces.LeftRight);
writeExpr(writer, exprR, parenR);
}
override Type calcType()
{
if(!type)
{
Type typeL = getLeftExpr().calcType();
Type typeR = getRightExpr().calcType();
type = typeL.commonType(typeR);
}
return type;
}
override Value interpret(Context sc)
{
Value vL, vR;
if(isAssign())
{
// right side evaluated first in assignments
vR = getRightExpr().interpret(sc);
vL = getLeftExpr().interpret(sc);
}
else
{
vL = getLeftExpr().interpret(sc);
vR = getRightExpr().interpret(sc);
}
version(all)
{
auto btL = cast(BasicType) vL.getType();
auto avR = cast(ArrayValueBase) vR;
if(btL && avR)
return vR.opBin_r(sc, id, vL);
return vL.opBin(sc, id, vR);
}
else
switch(id)
{
case TOK_equal: return vL.opBinOp!"=="(vR);
case TOK_notequal: return vL.opBinOp!"!="(vR);
case TOK_lt: return vL.opBinOp!"<"(vR);
case TOK_gt: return vL.opBinOp!">"(vR);
case TOK_le: return vL.opBinOp!"<="(vR);
case TOK_ge: return vL.opBinOp!">="(vR);
case TOK_unord: return vL.opBinOp!"!<>="(vR);
case TOK_ue: return vL.opBinOp!"!<>"(vR);
case TOK_lg: return vL.opBinOp!"<>"(vR);
case TOK_leg: return vL.opBinOp!"<>="(vR);
case TOK_ule: return vL.opBinOp!"!>"(vR);
case TOK_ul: return vL.opBinOp!"!>="(vR);
case TOK_uge: return vL.opBinOp!"!<"(vR);
case TOK_ug: return vL.opBinOp!"!<="(vR);
case TOK_is: return vL.opBinOp!"is"(vR);
case TOK_notcontains:return vL.opBinOp!"!in"(vR);
case TOK_notidentity:return vL.opBinOp!"!is"(vR);
case TOK_shl: return vL.opBinOp!"<<"(vR);
case TOK_shr: return vL.opBinOp!">>"(vR);
case TOK_ushr: return vL.opBinOp!">>>"(vR);
case TOK_add: return vL.opBinOp!"+"(vR);
case TOK_min: return vL.opBinOp!"-"(vR);
case TOK_mul: return vL.opBinOp!"*"(vR);
case TOK_pow: return vL.opBinOp!"^^"(vR);
case TOK_div: return vL.opBinOp!"/"(vR);
case TOK_mod: return vL.opBinOp!"%"(vR);
//[ "slice", ".." ],
//[ "dotdotdot", "..." ],
case TOK_xor: return vL.opBinOp!"^"(vR);
case TOK_and: return vL.opBinOp!"&"(vR);
case TOK_or: return vL.opBinOp!"|"(vR);
case TOK_tilde: return vL.opBinOp!"~"(vR);
//[ "plusplus", "++" ],
//[ "minusminus", "--" ],
//[ "question", "?" ],
case TOK_assign: return vL.opassign!"="(vR);
case TOK_addass: return vL.opassign!"+="(vR);
case TOK_minass: return vL.opassign!"-="(vR);
case TOK_mulass: return vL.opassign!"*="(vR);
case TOK_powass: return vL.opassign!"^^="(vR);
case TOK_shlass: return vL.opassign!"<<="(vR);
case TOK_shrass: return vL.opassign!">>="(vR);
case TOK_ushrass: return vL.opassign!">>>="(vR);
case TOK_xorass: return vL.opassign!"^="(vR);
case TOK_andass: return vL.opassign!"&="(vR);
case TOK_orass: return vL.opassign!"|="(vR);
case TOK_catass: return vL.opassign!"~="(vR);
case TOK_divass: return vL.opassign!"/="(vR);
case TOK_modass: return vL.opassign!"%="(vR);
default:
return semanticErrorType("interpretation of binary operator ", tokenString(id), " not implemented");
}
}
};
mixin template BinaryExpr()
{
this() {} // default constructor needed for clone()
this(Token tok)
{
super(tok);
}
}
class CommaExpression : BinaryExpression
{
mixin BinaryExpr!();
override Type calcType()
{
return getRightExpr().calcType();
}
}
class AssignExpression : BinaryExpression
{
override bool isAssign() { return true; }
mixin BinaryExpr!();
override Type calcType()
{
return getLeftExpr().calcType();
}
}
//ConditionalExpression:
// [Expression Expression Expression]
class ConditionalExpression : Expression
{
this() {} // default constructor needed for clone()
this(Token tok)
{
super(tok);
}
Expression getCondition() { return getMember!Expression(0); }
Expression getThenExpr() { return getMember!Expression(1); }
Expression getElseExpr() { return getMember!Expression(2); }
override PREC getPrecedence() { return PREC.cond; }
override void _semantic(Scope sc)
{
getCondition().semantic(sc);
getThenExpr().semantic(sc);
getElseExpr().semantic(sc);
}
override void toD(CodeWriter writer)
{
Expression condExpr = getCondition();
Expression thenExpr = getThenExpr();
Expression elseExpr = getElseExpr();
bool condParen = (condExpr.getPrecedence() <= getPrecedence());
bool thenParen = (thenExpr.getPrecedence() < PREC.expr);
bool elseParen = (elseExpr.getPrecedence() < getPrecedence());
writeExpr(writer, condExpr, condParen);
writeOperator(writer, TOK_question, Spaces.LeftRight);
writeExpr(writer, thenExpr, thenParen);
writeOperator(writer, TOK_colon, Spaces.LeftRight);
writeExpr(writer, elseExpr, elseParen);
}
override Type calcType()
{
if(!type)
{
Type typeL = getThenExpr().calcType();
Type typeR = getElseExpr().calcType();
type = typeL.commonType(typeR);
}
return type;
}
override Value interpret(Context sc)
{
Value cond = getCondition().interpret(sc);
Expression e = (cond.toBool() ? getThenExpr() : getElseExpr());
return e.interpret(sc); // TODO: cast to common type
}
}
class OrOrExpression : BinaryExpression
{
mixin BinaryExpr!();
override Type calcType()
{
if(!type)
type = createBasicType(TOK_bool);
return type;
}
override Value interpret(Context sc)
{
Value vL = getLeftExpr().interpret(sc);
if(vL.toBool())
return Value.create(true);
Value vR = getRightExpr().interpret(sc);
return Value.create(vR.toBool());
}
}
class AndAndExpression : BinaryExpression
{
mixin BinaryExpr!();
override Type calcType()
{
if(!type)
type = createBasicType(TOK_bool);
return type;
}
override Value interpret(Context sc)
{
Value vL = getLeftExpr().interpret(sc);
if(!vL.toBool())
return Value.create(false);
Value vR = getRightExpr().interpret(sc);
return Value.create(vR.toBool());
}
}
class OrExpression : BinaryExpression
{
mixin BinaryExpr!();
}
class XorExpression : BinaryExpression
{
mixin BinaryExpr!();
}
class AndExpression : BinaryExpression
{
mixin BinaryExpr!();
}
class CmpExpression : BinaryExpression
{
mixin BinaryExpr!();
void _checkIdentityLiterals()
{
if(id == TOK_is || id == TOK_notidentity)
{
if(auto litL = cast(IntegerLiteralExpression) getLeftExpr())
litL.forceLargerType(getRightExpr().calcType());
if(auto litR = cast(IntegerLiteralExpression) getRightExpr())
litR.forceLargerType(getLeftExpr().calcType());
}
}
override Type calcType()
{
if(!type)
{
_checkIdentityLiterals();
if(id == TOK_in)
{
auto t = getRightExpr().calcType();
if(auto ti = cast(TypeIndirection)t)
{
auto tp = new TypePointer();
tp.setNextType(ti.getNextType());
type = tp;
}
else
type = semanticErrorType("cannot calculate type of operator in on ", t);
}
else
type = createBasicType(TOK_bool);
}
return type;
}
override void _semantic(Scope sc)
{
_checkIdentityLiterals();
getLeftExpr().semantic(sc);
getRightExpr().semantic(sc);
}
}
class ShiftExpression : BinaryExpression
{
mixin BinaryExpr!();
}
class AddExpression : BinaryExpression
{
mixin BinaryExpr!();
}
class MulExpression : BinaryExpression
{
mixin BinaryExpr!();
}
class PowExpression : BinaryExpression
{
mixin BinaryExpr!();
}
//UnaryExpression:
// id [Expression]
class UnaryExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.unary; }
Expression getExpression() { return getMember!Expression(0); }
override void _semantic(Scope sc)
{
getExpression().semantic(sc);
}
override Type calcType()
{
if(!type)
{
Type exprtype = getExpression().calcType();
switch(id)
{
default:
type = exprtype;
break;
case TOK_delete:
type = createBasicType(TOK_void);
break;
case TOK_not:
type = createBasicType(TOK_bool);
break;
}
}
return type;
}
override Value interpret(Context sc)
{
Value v = getExpression().interpret(sc);
version(all)
switch(id)
{
case TOK_plusplus:
return v.opBin(sc, TOK_addass, Value.create(cast(byte)1));
case TOK_minusminus:
return v.opBin(sc, TOK_minass, Value.create(cast(byte)1));
case TOK_delete:
// TODO: call destructor?
v.opBin(sc, TOK_assign, v.getType().createValue(sc, null));
return theVoidValue;
default:
return v.opUn(sc, id);
}
else
switch(id)
{
case TOK_and: return v.opRefPointer();
case TOK_mul: return v.opDerefPointer();
case TOK_plusplus: return v.opUnOp!"++"();
case TOK_minusminus: return v.opUnOp!"--"();
case TOK_min: return v.opUnOp!"-"();
case TOK_add: return v.opUnOp!"+"();
case TOK_not: return v.opUnOp!"!"();
case TOK_tilde: return v.opUnOp!"~"();
default:
return semanticErrorValue("interpretation of unary operator ", tokenString(id), " not implemented");
}
}
override void toD(CodeWriter writer)
{
Expression expr = getExpression();
bool paren = (expr.getPrecedence() < getPrecedence());
writeOperator(writer, id, Spaces.Right);
writeExpr(writer, expr, paren);
}
}
//NewExpression:
// NewArguments Type [ AssignExpression ]
// NewArguments Type ( ArgumentList )
// NewArguments Type
// NewArguments ClassArguments BaseClassList_opt { DeclDefs }
class NewExpression : Expression
{
bool hasNewArgs;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(TOK_new, tok.span);
}
override NewExpression clone()
{
NewExpression n = static_cast!NewExpression(super.clone());
n.hasNewArgs = hasNewArgs;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.hasNewArgs == hasNewArgs;
}
override PREC getPrecedence() { return PREC.unary; }
ArgumentList getNewArguments() { return hasNewArgs ? getMember!ArgumentList(0) : null; }
Type getType() { return getMember!Type(hasNewArgs ? 1 : 0); }
ArgumentList getCtorArguments() { return members.length > (hasNewArgs ? 2 : 1) ? getMember!ArgumentList(members.length - 1) : null; }
override void _semantic(Scope sc)
{
if(auto args = getNewArguments())
args.semantic(sc);
getType().semantic(sc);
if(auto args = getCtorArguments())
args.semantic(sc);
}
override Type calcType()
{
return getType().calcType();
}
override Value interpret(Context sc)
{
Value initVal;
if(auto args = getCtorArguments())
initVal = args.interpret(sc);
else
initVal = new TupleValue; // empty args force new instance
return calcType().createValue(sc, initVal);
}
override void toD(CodeWriter writer)
{
if(ArgumentList nargs = getNewArguments())
writer("new(", nargs, ") ");
else
writer("new ");
writer(getType());
if(ArgumentList cargs = getCtorArguments())
writer("(", cargs, ")");
}
}
class AnonymousClassType : Type
{
mixin ForwardCtor!();
ArgumentList getArguments() { return members.length > 1 ? getMember!ArgumentList(0) : null; }
AnonymousClass getClass() { return getMember!AnonymousClass(members.length - 1); }
override bool propertyNeedsParens() const { return true; }
override void toD(CodeWriter writer)
{
if(ArgumentList args = getArguments())
writer("class(", args, ") ");
else
writer("class ");
writer(getClass());
}
override Type calcType()
{
return getClass().calcType();
}
}
//CastExpression:
// attr [Type_opt Expression]
class CastExpression : Expression
{
this() {} // default constructor needed for clone()
this(Token tok)
{
super(TOK_cast, tok.span);
}
override PREC getPrecedence() { return PREC.unary; }
Type getType() { return members.length > 1 ? getMember!Type(0) : null; }
Expression getExpression() { return getMember!Expression(members.length - 1); }
override void toD(CodeWriter writer)
{
writer("cast(");
writer.writeAttributesAndAnnotations(attr, annotation);
if(Type type = getType())
writer(getType());
writer(")");
if(getExpression().getPrecedence() < getPrecedence())
writer("(", getExpression(), ")");
else
writer(getExpression());
}
override void _semantic(Scope sc)
{
if(auto type = getType())
type.semantic(sc);
getExpression().semantic(sc);
}
override Type calcType()
{
if(type)
return type;
if(auto t = getType())
type = getType().calcType();
else
{
// extract basic type and attributes from expression
Type t = getExpression().calcType();
Attribute mattr = 0;
while(t)
{
auto mf = cast(ModifiedType) t;
if(!mf)
break;
mattr |= tokenToAttribute(mf.id);
t = mf.getType();
}
assert(t);
if(mattr != attr)
{
// rebuild modified type
for(Attribute a = attr, ta; a; a -= ta)
{
ta = a & -a;
TokenId aid = attributeToToken(attr);
auto mt = new ModifiedType(aid, span);
mt.addMember(t);
t = mt;
}
}
type = t;
}
return type;
}
override Value interpret(Context sc)
{
Value val = getExpression().interpret(sc);
Type t = calcType();
Type vt = val.getType();
if(t.compare(vt))
return val;
Value v = t.createValue(sc, null);
return v.doCast(val);
}
}
//PostfixExpression:
// PrimaryExpression
// PostfixExpression . Identifier
// PostfixExpression . NewExpression
// PostfixExpression ++
// PostfixExpression --
// PostfixExpression ( )
// PostfixExpression ( ArgumentList )
// IndexExpression
// SliceExpression
//
//IndexExpression:
// PostfixExpression [ ArgumentList ]
//
//SliceExpression:
// PostfixExpression [ ]
// PostfixExpression [ AssignExpression .. AssignExpression ]
class PostfixExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
Expression getExpression() { return getMember!Expression(0); }
override Type calcType()
{
if(type)
return type;
auto expr = getExpression();
auto etype = expr.calcType();
switch(id)
{
// TOK_dot handled by DotExpression
case TOK_lbracket:
if(members.length == 2) // if slice, same type as expression
{
auto args = getMember!ArgumentList(1);
auto vidx = args.interpret(nullContext);
Value idx;
if(vidx.values.length != 1)
return semanticErrorType("exactly one value expected as array index");
idx = vidx.values[0];
type = etype.opIndex(idx.toInt());
}
else if(members.length == 3)
{
Scope sc = getScope();
Value beg = getMember(1).interpret(nullContext);
Value end = getMember(2).interpret(nullContext);
type = etype.opSlice(beg.toInt(), end.toInt());
}
else
{
assert(members.length == 1); // full slice
type = etype;
}
break;
case TOK_lparen:
Type args;
if(members.length == 2)
args = getMember!ArgumentList(1).calcType();
else
args = new TypeArraySlice;
type = etype.opCall(args);
break;
default:
type = semanticErrorType("cannot determine type of ", this);
break;
}
return type;
}
override ArgumentList getFunctionArguments()
{
switch(id)
{
case TOK_lparen:
if(members.length == 2)
return getMember!ArgumentList(1);
return new ArgumentList;
default:
return null;
}
}
override Value interpret(Context sc)
{
Expression expr = getExpression();
Value val = expr.interpret(sc);
switch(id)
{
// TOK_dot handled by DotExpression
case TOK_lbracket:
if(members.length == 2)
{
auto args = getMember!ArgumentList(1);
auto vidx = args.interpret(sc);
Value idx;
if(vidx.values.length != 1)
return semanticErrorValue("exactly one value expected as array index");
idx = vidx.values[0];
return val.opIndex(idx);
}
else if(members.length == 3)
{
Value beg = getMember(1).interpret(sc);
Value end = getMember(2).interpret(sc);
return val.opSlice(beg, end);
}
assert(members.length == 1); // full slice
Node nodelen = val.getType().getScope().resolve("length", val.getType(), false);
if(nodelen)
return val.opSlice(Value.create(0), nodelen.interpret(sc));
return val;
case TOK_lparen:
TupleValue args;
if(members.length == 2)
args = getMember!ArgumentList(1).interpret(sc);
else
args = new TupleValue;
return val.opCall(sc, args);
case TOK_plusplus:
Value v2 = val.getType().createValue(sc, val);
val.opBin(sc, TOK_addass, Value.create(cast(byte)1));
return v2;
case TOK_minusminus:
Value v2 = val.getType().createValue(sc, val);
val.opBin(sc, TOK_minass, Value.create(cast(byte)1));
return v2;
case TOK_new:
default:
return super.interpret(sc);
}
}
override void toD(CodeWriter writer)
{
Expression expr = getExpression();
bool paren = (expr.getPrecedence() < getPrecedence());
writeExpr(writer, expr, paren);
switch(id)
{
case TOK_lbracket:
writer("[");
if(members.length == 2)
writer(getMember!ArgumentList(1));
else if(members.length == 3)
{
writer(getMember!Expression(1));
writer(" .. ");
writer(getMember!Expression(2));
}
writer("]");
break;
case TOK_lparen:
writer("(");
if(members.length > 1)
writer(getMember!ArgumentList(1));
writer(")");
break;
case TOK_dot:
case TOK_new:
writer(".", getMember(1));
break;
default:
writeOperator(writer, id, Spaces.Right);
break;
}
}
}
class DotExpression : PostfixExpression
{
mixin ForwardCtor!();
Identifier getIdentifier() { return id == TOK_new ? null : getMember!Identifier(1); }
Node resolved;
override Node resolve()
{
if(resolved)
return resolved;
auto expr = getExpression();
auto etype = expr.calcType();
switch(id)
{
case TOK_new:
auto nexpr = getMember!NewExpression(1);
resolved = nexpr.calcType();
break;
default:
auto id = getMember!Identifier(1);
if(auto pt = cast(TypePointer)etype)
etype = pt.getNextType();
Scope s = etype.getScope();
resolved = s ? s.resolve(id.ident, id, false) : null;
break;
}
return resolved;
}
override Type calcType()
{
if(type)
return type;
if(auto n = resolve())
type = n.calcType();
else if(id == TOK_new)
type = semanticErrorType("cannot resolve type of new expression ", getMember(1));
else
type = semanticErrorType("cannot resolve type of property ", getMember!Identifier(1).ident);
return type;
}
override Value interpret(Context sc)
{
Expression expr = getExpression();
Value val = expr.interpret(sc);
if(!type)
calcType();
if(!resolved)
return Singleton!ErrorValue.get(); // calcType already produced an error
//auto id = getMember!Identifier(1);
auto ctx = new AggrContext(sc, val);
if(expr.id == TOK_super)
ctx.virtualCall = false;
return resolved.interpret(ctx);
}
}
//ArgumentList:
// [Expression...]
class ArgumentList : Node
{
mixin ForwardCtor!();
override void _semantic(Scope sc)
{
foreach(m; members)
m.semantic(sc);
}
override TupleValue interpret(Context sc)
{
TupleValue args = new TupleValue;
foreach(m; members)
args.addValue(m.interpret(sc));
return args;
}
override void toD(CodeWriter writer)
{
bool writeSep = false;
foreach(m; members)
{
if(writeSep)
writer(", ");
writeSep = true;
bool paren = false;
if(auto expr = cast(Expression) m)
paren = (expr.getPrecedence() <= PREC.expr);
if(paren)
writer("(", m, ")");
else
writer(m);
}
}
}
//PrimaryExpression:
// Identifier
// . Identifier
// TemplateInstance
// this
// super
// null
// true
// false
// $
// __FILE__
// __LINE__
// IntegerLiteral
// FloatLiteral
// CharacterLiteral
// StringLiterals
// ArrayLiteral
// AssocArrayLiteral
// Lambda
// FunctionLiteral
// AssertExpression
// MixinExpression
// ImportExpression
// TypeProperty
// Typeof
// TypeidExpression
// IsExpression
// ( Expression )
// ( Type ) . Identifier
// TraitsExpression
class PrimaryExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
override Value interpret(Context sc)
{
switch(id)
{
case TOK_super:
case TOK_this:
Value v = sc ? sc.getThis() : null;
if(!v)
return semanticErrorValue("this needs context");
return v;
case TOK_true: return Value.create(true);
case TOK_false: return Value.create(false);
case TOK_null: return new NullValue;
case TOK___LINE__: return Value.create(span.start.line);
case TOK___FILE__: return createStringValue(getModuleFilename());
case TOK_dollar:
default: return super.interpret(sc);
}
}
override Type calcType()
{
if(type)
return type;
switch(id)
{
case TOK_this:
case TOK_super:
auto sc = getScope();
type = sc ? sc.getThisType() : null;
if(id == TOK_super)
if(auto clss = cast(Class)type)
if(auto bc = clss.getBaseClass())
type = bc.calcType();
if(!type)
type = semanticErrorType("this needs context");
break;
case TOK_true:
case TOK_false:
type = createBasicType(TOK_bool);
break;
case TOK_null:
type = Singleton!NullType.get();
break;
case TOK_dollar:
case TOK___LINE__:
type = createBasicType(TOK_uint);
break;
case TOK___FILE__:
type = getTypeString!char();
break;
default:
return super.calcType();
}
return type;
}
override void toD(CodeWriter writer)
{
writer(id);
}
}
//ArrayLiteral:
// [ ArgumentList ]
class ArrayLiteral : Expression
{
bool isAssoc;
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
ArgumentList getArgumentList() { return getMember!ArgumentList(0); }
override void toD(CodeWriter writer)
{
writer("[");
writer.writeArray(members);
writer("]");
}
override void _semantic(Scope sc)
{
super._semantic(sc);
auto argl = getArgumentList();
int cntPairs = 0;
int cntIndex = 0;
foreach(m; argl.members)
{
m.semantic(sc);
if(auto kv = cast(KeyValuePair) m)
{
Type kt = kv.getKey().calcType();
Type st = BasicType.getSizeType();
if(st.convertableFrom(kt, Type.ConversionFlags.kImpliciteConversion))
cntIndex++;
cntPairs++;
}
else
break;
}
if(cntPairs == argl.members.length && cntIndex < argl.members.length)
isAssoc = true;
if(!isAssoc)
{
type = new TypeDynamicArray;
if(argl.members.length)
{
Type vt = argl.members[0].calcType();
foreach(m; argl.members[1..$])
vt = vt.commonType(m.calcType());
type.addMember(vt.clone());
}
else
type.addMember(new AutoType(TOK_auto, span));
}
}
override Type calcType()
{
if(type)
return type;
semantic(getScope());
return type;
}
override Value interpret(Context sc)
{
TupleValue val;
if(auto args = getArgumentList())
val = args.interpret(sc);
else
val = new TupleValue;
if(auto tda = cast(TypeDynamicArray) calcType())
{
auto telem = tda.getNextType();
auto vda = new DynArrayValue(tda);
vda.setLength(sc, val.values.length);
for(size_t i = 0; i < val.values.length; i++)
vda.setItem(sc, i, val.values[i]);
debug vda.sval = vda.toStr();
return vda;
}
return val;
}
}
//VoidInitializer:
// void
class VoidInitializer : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
override Type calcType()
{
if(!type)
type = createBasicType(TOK_void);
return type;
}
override void toD(CodeWriter writer)
{
writer("void");
}
override Value interpret(Context sc)
{
return theVoidValue();
}
}
// used for Expression_opt in for and return statements
class EmptyExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.expr; }
override void toD(CodeWriter writer)
{
}
}
//KeyValuePair:
// [Expression Expression]
class KeyValuePair : BinaryExpression
{
mixin ForwardCtor!();
static this()
{
precedence[TOK_colon] = PREC.assign;
}
this() {} // default constructor needed for clone()
this(Token tok)
{
super(TOK_colon, tok.span);
}
Expression getKey() { return getMember!Expression(0); }
Expression getValue() { return getMember!Expression(1); }
}
//FunctionLiteral:
// id [ Type_opt ParameterList_opt FunctionBody ] attr
class FunctionLiteral : Expression
{
mixin ForwardCtor!();
Type getType() { return members.length > 2 ? getMember!Type(0) : null; }
override ParameterList getParameterList() { return getMember!ParameterList(members.length - 2); }
FunctionBody getFunctionBody() { return getMember!FunctionBody(members.length - 1); }
override PREC getPrecedence() { return PREC.primary; }
override void toD(CodeWriter writer)
{
if(id != 0)
writer(id, " ");
if(Type type = getType())
writer(type, " ");
writer(getParameterList(), " ");
writer.writeAttributesAndAnnotations(attr, annotation, false);
writer(getFunctionBody());
}
override bool createsScope() const { return true; }
override void _semantic(Scope sc)
{
if(auto t = getType())
t.semantic(sc);
sc = enterScope(sc);
getFunctionBody().semantic(sc);
sc = sc.pop();
}
TypeFunction func;
override Type calcType()
{
if(!func)
{
auto pl = getParameterList();
if(!pl)
pl = new ParameterList();
if(id == TOK_function)
{
auto funclit = new TypeFunctionLiteral;
funclit.paramList = pl;
func = funclit;
}
else
{
auto funclit = new TypeDelegateLiteral;
funclit.paramList = pl;
func = funclit;
}
/+
auto rt = getType();
if(!rt)
rt = new AutoType(TOK_auto, span);
else
rt = rt.clone();
func.addMember(rt);
auto pl = getParameterList();
if(!pl)
pl = new ParameterList();
else
pl = pl.clone();
func.addMember(pl);
+/
auto decl = new FuncLiteralDeclarator;
decl.type = func;
decl.funcbody = getFunctionBody();
func.funcDecl = decl;
}
return func;
}
override Value interpret(Context sc)
{
if(!func)
calcType();
if(id == TOK_function)
{
auto fn = new FunctionValue;
fn.functype = func;
return fn;
}
else
{
auto dg = new DelegateValue;
dg.context = sc;
dg.functype = func;
return dg;
}
}
}
//Lambda:
// [ ParameterList Expression ]
class Lambda : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
override void toD(CodeWriter writer)
{
writer(getMember(0), " => ", getMember(1));
}
}
class TypeFunctionLiteral : TypeFunction
{
override Type getReturnType()
{
if (returnType)
return returnType;
if(members.length)
returnType = getMember!Type(0);
// TODO: infer return type from code
if (!returnType)
returnType = new AutoType;
return returnType;
}
}
class TypeDelegateLiteral : TypeDelegate
{
override Type getReturnType()
{
if (returnType)
return returnType;
if(members.length)
returnType = getMember!Type(0);
// TODO: infer return type from code
if (!returnType)
returnType = new AutoType;
return returnType;
}
}
class FuncLiteralDeclarator : Declarator
{
FunctionBody funcbody;
override Value interpretCall(Context sc)
{
return funcbody.interpret(sc);
}
}
//StructLiteral:
// [ArrayValueList]
class StructLiteral : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
override void toD(CodeWriter writer)
{
writer("{ ", getMember(0), " }");
}
override Value interpret(Context sc)
{
return getMember(0).interpret(sc);
}
}
//AssertExpression:
// assert ( AssignExpression )
// assert ( AssignExpression , AssignExpression )
class AssertExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
Expression getExpression() { return getMember!Expression(0); }
Expression getMessage() { return getMember!Expression(1); }
override void toD(CodeWriter writer)
{
writer("assert(");
writer(getExpression());
if(Expression msg = getMessage())
writer(", ", msg);
writer(")");
}
override Value interpret(Context sc)
{
auto actx = new AssertContext(sc);
auto cond = getExpression().interpret(actx);
if(!cond.toBool())
{
string msg;
if(auto m = getMessage())
msg = m.interpret(sc).toMixin();
else
msg = "assertion " ~ writeD(getExpression()) ~ " failed";
foreach(id, val; actx.identVal)
msg ~= "\n\t" ~ writeD(id) ~ " = " ~ val.toStr();
return semanticErrorValue(msg);
}
return theVoidValue;
}
}
//MixinExpression:
// mixin ( AssignExpression )
class MixinExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
Expression getExpression() { return getMember!Expression(0); }
Expression resolved;
override void toD(CodeWriter writer)
{
if(resolved)
resolved.toD(writer);
else
writer("mixin(", getMember!Expression(0), ")");
}
override void _semantic(Scope sc)
{
if(resolved)
return;
Value v = getMember(0).interpretCatch(nullContext);
string s = v.toMixin();
Parser parser = new Parser;
if(auto prj = sc.getProject())
parser.saveErrors = prj.saveErrors;
Node n = parser.parseExpression(s, span);
resolved = cast(Expression) n;
if(resolved)
{
addMember(resolved);
resolved.semantic(sc);
}
}
override Type calcType()
{
if(!resolved)
semantic(getScope());
if(resolved)
return resolved.calcType();
return new ErrorType;
}
override Value interpret(Context sc)
{
if(!resolved)
semantic(getScope());
if(resolved)
return resolved.interpret(sc);
return semanticErrorValue("cannot interpret mixin");
}
}
//ImportExpression:
// import ( AssignExpression )
class ImportExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
Expression getExpression() { return getMember!Expression(0); }
override Type calcType()
{
if(!type)
type = getTypeString!char();
return type;
}
override void toD(CodeWriter writer)
{
writer("import(", getMember!Expression(0), ")");
}
}
//TypeidExpression:
// typeid ( Type )
// typeid ( Expression )
class TypeIdExpression : Expression
{
mixin ForwardCtor!();
override PREC getPrecedence() { return PREC.primary; }
override void toD(CodeWriter writer)
{
writer("typeid(", getMember(0), ")");
}
}
//IsExpression:
// is ( Type )
// is ( Type : TypeSpecialization )
// is ( Type == TypeSpecialization )
// is ( Type Identifier )
// is ( Type Identifier : TypeSpecialization )
// is ( Type Identifier == TypeSpecialization )
// is ( Type Identifier : TypeSpecialization , TemplateParameterList )
// is ( Type Identifier == TypeSpecialization , TemplateParameterList )
//
//TypeSpecialization:
// Type
// struct
// union
// class
// interface
// enum
// function
// delegate
// super
// const
// immutable
// inout
// shared
// return
//
class IsExpression : PrimaryExpression
{
int kind;
string ident;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(TOK_is, tok.span);
}
override IsExpression clone()
{
IsExpression n = static_cast!IsExpression(super.clone());
n.kind = kind;
n.ident = ident;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.kind == kind
&& tn.ident == ident;
}
Type getType() { return getMember!Type(0); }
TypeSpecialization getTypeSpecialization() { return members.length > 1 ? getMember!TypeSpecialization(1) : null; }
override void toD(CodeWriter writer)
{
writer("is(", getType());
if(ident.length)
{
writer(" ");
writer.writeIdentifier(ident);
}
if(kind != 0)
writer(" ", kind, " ");
if(auto ts = getTypeSpecialization())
writer(ts);
writer(")");
}
override Type calcType()
{
if(!type)
type = createBasicType(TOK_bool);
return type;
}
}
class TypeSpecialization : Node
{
mixin ForwardCtor!();
Type getType() { return getMember!Type(0); }
override void toD(CodeWriter writer)
{
if(id != 0)
writer(id);
else
writer(getMember(0));
}
}
class IdentifierExpression : PrimaryExpression
{
bool global;
// semantic data
Node resolved;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(TOK_Identifier, tok.span);
}
override IdentifierExpression clone()
{
IdentifierExpression n = static_cast!IdentifierExpression(super.clone());
n.global = global;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.global == global;
}
Identifier getIdentifier() { return getMember!Identifier(0); }
override void toD(CodeWriter writer)
{
if(global)
writer(".");
writer(getIdentifier());
}
override void toC(CodeWriter writer)
{
//resolve();
if(resolved)
{
Module thisMod = getModule();
Module thatMod = resolved.getModule();
if(global || thisMod is thatMod)
{
thatMod.writeNamespace(writer);
}
}
writer(getIdentifier());
}
override Node resolve()
{
if(resolved)
return resolved;
if(!scop)
semantic(getScope());
auto id = getIdentifier();
resolved = scop.resolveWithTemplate(id.ident, scop, id);
return resolved;
}
override void _semantic(Scope sc)
{
if(global)
scop = getModule().scop;
else
scop = sc;
resolve();
}
override Type calcType()
{
if(type)
return type;
if(!scop)
semantic(getScope());
if(resolved)
type = resolved.calcType();
if(!type)
return semanticErrorType("cannot determine type");
return type;
}
override ArgumentList getFunctionArguments()
{
if(parent)
return parent.getFunctionArguments();
return null;
}
override Value interpret(Context sc)
{
if(!resolved)
semantic(getScope());
if(!resolved)
return semanticErrorValue("unresolved identifier ", writeD(this));
Value v = resolved.interpret(sc);
if(auto actx = cast(AssertContext)sc)
actx.identVal[this] = v;
return v;
}
}
class IntegerLiteralExpression : PrimaryExpression
{
string txt;
ulong value; // literals are never negative by themselves
bool unsigned;
bool lng;
bool forceInt; // set in semantic pass
bool forceShort;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(tok);
txt = tok.txt;
initValue();
}
void initValue()
{
string val = txt;
while(val.length > 1)
{
if(val[$-1] == 'L')
lng = true;
else if(val[$-1] == 'U' || val[$-1] == 'u')
unsigned = true;
else
break;
val = val[0..$-1];
}
int radix = 10;
if(val[0] == '0' && val.length > 1)
{
if(val[1] == 'x' || val[1] == 'X')
{
radix = 16;
val = val[2..$];
}
else if(val[1] == 'b' || val[1] == 'B')
{
radix = 2;
val = val[2..$];
}
else
{
radix = 8;
}
unsigned = true;
}
val = removechars(val, "_");
value = parse!ulong(val, radix);
}
override IntegerLiteralExpression clone()
{
IntegerLiteralExpression n = static_cast!IntegerLiteralExpression(super.clone());
n.txt = txt;
n.value = value;
n.unsigned = unsigned;
n.lng = lng;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.txt == txt
&& tn.value == value
&& tn.unsigned == unsigned
&& tn.lng == lng;
}
override void toD(CodeWriter writer)
{
writer(txt);
}
void forceLargerType(Type t)
{
if(t.id == TOK_int || t.id == TOK_uint)
forceInt = true;
if(t.id == TOK_short || t.id == TOK_ushort)
forceShort = true;
}
override Type calcType()
{
if(type)
return type;
long lim = unsigned ? 0x1_0000_0000 : 0x8000_0000;
if(lng || value >= lim)
if(unsigned)
type = new BasicType(TOK_ulong, span);
else
type = new BasicType(TOK_long, span);
else if(true || forceInt || value >= (lim >> 16))
if(unsigned)
type = new BasicType(TOK_uint, span);
else
type = new BasicType(TOK_int, span);
else if(forceShort || value >= (lim >= 24))
if(unsigned)
type = new BasicType(TOK_ushort, span);
else
type = new BasicType(TOK_short, span);
else
if(unsigned)
type = new BasicType(TOK_ubyte, span);
else
type = new BasicType(TOK_byte, span);
return type;
}
override void _semantic(Scope sc)
{
calcType().semantic(sc);
}
Value _interpret(Context sc)
{
if(lng || value >= 0x80000000)
if(unsigned)
return Value.create(cast(ulong)value);
else
return Value.create(cast(long)value);
else if(true || forceInt || value >= 0x8000)
if(unsigned)
return Value.create(cast(uint)value);
else
return Value.create(cast(int)value);
else if(forceShort || value >= 0x80)
if(unsigned)
return Value.create(cast(ushort)value);
else
return Value.create(cast(short)value);
else
if(unsigned)
return Value.create(cast(ubyte)value);
else
return Value.create(cast(byte)value);
}
override Value interpret(Context sc)
{
Value v = _interpret(sc);
v.literal = true;
return v;
}
int getInt()
{
if(value > int.max)
semanticErrorPos(span.start, text(value, " too large to fit an integer"));
return cast(int) value;
}
uint getUInt()
{
if(value > uint.max)
semanticErrorPos(span.start, text(value, " too large to fit an unsigned integer"));
return cast(uint) value;
}
}
class FloatLiteralExpression : PrimaryExpression
{
string txt;
real value;
bool complex;
bool lng;
bool flt;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(tok);
txt = tok.txt;
initValue();
}
void initValue()
{
string val = txt;
while(val.length > 1)
{
if(val[$-1] == 'L')
lng = true;
else if(val[$-1] == 'f' || val[$-1] == 'F')
flt = true;
else if(val[$-1] == 'i')
complex = true;
else if(val[$-1] == '.')
{
val = val[0..$-1];
break;
}
else
break;
val = val[0..$-1];
}
val = removechars(val, "_");
value = parse!real(val);
}
override FloatLiteralExpression clone()
{
FloatLiteralExpression n = static_cast!FloatLiteralExpression(super.clone());
n.txt = txt;
n.value = value;
n.complex = complex;
n.lng = lng;
n.flt = flt;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.txt == txt
&& tn.value == value
&& tn.complex == complex
&& tn.flt == flt
&& tn.lng == lng;
}
override Type calcType()
{
if(type)
return type;
if(complex)
if(lng)
type = new BasicType(TOK_ireal, span);
else if(flt)
type = new BasicType(TOK_ifloat, span);
else
type = new BasicType(TOK_idouble, span);
else
if(lng)
type = new BasicType(TOK_real, span);
else if(flt)
type = new BasicType(TOK_float, span);
else
type = new BasicType(TOK_double, span);
return type;
}
override void _semantic(Scope sc)
{
calcType().semantic(sc);
}
Value _interpret(Context sc)
{
if(complex)
if(lng)
return Value.create(cast(ireal) (1i * value));
else if(flt)
return Value.create(cast(ifloat) (1i * value));
else
return Value.create(cast(idouble) (1i * value));
else
if(lng)
return Value.create(cast(real)value);
else if(flt)
return Value.create(cast(float)value);
else
return Value.create(cast(double)value);
}
override Value interpret(Context sc)
{
Value v = _interpret(sc);
v.literal = true;
return v;
}
override void toD(CodeWriter writer)
{
writer(txt);
}
}
class StringLiteralExpression : PrimaryExpression
{
string txt;
string rawtxt;
this() {} // default constructor needed for clone()
static string raw(string s)
{
if(s.length == 0)
return s;
if(s.length > 2 && s[0] == 'q' && s[1] == '{' && s[$-1] == '}')
return s[2..$-1];
// TODO: missing hex/escape translation and delimiter string handling
size_t p = 0;
while(p < s.length && s[p] != '"' && s[p] != '`')
p++;
if(p >= s.length)
return s;
size_t q = s.length - 1;
while(q > p && s[q] != s[p])
q--;
if(q <= p)
return s;
return s[p+1..q];
}
unittest
{
assert(raw(`r"abc"`) == "abc");
assert(raw(`q{abc}`) == "abc");
assert(raw(`"abc"c`) == "abc");
}
this(Token tok)
{
super(tok);
txt = tok.txt;
rawtxt = raw(txt);
}
void addText(Token tok)
{
txt ~= " " ~ tok.txt;
rawtxt ~= raw(tok.txt);
}
override StringLiteralExpression clone()
{
StringLiteralExpression n = static_cast!StringLiteralExpression(super.clone());
n.txt = txt;
n.rawtxt = rawtxt;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.txt == txt;
}
override Type calcType()
{
if(!type)
{
switch(txt[$-1])
{
default:
case 'c':
type = getTypeString!char();
break;
case 'w':
type = getTypeString!wchar();
break;
case 'd':
type = getTypeString!dchar();
break;
}
}
return type;
}
override void _semantic(Scope sc)
{
calcType();
}
override Value interpret(Context sc)
{
Value v = Value.create(rawtxt);
v.literal = true;
return v;
}
override void toD(CodeWriter writer)
{
writer(txt);
}
}
class CharacterLiteralExpression : PrimaryExpression
{
string txt;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(tok);
txt = tok.txt;
}
override CharacterLiteralExpression clone()
{
CharacterLiteralExpression n = static_cast!CharacterLiteralExpression(super.clone());
n.txt = txt;
return n;
}
override bool compare(const(Node) n) const
{
if(!super.compare(n))
return false;
auto tn = static_cast!(typeof(this))(n);
return tn.txt == txt;
}
override Type calcType()
{
if(type)
return type;
if(txt.length >= 3)
{
if(txt[$-1] == 'd')
type = new BasicType(TOK_dchar, span);
else if(txt[$-1] == 'w')
type = new BasicType(TOK_wchar, span);
}
if(!type)
type = new BasicType(TOK_char, span);
return type;
}
Value _interpret(Context sc)
{
if(txt.length < 3)
return Value.create(char.init);
// TODO: missing escape decoding
dchar ch = txt[1];
if(txt[$-1] == 'd')
return Value.create(ch);
if(txt[$-1] == 'w')
return Value.create(cast(wchar)ch);
return Value.create(cast(char)ch);
}
override Value interpret(Context sc)
{
Value v = _interpret(sc);
v.literal = true;
return v;
}
override void _semantic(Scope sc)
{
calcType().semantic(sc);
}
override void toD(CodeWriter writer)
{
writer(txt);
}
}
//TypeProperty:
// [Type Identifier]
class TypeProperty : PrimaryExpression
{
Node resolved;
this() {} // default constructor needed for clone()
this(Token tok)
{
super(0, tok.span);
}
Type getType() { return getMember!Type(0); }
Identifier getProperty() { return getMember!Identifier(1); }
override void toD(CodeWriter writer)
{
Type type = getType();
if(type.propertyNeedsParens())
writer("(", getType(), ").", getProperty());
else
writer(getType(), ".", getProperty());
}
override Node resolve()
{
if(resolved)
return resolved;
auto id = getProperty();
resolved = getType().getScope().resolve(id.ident, id);
return resolved;
}
override Type calcType()
{
if(type)
return type;
if(auto n = resolve())
type = n.calcType();
else
type = semanticErrorType("cannot determine type of property ", getProperty().ident);
return type;
}
override Value interpret(Context sc)
{
if(!type)
calcType();
if(!resolved)
return Singleton!ErrorValue.get(); // calcType already produced an error
return resolved.interpret(nullContext);
}
}
class StructConstructor : PrimaryExpression
{
this() {} // default constructor needed for clone()
this(Token tok)
{
super(0, tok.span);
}
Type getType() { return getMember!Type(0); }
ArgumentList getArguments() { return getMember!ArgumentList(1); }
override void toD(CodeWriter writer)
{
Type type = getType();
if(type.propertyNeedsParens())
writer("(", getType(), ")(", getArguments(), ")");
else
writer(getType(), "(", getArguments(), ")");
}
}
class TraitsExpression : PrimaryExpression
{
this() {} // default constructor needed for clone()
this(Token tok)
{
super(TOK___traits, tok.span);
}
override void toD(CodeWriter writer)
{
writer("__traits(", getMember(0));
if(members.length > 1)
writer(", ", getMember(1));
writer(")");
}
}
class TraitsArguments : TemplateArgumentList
{
mixin ForwardCtorNoId!();
}
| D |
/*******************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module org.eclipse.swt.custom.TableTree;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.TreeListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.custom.TableTreeItem;
import java.lang.all;
/**
* A TableTree is a selectable user interface object
* that displays a hierarchy of items, and issues
* notification when an item is selected.
* A TableTree may be single or multi select.
* <p>
* The item children that may be added to instances of this class
* must be of type <code>TableTreeItem</code>.
* </p><p>
* Note that although this class is a subclass of <code>Composite</code>,
* it does not make sense to add <code>Control</code> children to it,
* or set a layout on it.
* </p><p>
* <dl>
* <dt><b>Styles:</b> <dd> SINGLE, MULTI, CHECK, FULL_SELECTION
* <dt><b>Events:</b> <dd> Selection, DefaultSelection, Collapse, Expand
* </dl>
* <p>
* Note: Only one of the styles SINGLE, and MULTI may be specified.
* </p>
*
* @deprecated As of 3.1 use Tree, TreeItem and TreeColumn
*/
public class TableTree : Composite {
alias Composite.computeSize computeSize;
Table table;
TableTreeItem[] items;
Image plusImage, minusImage, sizeImage;
/*
* TableTreeItems are not treated as children but rather as items.
* When the TableTree is disposed, all children are disposed because
* TableTree inherits this behaviour from Composite. The items
* must be disposed separately. Because TableTree is not part of
* the org.eclipse.swt.widgets module, the method releaseWidget can
* not be overridden (this is how items are disposed of in Table and Tree).
* Instead, the items are disposed of in response to the dispose event on the
* TableTree. The "inDispose" flag is used to distinguish between disposing
* one TableTreeItem (e.g. when removing an entry from the TableTree) and
* disposing the entire TableTree.
*/
bool inDispose = false;
static /+const+/ TableTreeItem[] EMPTY_ITEMS;
static /+const+/ String[] EMPTY_TEXTS;
static /+const+/ Image[] EMPTY_IMAGES;
static /+const+/ String ITEMID = "TableTreeItemID"; //$NON-NLS-1$
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* lists the style constants that are applicable to the class.
* Style bits are also inherited from superclasses.
* </p>
*
* @param parent a widget which will be the parent of the new instance (cannot be null)
* @param style the style of widget to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
*
* @see SWT#SINGLE
* @see SWT#MULTI
* @see SWT#CHECK
* @see SWT#FULL_SELECTION
* @see #getStyle
*/
public this(Composite parent, int style) {
super(parent, checkStyle (style));
items = EMPTY_ITEMS;
table = new Table(this, style);
Listener tableListener = new class() Listener {
public void handleEvent(Event e) {
switch (e.type) {
case SWT.MouseDown: onMouseDown(e); break;
case SWT.Selection: onSelection(e); break;
case SWT.DefaultSelection: onSelection(e); break;
case SWT.KeyDown: onKeyDown(e); break;
default:
}
}
};
int[] tableEvents = [SWT.MouseDown,
SWT.Selection,
SWT.DefaultSelection,
SWT.KeyDown];
for (int i = 0; i < tableEvents.length; i++) {
table.addListener(tableEvents[i], tableListener);
}
Listener listener = new class() Listener {
public void handleEvent(Event e) {
switch (e.type) {
case SWT.Dispose: onDispose(e); break;
case SWT.Resize: onResize(e); break;
case SWT.FocusIn: onFocusIn(e); break;
default:
}
}
};
int[] events = [SWT.Dispose,
SWT.Resize,
SWT.FocusIn];
for (int i = 0; i < events.length; i++) {
addListener(events[i], listener);
}
}
int addItem(TableTreeItem item, int index) {
if (index < 0 || index > items.length) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
TableTreeItem[] newItems = new TableTreeItem[items.length + 1];
System.arraycopy(items, 0, newItems, 0, index);
newItems[index] = item;
System.arraycopy(items, index, newItems, index + 1, items.length - index);
items = newItems;
/* Return the index in the table where this table should be inserted */
if (index is items.length - 1 )
return table.getItemCount();
else
return table.indexOf(items[index+1].tableItem);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when the user changes the receiver's selection, by sending
* it one of the messages defined in the <code>SelectionListener</code>
* interface.
* <p>
* When <code>widgetSelected</code> is called, the item field of the event object is valid.
* If the receiver has <code>SWT.CHECK</code> style set and the check selection changes,
* the event object detail field contains the value <code>SWT.CHECK</code>.
* <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
* The item field of the event object is valid for default selection, but the detail field is not used.
* </p>
*
* @param listener the listener which should be notified when the user changes the receiver's selection
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #removeSelectionListener
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget();
if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Selection,typedListener);
addListener (SWT.DefaultSelection,typedListener);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when an item in the receiver is expanded or collapsed
* by sending it one of the messages defined in the <code>TreeListener</code>
* interface.
*
* @param listener the listener which should be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see TreeListener
* @see #removeTreeListener
*/
public void addTreeListener(TreeListener listener) {
checkWidget();
if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Expand, typedListener);
addListener (SWT.Collapse, typedListener);
}
private static int checkStyle (int style) {
int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
style = style & mask;
return style;
}
public override Point computeSize (int wHint, int hHint, bool changed) {
checkWidget();
return table.computeSize (wHint, hHint, changed);
}
public override Rectangle computeTrim (int x, int y, int width, int height) {
checkWidget();
return table.computeTrim(x, y, width, height);
}
/**
* Deselects all items.
* <p>
* If an item is selected, it is deselected.
* If an item is not selected, it remains unselected.
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
* </ul>
*/
public void deselectAll () {
checkWidget();
table.deselectAll();
}
/* Expand upward from the specified leaf item. */
void expandItem (TableTreeItem item) {
if (item is null) return;
expandItem(item.parentItem);
if (!item.getVisible()) item.setVisible(true);
if ( !item.expanded && item.items.length > 0) {
item.setExpanded(true);
Event event = new Event();
event.item = item;
notifyListeners(SWT.Expand, event);
}
}
public override Color getBackground () {
// This method must be overridden otherwise, in a TableTree in which the first
// item has no sub items, a grey (Widget background colour) square will appear in
// the first column of the first item.
// It is not possible in the constructor to set the background of the TableTree
// to be the same as the background of the Table because this interferes with
// the TableTree adapting to changes in the System color settings.
return table.getBackground();
}
public override Rectangle getClientArea () {
return table.getClientArea();
}
public override Color getForeground () {
return table.getForeground();
}
public override Font getFont () {
return table.getFont();
}
/**
* Gets the number of items.
* <p>
* @return the number of items in the widget
*/
public int getItemCount () {
//checkWidget();
return cast(int)/*64bit*/items.length;
}
/**
* Gets the height of one item.
* <p>
* This operation will fail if the height of
* one item could not be queried from the OS.
*
* @return the height of one item in the widget
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
* </ul>
*/
public int getItemHeight () {
checkWidget();
return table.getItemHeight();
}
/**
* Gets the items.
* <p>
* @return the items in the widget
*/
public TableTreeItem [] getItems () {
//checkWidget();
TableTreeItem[] newItems = new TableTreeItem[items.length];
System.arraycopy(items, 0, newItems, 0, items.length);
return newItems;
}
/**
* Gets the selected items.
* <p>
* This operation will fail if the selected
* items cannot be queried from the OS.
*
* @return the selected items in the widget
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
* </ul>
*/
public TableTreeItem [] getSelection () {
checkWidget();
TableItem[] selection = table.getSelection();
TableTreeItem [] result = new TableTreeItem[selection.length];
for (int i = 0; i < selection.length; i++){
result[i] = cast(TableTreeItem) selection[i].getData(ITEMID);
}
return result;
}
/**
* Gets the number of selected items.
* <p>
* This operation will fail if the number of selected
* items cannot be queried from the OS.
*
* @return the number of selected items in the widget
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
* </ul>
*/
public int getSelectionCount () {
checkWidget();
return table.getSelectionCount();
}
public override int getStyle () {
checkWidget();
return table.getStyle();
}
/**
* Returns the underlying Table control.
*
* @return the underlying Table control
*/
public Table getTable () {
//checkWidget();
return table;
}
void createImages () {
int itemHeight = sizeImage.getBounds().height;
// Calculate border around image.
// At least 9 pixels are needed to draw the image
// Leave at least a 6 pixel border.
int indent = Math.min(6, (itemHeight - 9) / 2);
indent = Math.max(0, indent);
int size = Math.max (10, itemHeight - 2 * indent);
size = ((size + 1) / 2) * 2; // size must be an even number
int midpoint = indent + size / 2;
Color foreground = getForeground();
Color plusMinus = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
Color background = getBackground();
/* Plus image */
PaletteData palette = new PaletteData( [ foreground.getRGB(), background.getRGB(), plusMinus.getRGB()]);
ImageData imageData = new ImageData(itemHeight, itemHeight, 4, palette);
imageData.transparentPixel = 1;
plusImage = new Image(getDisplay(), imageData);
GC gc = new GC(plusImage);
gc.setBackground(background);
gc.fillRectangle(0, 0, itemHeight, itemHeight);
gc.setForeground(plusMinus);
gc.drawRectangle(indent, indent, size, size);
gc.setForeground(foreground);
gc.drawLine(midpoint, indent + 2, midpoint, indent + size - 2);
gc.drawLine(indent + 2, midpoint, indent + size - 2, midpoint);
gc.dispose();
/* Minus image */
palette = new PaletteData([foreground.getRGB(), background.getRGB(), plusMinus.getRGB()]);
imageData = new ImageData(itemHeight, itemHeight, 4, palette);
imageData.transparentPixel = 1;
minusImage = new Image(getDisplay(), imageData);
gc = new GC(minusImage);
gc.setBackground(background);
gc.fillRectangle(0, 0, itemHeight, itemHeight);
gc.setForeground(plusMinus);
gc.drawRectangle(indent, indent, size, size);
gc.setForeground(foreground);
gc.drawLine(indent + 2, midpoint, indent + size - 2, midpoint);
gc.dispose();
}
Image getPlusImage() {
if (plusImage is null) createImages();
return plusImage;
}
Image getMinusImage() {
if (minusImage is null) createImages();
return minusImage;
}
/**
* Gets the index of an item.
*
* <p>The widget is searched starting at 0 until an
* item is found that is equal to the search item.
* If no item is found, -1 is returned. Indexing
* is zero based. This index is relative to the parent only.
*
* @param item the search item
* @return the index of the item or -1
*/
public int indexOf (TableTreeItem item) {
//checkWidget();
for (int i = 0; i < items.length; i++) {
if (item is items[i]) return i;
}
return -1;
}
void onDispose(Event e) {
/*
* Usually when an item is disposed, destroyItem will change the size of the items array
* and dispose of the underlying table items.
* Since the whole table tree is being disposed, this is not necessary. For speed
* the inDispose flag is used to skip over this part of the item dispose.
*/
inDispose = true;
for (int i = 0; i < items.length; i++) {
items[i].dispose();
}
inDispose = false;
if (plusImage !is null) plusImage.dispose();
if (minusImage !is null) minusImage.dispose();
if (sizeImage !is null) sizeImage.dispose();
plusImage = minusImage = sizeImage = null;
}
void onResize(Event e) {
Point size = getSize();
table.setBounds(0, 0, size.x, size.y);
}
void onSelection(Event e) {
Event event = new Event();
TableItem tableItem = cast(TableItem)e.item;
TableTreeItem item = getItem(tableItem);
event.item = item;
if (e.type is SWT.Selection && e.detail is SWT.CHECK && item !is null) {
event.detail = SWT.CHECK;
item.checked = tableItem.getChecked();
}
notifyListeners(e.type, event);
}
/**
* Returns the item at the given, zero-relative index in the
* receiver. Throws an exception if the index is out of range.
*
* @param index the index of the item to return
* @return the item at the given index
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.1
*/
public TableTreeItem getItem (int index) {
checkWidget();
int count = cast(int)/*64bit*/items.length;
if (!(0 <= index && index < count)) SWT.error (SWT.ERROR_INVALID_RANGE);
return items [index];
}
/**
* Returns the item at the given point in the receiver
* or null if no such item exists. The point is in the
* coordinate system of the receiver.
*
* @param point the point used to locate the item
* @return the item at the given point
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the point is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableTreeItem getItem(Point point) {
checkWidget();
TableItem item = table.getItem(point);
if (item is null) return null;
return getItem(item);
}
TableTreeItem getItem(TableItem tableItem) {
if (tableItem is null) return null;
for (int i = 0; i < items.length; i++) {
TableTreeItem item = items[i].getItem(tableItem);
if (item !is null) return item;
}
return null;
}
void onFocusIn (Event e) {
table.setFocus();
}
void onKeyDown (Event e) {
TableTreeItem[] selection = getSelection();
if (selection.length is 0) return;
TableTreeItem item = selection[0];
int type = 0;
if (e.keyCode is SWT.ARROW_RIGHT || e.keyCode is SWT.ARROW_LEFT) {
int trailKey = (getStyle() & SWT.MIRRORED) !is 0 ? SWT.ARROW_LEFT : SWT.ARROW_RIGHT;
if (e.keyCode is trailKey) {
if (item.getItemCount() is 0) return;
if (item.getExpanded()) {
TableTreeItem newSelection = item.getItems()[0];
table.setSelection([newSelection.tableItem]);
showItem(newSelection);
type = SWT.Selection;
} else {
item.setExpanded(true);
type = SWT.Expand;
}
} else {
if (item.getExpanded()) {
item.setExpanded(false);
type = SWT.Collapse;
} else {
TableTreeItem parent = item.getParentItem();
if (parent !is null) {
int index = parent.indexOf(item);
if (index !is 0) return;
table.setSelection([parent.tableItem]);
type = SWT.Selection;
}
}
}
}
if (e.character is '*') {
item.expandAll(true);
}
if (e.character is '-') {
if (item.getExpanded()) {
item.setExpanded(false);
type = SWT.Collapse;
}
}
if (e.character is '+') {
if (item.getItemCount() > 0 && !item.getExpanded()) {
item.setExpanded(true);
type = SWT.Expand;
}
}
if (type is 0) return;
Event event = new Event();
event.item = item;
notifyListeners(type, event);
}
void onMouseDown(Event event) {
/* If user clicked on the [+] or [-], expand or collapse the tree. */
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i++) {
Rectangle rect = items[i].getImageBounds(0);
if (rect.contains(event.x, event.y)) {
TableTreeItem item = cast(TableTreeItem) items[i].getData(ITEMID);
event = new Event();
event.item = item;
item.setExpanded(!item.getExpanded());
if (item.getExpanded()) {
notifyListeners(SWT.Expand, event);
} else {
notifyListeners(SWT.Collapse, event);
}
return;
}
}
}
/**
* Removes all items.
* <p>
* This operation will fail when an item
* could not be removed in the OS.
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
* </ul>
*/
public void removeAll () {
checkWidget();
setRedraw(false);
for (ptrdiff_t i = cast(ptrdiff_t) (items.length) - 1; i >= 0; i--) {
items[i].dispose();
}
items = EMPTY_ITEMS;
setRedraw(true);
}
void removeItem(TableTreeItem item) {
int index = 0;
while (index < items.length && items[index] !is item) index++;
if (index is items.length) return;
TableTreeItem[] newItems = new TableTreeItem[items.length - 1];
System.arraycopy(items, 0, newItems, 0, index);
System.arraycopy(items, index + 1, newItems, index, items.length - index - 1);
items = newItems;
}
/**
* Removes the listener from the collection of listeners who will
* be notified when the user changes the receiver's selection.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #addSelectionListener
*/
public void removeSelectionListener (SelectionListener listener) {
checkWidget();
if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
removeListener(SWT.Selection, listener);
removeListener(SWT.DefaultSelection, listener);
}
/**
* Removes the listener from the collection of listeners who will
* be notified when items in the receiver are expanded or collapsed.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see TreeListener
* @see #addTreeListener
*/
public void removeTreeListener (TreeListener listener) {
checkWidget();
if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
removeListener(SWT.Expand, listener);
removeListener(SWT.Collapse, listener);
}
/**
* Selects all of the items in the receiver.
* <p>
* If the receiver is single-select, do nothing.
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
* </ul>
*/
public void selectAll () {
checkWidget();
table.selectAll();
}
public override void setBackground (Color color) {
super.setBackground(color);
table.setBackground(color);
if (sizeImage !is null) {
GC gc = new GC (sizeImage);
gc.setBackground(getBackground());
Rectangle size = sizeImage.getBounds();
gc.fillRectangle(size);
gc.dispose();
}
}
public override void setEnabled (bool enabled) {
super.setEnabled(enabled);
table.setEnabled(enabled);
}
public override void setFont (Font font) {
super.setFont(font);
table.setFont(font);
}
public override void setForeground (Color color) {
super.setForeground(color);
table.setForeground(color);
}
public override void setMenu (Menu menu) {
super.setMenu(menu);
table.setMenu(menu);
}
/**
* Sets the receiver's selection to be the given array of items.
* The current selection is cleared before the new items are selected.
* <p>
* Items that are not in the receiver are ignored.
* If the receiver is single-select and multiple items are specified,
* then all items are ignored.
*
* @param items the array of items
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see TableTree#deselectAll()
*/
public void setSelection (TableTreeItem[] items) {
checkWidget ();
// SWT extension: allow null for zero length string
//if (items is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
int length = cast(int)/*64bit*/items.length;
if (length is 0 || ((table.getStyle() & SWT.SINGLE) !is 0 && length > 1)) {
deselectAll();
return;
}
TableItem[] tableItems = new TableItem[length];
for (int i = 0; i < length; i++) {
if (items[i] is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (!items[i].getVisible()) expandItem (items[i]);
tableItems[i] = items[i].tableItem;
}
table.setSelection(tableItems);
}
public override void setToolTipText (String string) {
super.setToolTipText(string);
table.setToolTipText(string);
}
/**
* Shows the item. If the item is already showing in the receiver,
* this method simply returns. Otherwise, the items are scrolled
* and expanded until the item is visible.
*
* @param item the item to be shown
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the item is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see TableTree#showSelection()
*/
public void showItem (TableTreeItem item) {
checkWidget();
if (item is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (!item.getVisible()) expandItem (item);
TableItem tableItem = item.tableItem;
table.showItem(tableItem);
}
/**
* Shows the selection.
* <p>
* If there is no selection or the selection
* is already visible, this method does nothing.
* If the selection is scrolled out of view,
* the top index of the widget is changed such
* that selection becomes visible.
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
* </ul>
*/
public void showSelection () {
checkWidget();
table.showSelection();
}
}
| D |
/*
* Copyright (c) 2016-2018 sel-project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
module soupply.gen.diff;
import std.algorithm : min, max, canFind, sort;
import std.conv : to;
import std.datetime : Date;
static import std.file;
import std.xml;
import std.path : dirSeparator;
import std.regex : ctRegex, replaceAll, matchFirst;
import std.string;
import std.typecons : Tuple, tuple;
version(Diff):
import soupply.main;
void diff(Attributes[string] attributes, Protocols[string] protocols, Metadatas[string] metadatas) {
enum defaultTypes = ["bool", "byte", "ubyte", "short", "ushort", "int", "uint", "long", "ulong", "float", "double", "string", "varshort", "varushort", "varint", "varuint", "varlong", "varulong", "triad", "uuid", "bytes", "metadata"];
@property string convert(string type) {
auto end = min(cast(size_t)type.lastIndexOf("["), cast(size_t)type.lastIndexOf("<"), type.length);
immutable t = type[0..end];
immutable e = type[end..$].replace("<", "<").replace(">", ">");
if(defaultTypes.canFind(t)) return t ~ e;
else return toCamelCase(t) ~ e;
}
bool isFieldChanged(Field fa, Field fb) {
if(fa.name != fb.name || fa.type != fb.type || fa.condition != fb.condition || fa.endianness != fb.endianness || fa.constants.length != fb.constants.length) return true;
foreach(j ; 0..fa.constants.length) {
if(fa.constants[j].name != fb.constants[j].name || fa.constants[j].value != fb.constants[j].value) return true;
}
return false;
}
bool isPacketChanged(Packet a, Packet b) {
bool checkFields(Field[] fa, Field[] fb) {
if(fa.length != fb.length) return true;
foreach(i ; 0..fa.length) {
if(isFieldChanged(fa[i], fb[i])) return true;
}
return false;
}
// check if fields, constants or variants are different
if(checkFields(a.fields, b.fields) || a.variantField != b.variantField || a.variants.length != b.variants.length) return true;
//TODO check variants
return false;
}
void writeDiff(ref string data, string space, Field[] a, Field[] b) {
data ~= space ~ "<table>\n";
data ~= space ~ "\t<tr><th>Field</th><th>Type</th></tr>\n";
string con;
foreach(i ; 0..max(a.length, b.length)) {
void writeImpl(Field field, string cls="", bool cons=false) {
data ~= space ~ "\t<tr" ~ (cls.length ? " class=\"" ~ cls ~ "\"" : "") ~ "><td>" ~ field.name.replace("_", " ") ~ "</td><td>" ~ convert(field.type) ~ "</td></tr>\n";
if(field.constants.length && cons) {
con ~= space ~ "\t<li>\n";
con ~= space ~ "\t\t<p>" ~ field.name.replace("_", " ") ~ "</p>\n";
con ~= space ~ "\t\t<table>\n";
con ~= space ~ "\t\t\t<tr><th>Constant</th><th>Value</th></tr>\n";
foreach(c ; field.constants) {
con ~= space ~ "\t\t\t<tr><td>" ~ c.name.replace("_", " ") ~ "</td><td class=\"center\">" ~ c.value ~ "</td></tr>\n";
}
con ~= space ~ "\t\t</table>\n";
con ~= space ~ "\t</li>\n";
}
}
if(i >= a.length) {
// added
writeImpl(b[i], "added");
} else if(i >= b.length) {
// removed
writeImpl(a[i], "removed");
} else {
// may be modified
if(isFieldChanged(a[i], b[i])) {
bool c_name = a[i].name != b[i].name;
bool c_type = convert(a[i].type) != convert(b[i].type);
data ~= space ~ "\t<tr>";
if(c_name) data ~= "<td class=\"removed\">" ~ toCamelCase(a[i].name) ~ "</td>";
else data ~= "<td rowspan=\"2\">" ~ toCamelCase(a[i].name) ~ "</td>";
if(c_type) data ~= "<td class=\"removed\">" ~ convert(a[i].type) ~ "</td>";
else data ~= "<td rowspan=\"2\">" ~ convert(a[i].type) ~ "</td>";
data ~= "</tr>\n" ~ space ~ "\t<tr>";
if(c_name) data ~= "<td class=\"added\">" ~ toCamelCase(b[i].name) ~ "</td>";
if(c_type) data ~= "<td class=\"added\">" ~ convert(b[i].type) ~ "</td>";
data ~= "</tr>\n";
if(a[i].constants.length || b[i].constants.length) {
con ~= space ~ "\t<li>\n";
con ~= space ~ "\t\t<p>" ~ toCamelCase(a[i].name) ~ "</p>\n";
con ~= space ~ "\t\t<table>\n";
con ~= space ~ "\t\t\t<tr><th>Constant</th><th>Value</th></tr>\n";
foreach(j ; 0..max(a[i].constants.length, b[i].constants.length)) {
if(j >= a[i].constants.length) {
con ~= space ~ "\t\t\t<tr class=\"added\"><td>" ~ b[i].constants[j].name.replace("_", " ") ~ "</td><td class=\"center\">" ~ b[i].constants[j].value ~ "</td></tr>\n";
} else if(j >= b[i].constants.length) {
con ~= space ~ "\t\t\t<tr class=\"removed\"><td>" ~ a[i].constants[j].name.replace("_", " ") ~ "</td><td class=\"center\">" ~ a[i].constants[j].value ~ "</td></tr>\n";
} else {
//TODO could be changed
con ~= space ~ "\t\t\t<tr><td>" ~ b[i].constants[j].name.replace("_", " ") ~ "</td><td class=\"center\">" ~ b[i].constants[j].value ~ "</td></tr>\n";
}
}
/*foreach(c ; field.constants) {
con ~= space ~ "\t\t\t<tr><td>" ~ toCamelCase(c.name) ~ "</td><td class=\"center\">" ~ c.value ~ "</td></tr>\n";
}*/
con ~= space ~ "\t\t</table>\n";
con ~= space ~ "\t</li>\n";
}
} else {
writeImpl(b[i]);
}
}
}
data ~= space ~ "</table>\n";
if(con.length) {
// constants changed
data ~= space ~ "<p><strong>Constants</strong>:</p>\n";
data ~= space ~ "<ul>\n";
data ~= con;
data ~= space ~ "</ul>\n";
}
}
foreach(string game, Protocols ptrs; protocols) {
immutable gameName = game[0..$-ptrs.protocol.to!string.length];
auto attributes = game in attributes;
auto metadata = game in metadatas;
uint[] others;
foreach(otherGame, op; protocols) {
if(otherGame.startsWith(gameName)) {
immutable p = to!uint(otherGame[gameName.length..$]);
if(p < ptrs.protocol) others ~= p;
}
}
if(others.length) {
sort(others);
foreach(other ; others) {
auto op = protocols[gameName ~ to!string(other)];
immutable _min = min(other, ptrs.protocol);
immutable _max = max(other, ptrs.protocol);
string data = head(ptrs.software ~ " " ~ ptrs.protocol.to!string);
data ~= "\t\t<h1>" ~ ptrs.software ~ "</h1>\n";
data ~= "\t\t<h3>Differencies between protocols <a href=\"../" ~ to!string(_min) ~ ".html\">" ~ to!string(_min) ~ "</a> and <a href=\"../" ~ to!string(_max) ~ ".html\">" ~ to!string(_max) ~ "</a></h3>\n";
// endianness
{
bool changed = false;
}
// sections
{
bool changed = ptrs.data.sections.length != op.data.sections.length;
if(!changed) {
// check amount of packets
foreach(i, section; ptrs.data.sections) {
if(section.name != op.data.sections[i].name || section.packets.length != op.data.sections[i].packets.length) {
changed = true;
break;
}
}
}
if(changed) {
data ~= "\t\t<h2 id=\"sections\">Sections</h2>\n";
data ~= "\t\t<table>\n";
data ~= "\t\t\t<tr><th>Section</th><th>Packets</th></tr>\n";
foreach(i ; 0..max(ptrs.data.sections.length, op.data.sections.length)) {
if(i < ptrs.data.sections.length && i < op.data.sections.length && ptrs.data.sections[i].name == op.data.sections[i].name) {
immutable sname = pretty(toCamelCase(ptrs.data.sections[i].name));
if(ptrs.data.sections[i].packets.length != op.data.sections[i].packets.length) {
// number of packets changed
data ~= "\t\t\t<tr><td rowspan=\"2\">" ~ sname ~ "</td><td class=\"center removed\">" ~ op.data.sections[i].packets.length.to!string ~ "</td></tr>\n";
data ~= "\t\t\t<tr><td class=\"center added\">" ~ ptrs.data.sections[i].packets.length.to!string ~ "</td></tr>\n";
} else {
data ~= "\t\t\t<tr><td>" ~ sname ~ "</td><td class=\"center\">" ~ ptrs.data.sections[i].packets.length.to!string ~ "</td></tr>\n";
}
} else {
if(i < op.data.sections.length) {
// removed
auto s = op.data.sections[i];
data ~= "\t\t\t<tr class=\"removed\"><td>" ~ pretty(toCamelCase(s.name)) ~ "</td><td class=\"center\">" ~ s.packets.length.to!string ~ "</td></tr>\n";
}
if(i < ptrs.data.sections.length) {
// added
auto s = op.data.sections[i];
data ~= "\t\t\t<tr class=\"added\"><td>" ~ pretty(toCamelCase(s.name)) ~ "</td><td class=\"center\">" ~ s.packets.length.to!string ~ "</td></tr>\n";
}
}
}
data ~= "\t\t</table>\n";
}
}
// packets
{
string d;
foreach(i ; 0..max(ptrs.data.sections.length, op.data.sections.length)) {
void writePacket(Packet pk, string cls="", string href="") {
d ~= "\t\t\t<tr" ~ (cls.length ? " class=\"" ~ cls ~ "\"" : "") ~ "><td>";
if(href.length) d ~= "<a href=\"" ~ href ~ "\">";
d ~= pretty(toCamelCase(pk.name));
if(href.length) d ~= "</a>";
d ~= "</td><td class=\"center\">" ~ pk.id.to!string ~ "</td><td class=\"center\">" ~ (pk.clientbound ? "✓" : "") ~ "</td><td class=\"center\">" ~ (pk.serverbound ? "✓" : "") ~ "</td></tr>\n";
}
if(i < ptrs.data.sections.length && i < op.data.sections.length && ptrs.data.sections[i].name == op.data.sections[i].name) {
auto a = op.data.sections[i];
auto b = ptrs.data.sections[i];
bool changed = a.packets.length != b.packets.length;
if(!changed) {
foreach(j ; 0..a.packets.length) {
auto pa = a.packets[i];
auto pb = b.packets[i];
if(pa.name != pb.name || pa.id != pb.id || pa.clientbound != pb.clientbound || pa.serverbound != pb.serverbound) {
changed = true;
break;
}
}
}
if(changed) {
// write something changed (it could also be the boundness)
d ~= "\t\t<h2>" ~ pretty(toCamelCase(a.name)) ~ "</h2>\n";
d ~= "\t\t<table>\n";
d ~= "\t\t\t<tr><th>Packet</th><th>Id</th><th>Clientbound</th><th>Serverbound</th></tr>\n";
ptrdiff_t last_a = -1;
foreach(j, packet; b.packets) {
bool matched = false;
foreach(k, a_packet; a.packets) {
if(packet.name == a_packet.name) {
matched = true;
bool c_id = packet.id != a_packet.id;
bool c_c = packet.clientbound != a_packet.clientbound;
bool c_s = packet.serverbound != a_packet.serverbound;
if(c_id || c_c || c_s) {
// changed
d ~= "\t\t\t<tr><td rowspan=\"2\">" ~ pretty(toCamelCase(packet.name)) ~ "</td>";
if(c_id) d ~= "<td class=\"removed\">" ~ a_packet.id.to!string ~ "</td>";
else d ~= "<td rowspan=\"2\">" ~ packet.id.to!string ~ "</td>";
if(c_c) d ~= "<td class=\"center removed\">" ~ (a_packet.clientbound ? "✓" : "") ~ "</td>";
else d ~= "<td rowspan=\"2\" class=\"center\">" ~ (packet.clientbound ? "✓" : "") ~ "</td>";
if(c_s) d ~= "<td class=\"center removed\">" ~ (a_packet.serverbound ? "✓" : "") ~ "</td>";
else d ~= "<td rowspan=\"2\" class=\"center\">" ~ (packet.serverbound ? "✓" : "") ~ "</td>";
d ~= "</tr>\n\t\t\t<tr>";
if(c_id) d ~= "<td class=\"center added\">" ~ packet.id.to!string ~ "</td>";
if(c_c) d ~= "<td class=\"center added\">" ~ (packet.clientbound ? "✓" : "") ~ "</td>";
if(c_s) d ~= "<td class=\"center added\">" ~ (packet.serverbound ? "✓" : "") ~ "</td>";
d ~= "</tr>\n";
} else {
writePacket(packet);
}
break;
}
}
if(!matched) {
// added
writePacket(packet, "added", "../" ~ ptrs.protocol.to!string ~ ".html#" ~ link(a.name, packet.name));
}
}
d ~= "\t\t</table>\n";
}
// also write changes to fields, constants or variants
string dd;
foreach(j, packet; b.packets) {
bool matched = false;
foreach(k, a_packet; a.packets) {
if(packet.name == a_packet.name) {
matched = true;
if(isPacketChanged(a_packet, packet)) {
// something changed
dd ~= "\t\t\t<li>\n";
dd ~= "\t\t\t\t<h3>" ~ pretty(toCamelCase(packet.name)) ~ "</h3>\n";
writeDiff(dd, "\t\t\t\t", a_packet.fields, packet.fields);
//TODO variants
dd ~= "\t\t\t</li>\n";
}
}
}
if(!matched) {
// added
}
}
if(dd.length) {
d ~= "\t\t<ul>\n" ~ dd ~ "\t\t</ul>\n";
}
} else {
void writeImpl(string section, uint p, Packet[] packets) {
d ~= "\t\t\t<tr><th>Packet</th><th>Id</th><th>Clientbound</th><th>Serverbound</th></tr>\n";
foreach(packet ; packets) {
writePacket(packet, "", "../" ~ p.to!string ~ ".html#" ~ link(section, packet.name));
}
}
if(i < op.data.sections.length) {
// write everything but red
d ~= "\t\t<h3>" ~ pretty(toCamelCase(op.data.sections[i].name)) ~ "</h3>\n";
d ~= "\t\t<table class=\"removed\">\n";
writeImpl(op.data.sections[i].name, other, op.data.sections[i].packets);
d ~= "\t\t</table>\n";
}
if(i < ptrs.data.sections.length) {
// write everything green
d ~= "\t\t<h3>" ~ pretty(toCamelCase(ptrs.data.sections[i].name)) ~ "</h3>\n";
d ~= "\t\t<table class=\"added\">\n";
writeImpl(ptrs.data.sections[i].name, ptrs.protocol.to!uint, ptrs.data.sections[i].packets);
d ~= "\t\t</table>\n";
}
}
}
if(d.length) {
data ~= "\t\t<h2 id=\"packets\">Packets</h2>\n";
data ~= d;
}
}
// types
// arrays
// metadata
// attributes
data ~= "\t</body>\n</html>\n";
std.file.mkdirRecurse("../docs/" ~ gameName ~ "/diff");
std.file.write("../docs/" ~ gameName ~ "/diff/" ~ to!string(_min) ~ "-" ~ to!string(_max) ~ ".html", data);
}
}
}
}
string head(string title) {
return "<!DOCTYPE html>\n<html lang=\"en\">\n" ~
"\t<head>\n\t\t<meta charset=\"UTF-8\" />\n" ~
"\t\t<title>" ~ title ~ " | SEL Utils</title>\n" ~
"\t\t<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />\n" ~
"\t\t<link rel=\"icon\" type=\"image/png\" href=\"../../favicon.png\" />\n" ~
"\t\t<link rel=\"stylesheet\" href=\"../../style.css\" />\n\t</head>\n" ~
"\t<body>\n\t\t<div style=\"text-align:center;padding-top:16px\"><a href=\"../..\"><div><img src=\"../../logo.png\" alt=\"SEL\" style=\"width:224px;height:104px\" /></div></a>" ~
"<div><a href=\"../..\">Index</a> " ~
"<a href=\"https://github.com/sel-project/sel-utils/blob/master/README.md\">About</a> " ~
"<a href=\"https://github.com/sel-project/sel-utils/blob/master/TYPES.md\">Types</a> " ~
"<a href=\"https://github.com/sel-project/sel-utils/blob/master/CONTRIBUTING.md\">Contribute</a> " ~
"<a href=\"https://github.com/sel-project/sel-utils\">Github</a></div></div>\n";
}
@property string pretty(string name) {
string ret;
foreach(c ; name) {
if(c >= 'A' && c <= 'Z' || c >= '0' && c <= '9') ret ~= ' ';
ret ~= c;
}
if(!ret.length) return ret;
else return (toUpper(ret[0..1]) ~ ret[1..$]).replace(" And ", " and ").replace(" Of ", " of ").replace(" In ", " in ");
}
string link(string[] pieces...) {
foreach(ref piece ; pieces) piece = piece.replace("_", "-");
return pieces.join("_");
}
string cond(string c) {
c = "$+code$-" ~ c
.replace("&", " & ")
.replace("|", " | ")
.replace("& &", "&&")
.replace("| |", "||")
.replace("==true", "$+/code$- is $+code$-$+span style=\"color:#009688\"$-true$+/span$-")
.replace("==false", "$+/code$- is $+code$-$+span style=\"color:#009688\"$-false$+/span$-")
.replace("==", "$+/code$- is equal to $+code$-")
.replace("!=", "$+/code$- is not equal to $+code$-")
.replace(">=", "$+/code$- is greater than or equal to $+code$-")
.replace("<=", "$+/code$- is less than or equal to $+code$-")
.replace(">", "$+/code$- is greater than $+code$-")
.replace("<", "$+/code$- is less than $+code$-") ~ "$+/code$-";
return c.replace("$+", "<").replace("$-", ">");
}
| D |
instance VLK_409_Zuris(Npc_Default)
{
name[0] = "Зурис";
guild = GIL_VLK;
id = 409;
voice = 14;
flags = 0;
npcType = npctype_main;
B_SetAttributesToChapter(self,2);
fight_tactic = FAI_HUMAN_COWARD;
EquipItem(self,ItMw_1h_Vlk_Sword);
B_SetNpcVisual(self,MALE,"Hum_Head_Psionic",Face_N_ImportantGrey,BodyTex_N,ITAR_Vlk_H);
Mdl_SetModelFatness(self,0.9);
Mdl_ApplyOverlayMds(self,"Humans_Arrogance.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,30);
daily_routine = Rtn_Start_409;
};
func void Rtn_Start_409()
{
TA_Stand_TraderCity(7,30,19,30,"NW_CITY_BALTRAM");
TA_Sit_Throne(19,30,0,30,"NW_CITY_CHAIR_ZURIS");
TA_Sleep(0,30,7,30,"NW_CITY_BED_ZURIS");
};
| D |
**************************************************************************
* KELVIN LABORATORY, UNIVERSITY OF GLASGOW
*
* *********** polrot.d *******************
*
* Parameter file for changing polarisation using polrot.c
*
*
* K Livingston 6th May 1966
* K Livingston 16th Feb 2008 Updated for new goniometer
*
**************************************************************************
*
* Perp Settings Parallel Settings
* Axis 2 Axis 4 Axis 2 Axis 4
*
*h= -1.63194 v= -1.78085 h= 3.49794 v= -1.78085
*-1.78085 -1.63194 -1.78085 3.49794
*-6.37515 3.49794 -1.78085 3.49794
*-6.31688 3.5562 -1.83912 3.5562
*-6.16887 3.70422 -1.98713 3.70422
*-6.16887 3.70422 -2.08257 3.79966
*-6.16887 3.70422 -1.94882 3.66591
*-6.16887 3.70422 -1.81507 3.53216
*-6.16887 3.70422 -1.5577 3.27479
*-6.16887 3.70422 -1.33468 3.05177
*-6.16887 3.70422 -1.43012 3.14721
*-6.16887 3.70422 -1.3908 3.10789
*-6.42624 3.44685 -1.3908 3.10789
*-6.64926 3.22383 -1.3908 3.10789
*-6.68858 3.18451 -1.3908 3.10789
*-6.70488 3.16821 -1.3908 3.10789
*-6.70903 3.16406 -1.3908 3.10789
*-6.69189 3.1812 -1.3908 3.10789
*-6.68769 3.1854 -1.3908 3.10789
*-6.68349 3.1896 -1.3908 3.10789
*-6.67929 3.1938 -1.3908 3.10789
*-6.67083 3.20226 -1.3908 3.10789
*-6.66237 3.21072 -1.3908 3.10789
*-6.63633 3.23676 -1.3908 3.10789
-6.61919 3.2539 -1.3908 3.10789
| D |
module android.java.android.telephony.TelephonyManager_UssdResponseCallback_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import1 = android.java.java.lang.CharSequence_d_interface;
import import0 = android.java.android.telephony.TelephonyManager_d_interface;
import import2 = android.java.java.lang.Class_d_interface;
@JavaName("TelephonyManager$UssdResponseCallback")
final class TelephonyManager_UssdResponseCallback : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import this(arsd.jni.Default);
@Import void onReceiveUssdResponse(import0.TelephonyManager, string, import1.CharSequence);
@Import void onReceiveUssdResponseFailed(import0.TelephonyManager, string, int);
@Import import2.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import void notify();
@Import void notifyAll();
@Import void wait(long);
@Import void wait(long, int);
@Import void wait();
mixin IJavaObjectImplementation!(false);
public static immutable string _javaParameterString = "Landroid/telephony/TelephonyManager$UssdResponseCallback;";
}
| D |
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.build/HTTPResponseCompressor.swift.o : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPPipelineSetup.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPDecoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPEncoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPUpgradeHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPServerPipelineHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPResponseCompressor.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPTypes.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/ByteCollectionUtils.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.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 /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.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/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOZlib/include/CNIOZlib.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.build/HTTPResponseCompressor~partial.swiftmodule : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPPipelineSetup.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPDecoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPEncoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPUpgradeHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPServerPipelineHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPResponseCompressor.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPTypes.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/ByteCollectionUtils.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.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 /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.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/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOZlib/include/CNIOZlib.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.build/HTTPResponseCompressor~partial.swiftdoc : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPPipelineSetup.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPDecoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPEncoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPUpgradeHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPServerPipelineHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPResponseCompressor.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/HTTPTypes.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/NIOHTTP1/ByteCollectionUtils.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.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 /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.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/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOZlib/include/CNIOZlib.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes
| D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;
void get(Args...)(ref Args args)
{
import std.traits, std.meta, std.typecons;
static if (Args.length == 1) {
alias Arg = Args[0];
static if (isArray!Arg) {
static if (isSomeChar!(ElementType!Arg)) {
args[0] = readln.chomp.to!Arg;
} else {
args[0] = readln.split.to!Arg;
}
} else static if (isTuple!Arg) {
auto input = readln.split;
static foreach (i; 0..Fields!Arg.length) {
args[0][i] = input[i].to!(Fields!Arg[i]);
}
} else {
args[0] = readln.chomp.to!Arg;
}
} else {
auto input = readln.split;
assert(input.length == Args.length);
static foreach (i; 0..Args.length) {
args[i] = input[i].to!(Args[i]);
}
}
}
void get_lines(Args...)(size_t N, ref Args args)
{
import std.traits, std.range;
static foreach (i; 0..Args.length) {
static assert(isArray!(Args[i]));
args[i].length = N;
}
foreach (i; 0..N) {
static if (Args.length == 1) {
get(args[0][i]);
} else {
auto input = readln.split;
static foreach (j; 0..Args.length) {
args[j][i] = input[j].to!(ElementType!(Args[j]));
}
}
}
}
enum P = 10^^9 + 7;
void main()
{
int N, M; get(N, M);
auto DP = new int[][](N * M + 1, 2^^(M + 1));
DP[0][0] = 1;
auto MASK = (1 << (M + 1)) - 1;
foreach (i; 0..N) foreach (j; 0..M) foreach (k; 0..2^^(M + 1)) if (DP[i * M + j][k]) {
auto f = (k << 1) & MASK;
auto p = DP[i * M + j][k];
(DP[i * M + j + 1][f] += p) %= P;
if (M == 1) {
if (!(k & 1)) (DP[i * M + j + 1][f + 1] += p) %= P;
} else if (M == 2) {
if (j == 0 && !(k & 3)) (DP[i * M + j + 1][f + 1] += p) %= P;
if (j == 1 && !(k & 7)) (DP[i * M + j + 1][f + 1] += p) %= P;
} else {
if (j == 0 && !(k & (1 << (M - 1))) && !(k & (1 << (M - 2)))) (DP[i * M + j + 1][f + 1] += p) %= P;
if (j == M - 1 && !(k & 1) && !(k & (1 << M)) && !(k & (1 << (M - 1)))) (DP[i * M + j + 1][f + 1] += p) %= P;
if (0 < j && j < M - 1 && !(k & 1) && !(k & (1 << M)) && !(k & (1 << (M - 1))) && !(k & (1 << (M - 2)))) (DP[i * M + j + 1][f + 1] += p) %= P;
}
}
int r;
foreach (k; 0..2^^(M + 1)) (r += DP[N * M][k]) %= P;
writeln(r - 1);
}
| D |
PLONG PLAT ED95 KD LOMAGAGE HIMAGAGE SLAT SLONG RESULTNO DP DM WT ROCKTYPE
292.5 65.5 1.60000002 262.700012 34 39 -38.7999992 143.399994 7097 2.5 2.5 0.797163631 sediments, red-brown clays
264.399994 75 15.6000004 0 2 65 -8.80000019 126.699997 1206 10.3999996 18 0.354633176 extrusives, intrusives
346 61 9 41.2000008 35 100 -31.3999996 138.600006 1170 13 15 0.479173567 sediments
333 45 9 16.5 35 100 -30.3999996 139.399994 1161 17 18 0.479173567 sediments, tillite
317 57 5 200 35 100 -30.5 139.300003 1165 9 10 0.534518196 sediments, redbeds
329 58 25 4.0999999 35 100 -30.2000008 139 1166 41.5999985 45.5999985 0.186214566 sediments, sandstone, tillite
223 26 13 14.8000002 35 100 -30.2999992 139.5 1157 26 26 0.40499224 extrusives
320 63 9 15.5 34 65 -38 145.5 1854 16 16 0.546667364 extrusives
317 63 14 16 23 56 -32.5 151 1840 20 20 0.444664709 extrusives, basalts
302.700012 66.8000031 6.80000019 35 34 65 -38 145.5 1819 10.8000002 12.1000004 0.580206016 extrusives
305 73 17 29 23 56 -42 147 1821 25 29 0.384273103 extrusives, basalts
274 66 27.6000004 8.60000038 25 65 -41.2999992 145.899994 1873 39.7999992 46.9000015 0.192001791 intrusives, granite
321 64 6 27.5 25 65 -35.5999985 137.5 1874 10 11 0.561558173 sediments
294 75 11 7 25 65 -41.0999985 146.100006 1871 16.2999992 18.8999996 0.482114083 sediments, sandstone
315 66 10.5 18 25 65 -41 145.5 1872 18.2000008 19.6000004 0.491352269 extrusives, sediments
298 58.7999992 2.4000001 0 35 65 -27 141.5 1972 3.79999995 3.79999995 0.626974119 sediments, weathered
310.899994 68.5 5.19999981 0 40 60 -35 150 1927 5.19999981 5.19999981 0.570840415 extrusives, basalts
| D |
/home/pjackim/downloads/eww/target/release/deps/gobject_sys-a95cb479ad074b87.rmeta: /home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/gobject-sys-0.10.0/src/lib.rs
/home/pjackim/downloads/eww/target/release/deps/libgobject_sys-a95cb479ad074b87.rlib: /home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/gobject-sys-0.10.0/src/lib.rs
/home/pjackim/downloads/eww/target/release/deps/gobject_sys-a95cb479ad074b87.d: /home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/gobject-sys-0.10.0/src/lib.rs
/home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/gobject-sys-0.10.0/src/lib.rs:
| D |
/mnt/c/Users/livvy/Documents/Github/rustbindingtest/myLib/target/debug/build/proc-macro2-126b096ae5c78383/build_script_build-126b096ae5c78383: /home/liv/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.8/build.rs
/mnt/c/Users/livvy/Documents/Github/rustbindingtest/myLib/target/debug/build/proc-macro2-126b096ae5c78383/build_script_build-126b096ae5c78383.d: /home/liv/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.8/build.rs
/home/liv/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.8/build.rs:
| D |
foster the growth of
prepare for crops
teach or refine to be discriminative in taste or judgment
adapt (a wild plant or unclaimed land) to the environment
(of land or fields) prepared for raising crops by plowing or fertilizing
no longer in the natural state
marked by refinement in taste and manners
| D |
/**
* Declarations for back-end functions that the front-end invokes.
*
* This 'glues' either the DMC or GCC back-end to the front-end.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/gluelayer.d, _gluelayer.d)
* Documentation: https://dlang.org/phobos/dmd_gluelayer.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/gluelayer.d
*/
module dmd.gluelayer;
import dmd.dmodule;
import dmd.dscope;
import dmd.dsymbol;
import dmd.mtype;
import dmd.statement;
import dmd.root.file;
version (NoBackend)
{
struct Symbol;
struct code;
struct block;
struct Blockx;
struct elem;
struct TYPE;
alias type = TYPE;
extern (C++)
{
// iasm
Statement asmSemantic(AsmStatement s, Scope* sc)
{
sc.func.hasReturnExp = 8;
return null;
}
// toir
void toObjFile(Dsymbol ds, bool multiobj) {}
extern(C++) abstract class ObjcGlue
{
static void initialize() {}
}
}
}
else version (MARS)
{
public import dmd.backend.cc : block, Blockx, Symbol;
public import dmd.backend.type : type;
public import dmd.backend.el : elem;
public import dmd.backend.code_x86 : code;
extern (C++)
{
Statement asmSemantic(AsmStatement s, Scope* sc);
void toObjFile(Dsymbol ds, bool multiobj);
extern(C++) abstract class ObjcGlue
{
static void initialize();
}
}
}
else version (IN_GCC)
{
extern (C++) union tree_node;
alias Symbol = tree_node;
alias code = tree_node;
alias type = tree_node;
extern (C++)
{
Statement asmSemantic(AsmStatement s, Scope* sc);
}
// stubs
extern(C++) abstract class ObjcGlue
{
static void initialize() {}
}
}
else
static assert(false, "Unsupported compiler backend");
| D |
module godot.visualscript;
import std.meta : AliasSeq, staticIndexOf;
import std.traits : Unqual;
import godot.d.meta;
import godot.core;
import godot.c;
import godot.d.bind;
import godot.object;
import godot.classdb;
import godot.script;
import godot.visualscriptnode;
@GodotBaseClass struct VisualScript
{
static immutable string _GODOT_internal_name = "VisualScript";
public:
union { godot_object _godot_object; Script base; }
alias base this;
alias BaseClasses = AliasSeq!(typeof(base), typeof(base).BaseClasses);
bool opEquals(in VisualScript other) const { return _godot_object.ptr is other._godot_object.ptr; }
VisualScript opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
mixin baseCasts;
static VisualScript _new()
{
static godot_class_constructor constructor;
if(constructor is null) constructor = godot_get_class_constructor("VisualScript");
if(constructor is null) return typeof(this).init;
return cast(VisualScript)(constructor());
}
package(godot) static GodotMethod!(void, int) _GODOT__node_ports_changed;
package(godot) alias _GODOT_methodBindInfo(string name : "_node_ports_changed") = _GODOT__node_ports_changed;
void _node_ports_changed(in int arg0)
{
Array _GODOT_args = Array.empty_array;
_GODOT_args.append(arg0);
String _GODOT_method_name = String("_node_ports_changed");
this.callv(_GODOT_method_name, _GODOT_args);
}
package(godot) static GodotMethod!(void, String) _GODOT_add_function;
package(godot) alias _GODOT_methodBindInfo(string name : "add_function") = _GODOT_add_function;
void add_function(StringArg0)(in StringArg0 name)
{
_GODOT_add_function.bind("VisualScript", "add_function");
ptrcall!(void)(_GODOT_add_function, _godot_object, name);
}
package(godot) static GodotMethod!(bool, String) _GODOT_has_function;
package(godot) alias _GODOT_methodBindInfo(string name : "has_function") = _GODOT_has_function;
bool has_function(StringArg0)(in StringArg0 name) const
{
_GODOT_has_function.bind("VisualScript", "has_function");
return ptrcall!(bool)(_GODOT_has_function, _godot_object, name);
}
package(godot) static GodotMethod!(void, String) _GODOT_remove_function;
package(godot) alias _GODOT_methodBindInfo(string name : "remove_function") = _GODOT_remove_function;
void remove_function(StringArg0)(in StringArg0 name)
{
_GODOT_remove_function.bind("VisualScript", "remove_function");
ptrcall!(void)(_GODOT_remove_function, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, String) _GODOT_rename_function;
package(godot) alias _GODOT_methodBindInfo(string name : "rename_function") = _GODOT_rename_function;
void rename_function(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 new_name)
{
_GODOT_rename_function.bind("VisualScript", "rename_function");
ptrcall!(void)(_GODOT_rename_function, _godot_object, name, new_name);
}
package(godot) static GodotMethod!(void, String, Vector2) _GODOT_set_function_scroll;
package(godot) alias _GODOT_methodBindInfo(string name : "set_function_scroll") = _GODOT_set_function_scroll;
void set_function_scroll(StringArg0)(in StringArg0 name, in Vector2 ofs)
{
_GODOT_set_function_scroll.bind("VisualScript", "set_function_scroll");
ptrcall!(void)(_GODOT_set_function_scroll, _godot_object, name, ofs);
}
package(godot) static GodotMethod!(Vector2, String) _GODOT_get_function_scroll;
package(godot) alias _GODOT_methodBindInfo(string name : "get_function_scroll") = _GODOT_get_function_scroll;
Vector2 get_function_scroll(StringArg0)(in StringArg0 name) const
{
_GODOT_get_function_scroll.bind("VisualScript", "get_function_scroll");
return ptrcall!(Vector2)(_GODOT_get_function_scroll, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, int, VisualScriptNode, Vector2) _GODOT_add_node;
package(godot) alias _GODOT_methodBindInfo(string name : "add_node") = _GODOT_add_node;
void add_node(StringArg0)(in StringArg0 func, in int id, in VisualScriptNode node, in Vector2 position = Vector2(0, 0))
{
_GODOT_add_node.bind("VisualScript", "add_node");
ptrcall!(void)(_GODOT_add_node, _godot_object, func, id, node, position);
}
package(godot) static GodotMethod!(void, String, int) _GODOT_remove_node;
package(godot) alias _GODOT_methodBindInfo(string name : "remove_node") = _GODOT_remove_node;
void remove_node(StringArg0)(in StringArg0 func, in int id)
{
_GODOT_remove_node.bind("VisualScript", "remove_node");
ptrcall!(void)(_GODOT_remove_node, _godot_object, func, id);
}
package(godot) static GodotMethod!(int, String) _GODOT_get_function_node_id;
package(godot) alias _GODOT_methodBindInfo(string name : "get_function_node_id") = _GODOT_get_function_node_id;
int get_function_node_id(StringArg0)(in StringArg0 name) const
{
_GODOT_get_function_node_id.bind("VisualScript", "get_function_node_id");
return ptrcall!(int)(_GODOT_get_function_node_id, _godot_object, name);
}
package(godot) static GodotMethod!(VisualScriptNode, String, int) _GODOT_get_node;
package(godot) alias _GODOT_methodBindInfo(string name : "get_node") = _GODOT_get_node;
VisualScriptNode get_node(StringArg0)(in StringArg0 func, in int id) const
{
_GODOT_get_node.bind("VisualScript", "get_node");
return ptrcall!(VisualScriptNode)(_GODOT_get_node, _godot_object, func, id);
}
package(godot) static GodotMethod!(bool, String, int) _GODOT_has_node;
package(godot) alias _GODOT_methodBindInfo(string name : "has_node") = _GODOT_has_node;
bool has_node(StringArg0)(in StringArg0 func, in int id) const
{
_GODOT_has_node.bind("VisualScript", "has_node");
return ptrcall!(bool)(_GODOT_has_node, _godot_object, func, id);
}
package(godot) static GodotMethod!(void, String, int, Vector2) _GODOT_set_node_position;
package(godot) alias _GODOT_methodBindInfo(string name : "set_node_position") = _GODOT_set_node_position;
void set_node_position(StringArg0)(in StringArg0 func, in int id, in Vector2 position)
{
_GODOT_set_node_position.bind("VisualScript", "set_node_position");
ptrcall!(void)(_GODOT_set_node_position, _godot_object, func, id, position);
}
package(godot) static GodotMethod!(Vector2, String, int) _GODOT_get_node_position;
package(godot) alias _GODOT_methodBindInfo(string name : "get_node_position") = _GODOT_get_node_position;
Vector2 get_node_position(StringArg0)(in StringArg0 func, in int id) const
{
_GODOT_get_node_position.bind("VisualScript", "get_node_position");
return ptrcall!(Vector2)(_GODOT_get_node_position, _godot_object, func, id);
}
package(godot) static GodotMethod!(void, String, int, int, int) _GODOT_sequence_connect;
package(godot) alias _GODOT_methodBindInfo(string name : "sequence_connect") = _GODOT_sequence_connect;
void sequence_connect(StringArg0)(in StringArg0 func, in int from_node, in int from_output, in int to_node)
{
_GODOT_sequence_connect.bind("VisualScript", "sequence_connect");
ptrcall!(void)(_GODOT_sequence_connect, _godot_object, func, from_node, from_output, to_node);
}
package(godot) static GodotMethod!(void, String, int, int, int) _GODOT_sequence_disconnect;
package(godot) alias _GODOT_methodBindInfo(string name : "sequence_disconnect") = _GODOT_sequence_disconnect;
void sequence_disconnect(StringArg0)(in StringArg0 func, in int from_node, in int from_output, in int to_node)
{
_GODOT_sequence_disconnect.bind("VisualScript", "sequence_disconnect");
ptrcall!(void)(_GODOT_sequence_disconnect, _godot_object, func, from_node, from_output, to_node);
}
package(godot) static GodotMethod!(bool, String, int, int, int) _GODOT_has_sequence_connection;
package(godot) alias _GODOT_methodBindInfo(string name : "has_sequence_connection") = _GODOT_has_sequence_connection;
bool has_sequence_connection(StringArg0)(in StringArg0 func, in int from_node, in int from_output, in int to_node) const
{
_GODOT_has_sequence_connection.bind("VisualScript", "has_sequence_connection");
return ptrcall!(bool)(_GODOT_has_sequence_connection, _godot_object, func, from_node, from_output, to_node);
}
package(godot) static GodotMethod!(void, String, int, int, int, int) _GODOT_data_connect;
package(godot) alias _GODOT_methodBindInfo(string name : "data_connect") = _GODOT_data_connect;
void data_connect(StringArg0)(in StringArg0 func, in int from_node, in int from_port, in int to_node, in int to_port)
{
_GODOT_data_connect.bind("VisualScript", "data_connect");
ptrcall!(void)(_GODOT_data_connect, _godot_object, func, from_node, from_port, to_node, to_port);
}
package(godot) static GodotMethod!(void, String, int, int, int, int) _GODOT_data_disconnect;
package(godot) alias _GODOT_methodBindInfo(string name : "data_disconnect") = _GODOT_data_disconnect;
void data_disconnect(StringArg0)(in StringArg0 func, in int from_node, in int from_port, in int to_node, in int to_port)
{
_GODOT_data_disconnect.bind("VisualScript", "data_disconnect");
ptrcall!(void)(_GODOT_data_disconnect, _godot_object, func, from_node, from_port, to_node, to_port);
}
package(godot) static GodotMethod!(bool, String, int, int, int, int) _GODOT_has_data_connection;
package(godot) alias _GODOT_methodBindInfo(string name : "has_data_connection") = _GODOT_has_data_connection;
bool has_data_connection(StringArg0)(in StringArg0 func, in int from_node, in int from_port, in int to_node, in int to_port) const
{
_GODOT_has_data_connection.bind("VisualScript", "has_data_connection");
return ptrcall!(bool)(_GODOT_has_data_connection, _godot_object, func, from_node, from_port, to_node, to_port);
}
package(godot) static GodotMethod!(void, String, Variant, bool) _GODOT_add_variable;
package(godot) alias _GODOT_methodBindInfo(string name : "add_variable") = _GODOT_add_variable;
void add_variable(StringArg0, VariantArg1)(in StringArg0 name, in VariantArg1 default_value = Variant.nil, in bool _export = false)
{
_GODOT_add_variable.bind("VisualScript", "add_variable");
ptrcall!(void)(_GODOT_add_variable, _godot_object, name, default_value, _export);
}
package(godot) static GodotMethod!(bool, String) _GODOT_has_variable;
package(godot) alias _GODOT_methodBindInfo(string name : "has_variable") = _GODOT_has_variable;
bool has_variable(StringArg0)(in StringArg0 name) const
{
_GODOT_has_variable.bind("VisualScript", "has_variable");
return ptrcall!(bool)(_GODOT_has_variable, _godot_object, name);
}
package(godot) static GodotMethod!(void, String) _GODOT_remove_variable;
package(godot) alias _GODOT_methodBindInfo(string name : "remove_variable") = _GODOT_remove_variable;
void remove_variable(StringArg0)(in StringArg0 name)
{
_GODOT_remove_variable.bind("VisualScript", "remove_variable");
ptrcall!(void)(_GODOT_remove_variable, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, Variant) _GODOT_set_variable_default_value;
package(godot) alias _GODOT_methodBindInfo(string name : "set_variable_default_value") = _GODOT_set_variable_default_value;
void set_variable_default_value(StringArg0, VariantArg1)(in StringArg0 name, in VariantArg1 value)
{
_GODOT_set_variable_default_value.bind("VisualScript", "set_variable_default_value");
ptrcall!(void)(_GODOT_set_variable_default_value, _godot_object, name, value);
}
package(godot) static GodotMethod!(Variant, String) _GODOT_get_variable_default_value;
package(godot) alias _GODOT_methodBindInfo(string name : "get_variable_default_value") = _GODOT_get_variable_default_value;
Variant get_variable_default_value(StringArg0)(in StringArg0 name) const
{
_GODOT_get_variable_default_value.bind("VisualScript", "get_variable_default_value");
return ptrcall!(Variant)(_GODOT_get_variable_default_value, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, Dictionary) _GODOT_set_variable_info;
package(godot) alias _GODOT_methodBindInfo(string name : "set_variable_info") = _GODOT_set_variable_info;
void set_variable_info(StringArg0)(in StringArg0 name, in Dictionary value)
{
_GODOT_set_variable_info.bind("VisualScript", "set_variable_info");
ptrcall!(void)(_GODOT_set_variable_info, _godot_object, name, value);
}
package(godot) static GodotMethod!(Dictionary, String) _GODOT_get_variable_info;
package(godot) alias _GODOT_methodBindInfo(string name : "get_variable_info") = _GODOT_get_variable_info;
Dictionary get_variable_info(StringArg0)(in StringArg0 name) const
{
_GODOT_get_variable_info.bind("VisualScript", "get_variable_info");
return ptrcall!(Dictionary)(_GODOT_get_variable_info, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, bool) _GODOT_set_variable_export;
package(godot) alias _GODOT_methodBindInfo(string name : "set_variable_export") = _GODOT_set_variable_export;
void set_variable_export(StringArg0)(in StringArg0 name, in bool enable)
{
_GODOT_set_variable_export.bind("VisualScript", "set_variable_export");
ptrcall!(void)(_GODOT_set_variable_export, _godot_object, name, enable);
}
package(godot) static GodotMethod!(bool, String) _GODOT_get_variable_export;
package(godot) alias _GODOT_methodBindInfo(string name : "get_variable_export") = _GODOT_get_variable_export;
bool get_variable_export(StringArg0)(in StringArg0 name) const
{
_GODOT_get_variable_export.bind("VisualScript", "get_variable_export");
return ptrcall!(bool)(_GODOT_get_variable_export, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, String) _GODOT_rename_variable;
package(godot) alias _GODOT_methodBindInfo(string name : "rename_variable") = _GODOT_rename_variable;
void rename_variable(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 new_name)
{
_GODOT_rename_variable.bind("VisualScript", "rename_variable");
ptrcall!(void)(_GODOT_rename_variable, _godot_object, name, new_name);
}
package(godot) static GodotMethod!(void, String) _GODOT_add_custom_signal;
package(godot) alias _GODOT_methodBindInfo(string name : "add_custom_signal") = _GODOT_add_custom_signal;
void add_custom_signal(StringArg0)(in StringArg0 name)
{
_GODOT_add_custom_signal.bind("VisualScript", "add_custom_signal");
ptrcall!(void)(_GODOT_add_custom_signal, _godot_object, name);
}
package(godot) static GodotMethod!(bool, String) _GODOT_has_custom_signal;
package(godot) alias _GODOT_methodBindInfo(string name : "has_custom_signal") = _GODOT_has_custom_signal;
bool has_custom_signal(StringArg0)(in StringArg0 name) const
{
_GODOT_has_custom_signal.bind("VisualScript", "has_custom_signal");
return ptrcall!(bool)(_GODOT_has_custom_signal, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, int, String, int) _GODOT_custom_signal_add_argument;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_add_argument") = _GODOT_custom_signal_add_argument;
void custom_signal_add_argument(StringArg0, StringArg2)(in StringArg0 name, in int type, in StringArg2 argname, in int index = -1)
{
_GODOT_custom_signal_add_argument.bind("VisualScript", "custom_signal_add_argument");
ptrcall!(void)(_GODOT_custom_signal_add_argument, _godot_object, name, type, argname, index);
}
package(godot) static GodotMethod!(void, String, int, int) _GODOT_custom_signal_set_argument_type;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_set_argument_type") = _GODOT_custom_signal_set_argument_type;
void custom_signal_set_argument_type(StringArg0)(in StringArg0 name, in int argidx, in int type)
{
_GODOT_custom_signal_set_argument_type.bind("VisualScript", "custom_signal_set_argument_type");
ptrcall!(void)(_GODOT_custom_signal_set_argument_type, _godot_object, name, argidx, type);
}
package(godot) static GodotMethod!(Variant.Type, String, int) _GODOT_custom_signal_get_argument_type;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_get_argument_type") = _GODOT_custom_signal_get_argument_type;
Variant.Type custom_signal_get_argument_type(StringArg0)(in StringArg0 name, in int argidx) const
{
_GODOT_custom_signal_get_argument_type.bind("VisualScript", "custom_signal_get_argument_type");
return ptrcall!(Variant.Type)(_GODOT_custom_signal_get_argument_type, _godot_object, name, argidx);
}
package(godot) static GodotMethod!(void, String, int, String) _GODOT_custom_signal_set_argument_name;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_set_argument_name") = _GODOT_custom_signal_set_argument_name;
void custom_signal_set_argument_name(StringArg0, StringArg2)(in StringArg0 name, in int argidx, in StringArg2 argname)
{
_GODOT_custom_signal_set_argument_name.bind("VisualScript", "custom_signal_set_argument_name");
ptrcall!(void)(_GODOT_custom_signal_set_argument_name, _godot_object, name, argidx, argname);
}
package(godot) static GodotMethod!(String, String, int) _GODOT_custom_signal_get_argument_name;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_get_argument_name") = _GODOT_custom_signal_get_argument_name;
String custom_signal_get_argument_name(StringArg0)(in StringArg0 name, in int argidx) const
{
_GODOT_custom_signal_get_argument_name.bind("VisualScript", "custom_signal_get_argument_name");
return ptrcall!(String)(_GODOT_custom_signal_get_argument_name, _godot_object, name, argidx);
}
package(godot) static GodotMethod!(void, String, int) _GODOT_custom_signal_remove_argument;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_remove_argument") = _GODOT_custom_signal_remove_argument;
void custom_signal_remove_argument(StringArg0)(in StringArg0 name, in int argidx)
{
_GODOT_custom_signal_remove_argument.bind("VisualScript", "custom_signal_remove_argument");
ptrcall!(void)(_GODOT_custom_signal_remove_argument, _godot_object, name, argidx);
}
package(godot) static GodotMethod!(int, String) _GODOT_custom_signal_get_argument_count;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_get_argument_count") = _GODOT_custom_signal_get_argument_count;
int custom_signal_get_argument_count(StringArg0)(in StringArg0 name) const
{
_GODOT_custom_signal_get_argument_count.bind("VisualScript", "custom_signal_get_argument_count");
return ptrcall!(int)(_GODOT_custom_signal_get_argument_count, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, int, int) _GODOT_custom_signal_swap_argument;
package(godot) alias _GODOT_methodBindInfo(string name : "custom_signal_swap_argument") = _GODOT_custom_signal_swap_argument;
void custom_signal_swap_argument(StringArg0)(in StringArg0 name, in int argidx, in int withidx)
{
_GODOT_custom_signal_swap_argument.bind("VisualScript", "custom_signal_swap_argument");
ptrcall!(void)(_GODOT_custom_signal_swap_argument, _godot_object, name, argidx, withidx);
}
package(godot) static GodotMethod!(void, String) _GODOT_remove_custom_signal;
package(godot) alias _GODOT_methodBindInfo(string name : "remove_custom_signal") = _GODOT_remove_custom_signal;
void remove_custom_signal(StringArg0)(in StringArg0 name)
{
_GODOT_remove_custom_signal.bind("VisualScript", "remove_custom_signal");
ptrcall!(void)(_GODOT_remove_custom_signal, _godot_object, name);
}
package(godot) static GodotMethod!(void, String, String) _GODOT_rename_custom_signal;
package(godot) alias _GODOT_methodBindInfo(string name : "rename_custom_signal") = _GODOT_rename_custom_signal;
void rename_custom_signal(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 new_name)
{
_GODOT_rename_custom_signal.bind("VisualScript", "rename_custom_signal");
ptrcall!(void)(_GODOT_rename_custom_signal, _godot_object, name, new_name);
}
package(godot) static GodotMethod!(void, String) _GODOT_set_instance_base_type;
package(godot) alias _GODOT_methodBindInfo(string name : "set_instance_base_type") = _GODOT_set_instance_base_type;
void set_instance_base_type(StringArg0)(in StringArg0 type)
{
_GODOT_set_instance_base_type.bind("VisualScript", "set_instance_base_type");
ptrcall!(void)(_GODOT_set_instance_base_type, _godot_object, type);
}
package(godot) static GodotMethod!(void, Dictionary) _GODOT__set_data;
package(godot) alias _GODOT_methodBindInfo(string name : "_set_data") = _GODOT__set_data;
void _set_data(in Dictionary data)
{
Array _GODOT_args = Array.empty_array;
_GODOT_args.append(data);
String _GODOT_method_name = String("_set_data");
this.callv(_GODOT_method_name, _GODOT_args);
}
package(godot) static GodotMethod!(Dictionary) _GODOT__get_data;
package(godot) alias _GODOT_methodBindInfo(string name : "_get_data") = _GODOT__get_data;
Dictionary _get_data() const
{
Array _GODOT_args = Array.empty_array;
String _GODOT_method_name = String("_get_data");
return this.callv(_GODOT_method_name, _GODOT_args).as!(Dictionary);
}
}
| D |
/Users/trietnguyen/Documents/Blockchain Development/NEAR OCT/phucngo/near-nft-certificate/near-nft-cert/contract/target/release/build/num-traits-3bd4fb63ad2e8a89/build_script_build-3bd4fb63ad2e8a89: /Users/trietnguyen/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.12/build.rs
/Users/trietnguyen/Documents/Blockchain Development/NEAR OCT/phucngo/near-nft-certificate/near-nft-cert/contract/target/release/build/num-traits-3bd4fb63ad2e8a89/build_script_build-3bd4fb63ad2e8a89.d: /Users/trietnguyen/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.12/build.rs
/Users/trietnguyen/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.12/build.rs:
| D |
module dwt.program.all;
public import dwt.program.Program;
| D |
a small gift (especially one given by a merchant to a customer who makes a purchase)
| D |
import std.c.time;
enum LIBMRSS_VERSION_STRING ="0.19.2";
enum LIBMRSS_MAJOR_VERSION =0;
enum LIBMRSS_MINOR_VERSION =19;
enum LIBMRSS_MICRO_VERSION =2;
extern(C):
alias mrss_generic_t=void *;
// from curl.h
enum CURLcode
{
CURLE_OK = 0,
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
CURLE_FAILED_INIT, /* 2 */
CURLE_URL_MALFORMAT, /* 3 */
CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
7.17.0, reused in April 2011 for 7.21.5] */
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
CURLE_COULDNT_CONNECT, /* 7 */
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
due to lack of access - when login fails
this is not returned. */
CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
7.15.4, reused in Dec 2011 for 7.24.0]*/
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
[was obsoleted in August 2007 for 7.17.0,
reused in Dec 2011 for 7.24.0]*/
CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
CURLE_FTP_CANT_GET_HOST, /* 15 */
CURLE_OBSOLETE16, /* 16 - NOT USED */
CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
CURLE_PARTIAL_FILE, /* 18 */
CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
CURLE_OBSOLETE20, /* 20 - NOT USED */
CURLE_QUOTE_ERROR, /* 21 - quote command failure */
CURLE_HTTP_RETURNED_ERROR, /* 22 */
CURLE_WRITE_ERROR, /* 23 */
CURLE_OBSOLETE24, /* 24 - NOT USED */
CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
CURLE_OUT_OF_MEMORY, /* 27 */
/* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
instead of a memory allocation error if CURL_DOES_CONVERSIONS
is defined
*/
CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
CURLE_OBSOLETE29, /* 29 - NOT USED */
CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
CURLE_OBSOLETE32, /* 32 - NOT USED */
CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
CURLE_HTTP_POST_ERROR, /* 34 */
CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
CURLE_FILE_COULDNT_READ_FILE, /* 37 */
CURLE_LDAP_CANNOT_BIND, /* 38 */
CURLE_LDAP_SEARCH_FAILED, /* 39 */
CURLE_OBSOLETE40, /* 40 - NOT USED */
CURLE_FUNCTION_NOT_FOUND, /* 41 */
CURLE_ABORTED_BY_CALLBACK, /* 42 */
CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
CURLE_OBSOLETE44, /* 44 - NOT USED */
CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
CURLE_OBSOLETE46, /* 46 - NOT USED */
CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
CURLE_OBSOLETE50, /* 50 - NOT USED */
CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
wasn't verified fine */
CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
default */
CURLE_SEND_ERROR, /* 55 - failed sending network data */
CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
CURLE_OBSOLETE57, /* 57 - NOT IN USE */
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
that failed */
CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
accepted and we failed to login */
CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
CURLE_TFTP_PERM, /* 69 - permission problem on server */
CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
CURLE_CONV_FAILED, /* 75 - conversion failed */
CURLE_CONV_REQD, /* 76 - caller must register conversion
callbacks using curl_easy_setopt options
CURLOPT_CONV_FROM_NETWORK_FUNCTION,
CURLOPT_CONV_TO_NETWORK_FUNCTION, and
CURLOPT_CONV_FROM_UTF8_FUNCTION */
CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
or wrong format */
CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
CURLE_SSH, /* 79 - error from the SSH layer, somewhat
generic so the error message will be of
interest when this has happened */
CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
connection */
CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
wait till it's ready and try again (Added
in 7.18.2) */
CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
wrong format (Added in 7.19.0) */
CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
7.19.0) */
CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
session will be queued */
CURL_LAST /* never use! */
}
enum mrss_error_t
{
MRSS_OK = 0, /**< No error */
MRSS_ERR_POSIX, /**< For the correct error, use errno */
MRSS_ERR_PARSER, /**< Parser error */
MRSS_ERR_DOWNLOAD, /**< Download error */
MRSS_ERR_VERSION, /**< The RSS has a no compatible VERSION */
MRSS_ERR_DATA /**< The parameters are incorrect */
}
enum mrss_version_t
{
MRSS_VERSION_0_91, /**< 0.91 RSS version */
MRSS_VERSION_0_92, /**< 0.92 RSS version */
MRSS_VERSION_1_0, /**< 1.0 RSS version */
MRSS_VERSION_2_0, /**< 2.0 RSS version */
MRSS_VERSION_ATOM_0_3, /**< 0.3 Atom version */
MRSS_VERSION_ATOM_1_0 /**< 1.0 Atom version */
}
enum mrss_flag_t
{
MRSS_FLAG_VERSION = 1,
/** Set the title to a mrss_t element - the value is a string */
MRSS_FLAG_TITLE,
/** Set the title type to a mrss_t element - the value is a string (ex: text, html, ...)*/
MRSS_FLAG_TITLE_TYPE,
/** Set the description to a mrss_t element - the value is a string */
MRSS_FLAG_DESCRIPTION,
/** Set the description type to a mrss_t element - the value is a string */
MRSS_FLAG_DESCRIPTION_TYPE,
/** Set the link to a mrss_t element - the value is a string */
MRSS_FLAG_LINK,
/** Set the id to a mrss_t element - the value is a string */
MRSS_FLAG_ID,
/** Set the language to a mrss_t element - the value is a string */
MRSS_FLAG_LANGUAGE,
/** Set the rating to a mrss_t element - the value is a string */
MRSS_FLAG_RATING,
/** Set the copyright to a mrss_t element - the value is a string */
MRSS_FLAG_COPYRIGHT,
/** Set the copyright type to a mrss_t element - the value is a string */
MRSS_FLAG_COPYRIGHT_TYPE,
/** Set the pubDate to a mrss_t element - the value is a string */
MRSS_FLAG_PUBDATE,
/** Set the lastBuildDate to a mrss_t element - the value is a string */
MRSS_FLAG_LASTBUILDDATE,
/** Set the docs to a mrss_t element - the value is a string */
MRSS_FLAG_DOCS,
/** Set the managingeditor to a mrss_t element - the value is a string */
MRSS_FLAG_MANAGINGEDITOR,
/** Set the managingeditor's email to a mrss_t element - the value is a string */
MRSS_FLAG_MANAGINGEDITOR_EMAIL,
/** Set the managingeditor's uri to a mrss_t element - the value is a string */
MRSS_FLAG_MANAGINGEDITOR_URI,
/** Set the webMaster to a mrss_t element - the value is a string */
MRSS_FLAG_WEBMASTER,
/** Set the generator to a mrss_t element - the value is a string */
MRSS_FLAG_TTL,
/** Set the about to a mrss_t element - the value is a string */
MRSS_FLAG_ABOUT,
/* Contributor */
/** Set the contributor to a mrss_t element - the value is a string */
MRSS_FLAG_CONTRIBUTOR,
/** Set the contributor's email to a mrss_t element - the value is a string */
MRSS_FLAG_CONTRIBUTOR_EMAIL,
/** Set the contributor's uri to a mrss_t element - the value is a string */
MRSS_FLAG_CONTRIBUTOR_URI,
/* Generator */
/** Set the generator to a mrss_t element - the value is a string */
MRSS_FLAG_GENERATOR,
/** Set the generator's email to a mrss_t element - the value is a string */
MRSS_FLAG_GENERATOR_URI,
/** Set the generator's uri to a mrss_t element - the value is a string */
MRSS_FLAG_GENERATOR_VERSION,
/* Image */
/** Set the image_title to a mrss_t element - the value is a string */
MRSS_FLAG_IMAGE_TITLE,
/** Set the image_url to a mrss_t element - the value is a string */
MRSS_FLAG_IMAGE_URL,
/** Set the image_logo to a mrss_t element - the value is a string */
MRSS_FLAG_IMAGE_LOGO,
/** Set the image_link to a mrss_t element - the value is a string */
MRSS_FLAG_IMAGE_LINK,
/** Set the image_width to a mrss_t element - the value is a integer */
MRSS_FLAG_IMAGE_WIDTH,
/** Set the image_height to a mrss_t element - the value is a integer */
MRSS_FLAG_IMAGE_HEIGHT,
/** Set the image_description to a mrss_t element - the value is a string */
MRSS_FLAG_IMAGE_DESCRIPTION,
/* TextInput */
/** Set the textinput_title to a mrss_t element - the value is a string */
MRSS_FLAG_TEXTINPUT_TITLE,
/** Set the textinput_description to a mrss_t element - the value is a string */
MRSS_FLAG_TEXTINPUT_DESCRIPTION,
/** Set the textinput_name to a mrss_t element - the value is a string */
MRSS_FLAG_TEXTINPUT_NAME,
/** Set the textinput_link to a mrss_t element - the value is a string */
MRSS_FLAG_TEXTINPUT_LINK,
/* Cloud */
/** Set the cloud to a mrss_t element - the value is a string */
MRSS_FLAG_CLOUD,
/** Set the cloud_domain to a mrss_t element - the value is a string */
MRSS_FLAG_CLOUD_DOMAIN,
/** Set the cloud_port to a mrss_t element - the value is a string */
MRSS_FLAG_CLOUD_PORT,
/** Set the cloud_path to a mrss_t element - the value is a integer */
MRSS_FLAG_CLOUD_PATH,
/** Set the cloud_registerProcedure to a mrss_t element -
* the value is a string */
MRSS_FLAG_CLOUD_REGISTERPROCEDURE,
/** Set the cloud_protocol to a mrss_t element - the value is a string */
MRSS_FLAG_CLOUD_PROTOCOL,
/* SkipHours */
/** Set the hour to a mrss_hour_t element - the value is a string */
MRSS_FLAG_HOUR,
/* SkipDays */
/** Set the day to a mrss_day_t element - the value is a string */
MRSS_FLAG_DAY,
/* Category or Item/Category */
/** Set the category to a mrss_category_t element - the value is a string */
MRSS_FLAG_CATEGORY,
/** Set the domain to a mrss_category_t element - the value is a string */
MRSS_FLAG_CATEGORY_DOMAIN,
/** Set the label to a mrss_category_t element - the value is a string */
MRSS_FLAG_CATEGORY_LABEL,
/* Item */
/** Set the title to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_TITLE,
/** Set the title type to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_TITLE_TYPE,
/** Set the link to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_LINK,
/** Set the description to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_DESCRIPTION,
/** Set the description type to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_DESCRIPTION_TYPE,
/** Set the copyright to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_COPYRIGHT,
/** Set the copyright type to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_COPYRIGHT_TYPE,
/** Set the author to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_AUTHOR,
/** Set the author's uri to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_AUTHOR_URI,
/** Set the author's email to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_AUTHOR_EMAIL,
/** Set the contributor to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_CONTRIBUTOR,
/** Set the contributor's uri to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_CONTRIBUTOR_URI,
/** Set the contributor's email to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_CONTRIBUTOR_EMAIL,
/** Set the comments to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_COMMENTS,
/** Set the pubDate to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_PUBDATE,
/** Set the guid to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_GUID,
/** Set the guid_isPermaLink to a mrss_item_t element -
* the value is a integer */
MRSS_FLAG_ITEM_GUID_ISPERMALINK,
/** Set the source to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_SOURCE,
/** Set the source_url to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_SOURCE_URL,
/** Set the enclosure to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_ENCLOSURE,
/** Set the enclosure_url to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_ENCLOSURE_URL,
/** Set the enclosure_length to a mrss_item_t element -
* the value is a integer */
MRSS_FLAG_ITEM_ENCLOSURE_LENGTH,
/** Set the enclosure_type to a mrss_item_t element - the value is a string */
MRSS_FLAG_ITEM_ENCLOSURE_TYPE,
/* Item */
/** Set the name to a mrss_tag_t element - the value is a string */
MRSS_FLAG_TAG_NAME,
/** Set the value to a mrss_tag_t element - the value is a string */
MRSS_FLAG_TAG_VALUE,
/** Set the namespace to a mrss_tag_t element - the value is a string */
MRSS_FLAG_TAG_NS,
/** Set the name to a mrss_attribute_t element - the value is a string */
MRSS_FLAG_ATTRIBUTE_NAME,
/** Set the value to a mrss_attribute_t element - the value is a string */
MRSS_FLAG_ATTRIBUTE_VALUE,
/** Set the namespace to a mrss_attribute_t element - the value is a string */
MRSS_FLAG_ATTRIBUTE_NS,
/** Set the terminetor flag */
MRSS_FLAG_END = 0
}
enum mrss_element_t
{
MRSS_ELEMENT_CHANNEL,
MRSS_ELEMENT_ITEM,
MRSS_ELEMENT_SKIPHOURS,
MRSS_ELEMENT_SKIPDAYS,
MRSS_ELEMENT_CATEGORY,
MRSS_ELEMENT_TAG,
MRSS_ELEMENT_ATTRIBUTE
}
struct mrss_item_t {
mrss_element_t element;
int allocated;
char *title; /* R O O O R */
char *title_type; /* - - - - O */
char *link; /* R O O O O */
char *description; /* R O - O O */
char *description_type; /* - - - - 0 */
char *copyright; /* - - - - O */
char *copyright_type; /* - - - - O */
char *author; /* - - - O O */
char *author_uri; /* - - - - O */
char *author_email; /* - - - - O */
char *contributor; /* - - - - O */
char *contributor_uri; /* - - - - O */
char *contributor_email; /* - - - - O */
char *comments; /* - - - O - */
char *pubDate; /* - - - O O */
char *guid; /* - - - O O */
int guid_isPermaLink; /* - - - O - */
char *source; /* - O - O - */
char *source_url; /* - R - R - */
char *enclosure; /* - O - O - */
char *enclosure_url; /* - R - R - */
int enclosure_length; /* - R - R - */
char *enclosure_type; /* - R - R - */
mrss_category_t *category; /* - O - O O */
mrss_tag_t *other_tags;
mrss_item_t *next;
}
struct mrss_hour_t {
mrss_element_t element;
int allocated;
char *hour; /* R R - R - */
mrss_hour_t *next;
}
struct mrss_day_t {
/** For internal use only: */
mrss_element_t element;
int allocated;
/* Data: */
/* 0.91 0.92 1.0 2.0 ATOM */
char *day; /* R R - R - */
mrss_day_t *next;
}
struct mrss_category_t {
mrss_element_t element;
int allocated;
char *category; /* - R - R R */
char *domain; /* - O - O O */
char *label; /* - - - - O */
mrss_category_t *next;
}
struct mrss_t {
mrss_element_t element;
int allocated;
int curl_error;
char *file;
size_t size;
char *encoding;
mrss_version_t _version;
char *title; /* R R R R R */
char *title_type; /* - - - - O */
char *description; /* R R R R R */
char *description_type; /* - - - - O */
char *link; /* R R R R O */
char *id; /* - - - - O */
char *language; /* R O - O O */
char *rating; /* O O - O - */
char *copyright; /* O O - O O */
char *copyright_type; /* - - - - O */
char *pubDate; /* O O - O - */
char *lastBuildDate; /* O O - O O */
char *docs; /* O O - O - */
char *managingeditor; /* O O - O O */
char *managingeditor_email; /* O O - O O */
char *managingeditor_uri; /* O O - O O */
char *webMaster; /* O O - O - */
int ttl; /* - - - O - */
char *about; /* - - R - - */
char *contributor; /* - - - - R */
char *contributor_email; /* - - - - O */
char *contributor_uri; /* - - - - O */
char *generator; /* - - - O O */
char *generator_uri; /* - - - - O */
char *generator_version; /* - - - - O */
char *image_title; /* R R R R - */
char *image_url; /* R R R R O */
char *image_logo; /* - - - - O */
char *image_link; /* R R R R - */
uint image_width; /* O O - O - */
uint image_height; /* O O - O - */
char *image_description; /* O O - O - */
/* TextInput: */ /* O O O O - */
char *textinput_title; /* R R R R - */
char *textinput_description; /* R R R R - */
char *textinput_name; /* R R R R - */
char *textinput_link; /* R R R R - */
/* Cloud */
char *cloud; /* - O - O - */
char *cloud_domain; /* - R - R - */
int cloud_port; /* - R - R - */
char *cloud_path; /* - R - R - */
char *cloud_registerProcedure;/* - R - R - */
char *cloud_protocol; /* - R - R - */
mrss_hour_t *skipHours; /* O O - O - */
mrss_day_t *skipDays; /* O O - O - */
mrss_category_t *category; /* - O - O O */
mrss_item_t *item; /* R R R R R */
mrss_tag_t *other_tags;
version(USE_LOCALE)
void *c_locale;
}
struct mrss_tag_t {
/** For internal use only: */
mrss_element_t element;
int allocated;
/*name of the tag */
char *name;
/* value */
char *value;
/* namespace */
char *ns;
/* list of attributes: */
mrss_attribute_t *attributes;
/* Sub tags: */
mrss_tag_t *children;
/* the next tag: */
mrss_tag_t *next;
};
struct mrss_attribute_t {
/** For internal use only: */
mrss_element_t element;
int allocated;
/* name of the tag */
char *name;
/* value */
char *value;
/* namespace */
char *ns;
/* The next attribute: */
mrss_attribute_t *next;
}
struct mrss_options_t
{
int timeout;
char *proxy;
char *proxy_authentication;
char *certfile;
char *cacert;
char *password;
int verifypeer;
char *authentication;
char *user_agent;
}
mrss_error_t mrss_parse_url (char * url, mrss_t ** mrss);
mrss_error_t mrss_parse_url_with_options (char * url, mrss_t ** mrss, mrss_options_t * options);
mrss_error_t mrss_parse_url_with_options_and_error (char * url, mrss_t ** mrss, mrss_options_t * options, CURLcode * curlcode);
mrss_error_t mrss_parse_url_with_options_error_and_transfer_buffer (char * url, mrss_t ** mrss, mrss_options_t * options, CURLcode * curlcode, char ** feed_content, int * feed_size);
mrss_error_t mrss_parse_file (char * file, mrss_t ** mrss); mrss_error_t mrss_parse_buffer (char * buffer, size_t size_buffer, mrss_t ** mrss);
mrss_error_t mrss_write_file (mrss_t * mrss,char* file);
mrss_error_t mrss_write_buffer (mrss_t * mrss, char ** buffer);
mrss_error_t mrss_free (mrss_generic_t element);
char * mrss_strerror (mrss_error_t err);
char * mrss_curl_strerror (CURLcode err);
mrss_error_t mrss_element (mrss_generic_t element, mrss_element_t *ret);
mrss_error_t mrss_get_last_modified(char * urlstring, time_t * lastmodified);
mrss_error_t mrss_get_last_modified_with_options (char * urlstring, time_t * lastmodified, mrss_options_t * options);
mrss_error_t mrss_get_last_modified_with_options_and_error
(char * urlstring,
time_t * lastmodified,
mrss_options_t * options,
CURLcode * curl_code);
mrss_error_t mrss_new (mrss_t ** mrss);
mrss_error_t mrss_set (mrss_generic_t element,
...);
mrss_error_t mrss_get (mrss_generic_t element,
...);
mrss_error_t mrss_new_subdata (mrss_generic_t element,
mrss_element_t subelement,
mrss_generic_t subdata);
mrss_error_t mrss_remove_subdata (mrss_generic_t element,
mrss_generic_t subdata);
mrss_error_t mrss_search_tag (mrss_generic_t element, char * name, char * ns, mrss_tag_t ** tag);
mrss_error_t mrss_search_attribute (mrss_generic_t element, char * name, char * ns,
mrss_attribute_t ** attribute);
mrss_options_t * mrss_options_new (int timeout, char *proxy, char *proxy_authentication, char *certfile, char *password,
char *cacert, int verifypeer, char *authentication, char *user_agent);
void mrss_options_free (mrss_options_t *options);
| D |
// Written in the D programming language.
// Copyright: Coverify Systems Technology 2013 - 2014
// License: 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)
// Authors: Puneet Goel <puneet@coverify.com>
// This file is a part of esdl.
// This file is a part of VLang.
// This file contains functionality to translate constraint block into
// functions that are used for solving the constraints. Since this
// translator is invoked by vlang at compile time, the code is
// optimized for memory. The translator works in two phases. In the
// first phase we just parse through the code to get an idea of the
// length of the resulting string. In the second phase we actually
// translate the constraint block
// The logic of this translator is simple. Here is what we need to
// achieve:
// 1. If we hit a foreach or if/else block, we need to handle it: TBD
// 2. We need to replace all the identifiers and literals with a
// wrapper around them
// 3. All the compariason operators and the implication operator need
// to be replaced with corresponding function calls. The good thing is
// that none of none of these operators chain together
// Here is how we do it:
//
// 1. Treat all parenthesis, addition, multiplication, substraction
// other lower level operators as whitespace. These just need to be
// replicated in the output
// 2. start from left, reserve space for two left parenthesis, one for
// possible implication operator and another for possible compariason
// operator. Keep two local size_t variables to track these paren
// positions.
// 3. Any logic operator "&&" or "||" or an implication operator "=>"
// or a semicolon will will terminate a comparion. We also keep track
// of whether we are inside a comparison operator using a bool
// variale.
// 4. a semicolon alone can end an implication operator.
// As for foreach block, we need to keep a mapping table to help
// replace the identifiers as required. We shall use two dynamic
// arrays to help achieve that. TBD
module esdl.rand.cstx;
import std.conv;
struct CstParser {
immutable string CST;
immutable string FILE;
immutable size_t LINE;
bool dryRun = true;
char[] outBuffer;
string dummy; // sometimes required in dryRun
string _solver;
size_t outCursor = 0;
size_t dclCursor = 0;
size_t srcCursor = 0;
size_t srcLine = 0;
size_t numParen = 0;
size_t numIndex = 0;
size_t[] indexTag;
VarPair[] varMap = [];
string[] iterators;
// list of if conditions that are currently active
Condition[] ifConds = [];
void setupBuffer() {
outBuffer.length = outCursor + dclCursor;
outCursor = dclCursor;
srcCursor = 0;
dclCursor = 0;
dcls.length = 0;
if(varMap.length !is 0) {
assert(false, "varMap has not been unrolled completely");
}
dryRun = false;
}
this(string CST, string FILE, size_t LINE) {
this.CST = CST;
this.FILE = FILE;
this.LINE = LINE;
}
size_t retreat(size_t step) {
size_t start = outCursor;
outCursor -= step;
return start;
}
size_t fill(in string source) {
size_t start = outCursor;
if(! dryRun) {
foreach(i, c; source) {
outBuffer[outCursor+i] = c;
}
}
outCursor += source.length;
return start;
}
void place(in char c, size_t cursor = 0) {
if(! dryRun) outBuffer[cursor] = c;
}
string[] dcls;
bool needDcl(in string source) {
// no declaration for numeric literals
if (source[0] < '9' && source[0] > '0') {
return false;
}
foreach (dcl; dcls) {
if (source == dcl) return false;
}
return true;
}
void fillDeclaration(in string source) {
if (needDcl(source)) {
fillDcl("// _esdl__declProxy!");
fillDcl(source);
fillDcl(";\n");
dcls ~= source;
}
}
size_t fillDcl(in string source) {
size_t start = dclCursor;
if(! dryRun) {
foreach(i, c; source) {
outBuffer[dclCursor+i] = c;
}
}
dclCursor += source.length;
return start;
}
// CstParser exprParser(size_t cursor) {
// CstParser dup = CstParser(CST[cursor..$]);
// return dup;
// }
enum OpToken: byte
{ NONE = 0,
AND,
OR,
XOR,
ADD,
SUB,
MUL,
DIV,
REM, // remainder
LSH,
RSH,
EQU,
GTE,
LTE,
NEQ,
GTH,
LTH,
LOGICIMP, // Implication operator
LOGICAND,
LOGICOR,
INDEX,
SLICE,
}
enum OpUnaryToken: byte
{ NONE = 0,
NEG,
INV,
NOT,
}
OpUnaryToken parseUnaryOperator() {
OpUnaryToken tok = OpUnaryToken.NONE;
if(srcCursor < CST.length) {
if(CST[srcCursor] == '~') tok = OpUnaryToken.INV;
if(CST[srcCursor] == '!') tok = OpUnaryToken.NOT;
if(CST[srcCursor] == '-') tok = OpUnaryToken.NEG;
}
if(tok !is OpUnaryToken.NONE) {
srcCursor += 1;
return tok;
}
return tok; // None
}
OpToken parseOperator() {
OpToken tok = OpToken.NONE;
if(srcCursor < CST.length - 1) {
if(CST[srcCursor] == '<' && CST[srcCursor+1] == '<') tok = OpToken.LSH;
if(CST[srcCursor] == '>' && CST[srcCursor+1] == '>') tok = OpToken.RSH;
if(CST[srcCursor] == '=' && CST[srcCursor+1] == '=') tok = OpToken.EQU;
if(CST[srcCursor] == '>' && CST[srcCursor+1] == '=') tok = OpToken.GTE;
if(CST[srcCursor] == '<' && CST[srcCursor+1] == '=') tok = OpToken.LTE;
if(CST[srcCursor] == '!' && CST[srcCursor+1] == '=') tok = OpToken.NEQ;
if(CST[srcCursor] == '&' && CST[srcCursor+1] == '&') tok = OpToken.LOGICAND;
if(CST[srcCursor] == '|' && CST[srcCursor+1] == '|') tok = OpToken.LOGICOR;
if(CST[srcCursor] == '-' && CST[srcCursor+1] == '>') tok = OpToken.LOGICIMP;
if(CST[srcCursor] == '.' && CST[srcCursor+1] == '.') tok = OpToken.SLICE;
}
if(tok !is OpToken.NONE) {
srcCursor += 2;
return tok;
}
if(srcCursor < CST.length) {
if(CST[srcCursor] == '&') tok = OpToken.AND;
if(CST[srcCursor] == '|') tok = OpToken.OR;
if(CST[srcCursor] == '^') tok = OpToken.XOR;
if(CST[srcCursor] == '+') tok = OpToken.ADD;
if(CST[srcCursor] == '-') tok = OpToken.SUB;
if(CST[srcCursor] == '*') tok = OpToken.MUL;
if(CST[srcCursor] == '/') tok = OpToken.DIV;
if(CST[srcCursor] == '%') tok = OpToken.REM;
if(CST[srcCursor] == '<') tok = OpToken.LTH;
if(CST[srcCursor] == '>') tok = OpToken.GTH;
if(CST[srcCursor] == '[') tok = OpToken.INDEX;
// if(CST[srcCursor] == ';') tok = OpToken.END;
}
if(tok !is OpToken.NONE) {
srcCursor += 1;
return tok;
}
return tok; // None
}
void errorToken() {
import std.conv;
size_t start = srcCursor;
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if(c !is ' ' && c !is '\n' && c !is '\t' && c !is '\r' && c !is '\f') {
++srcCursor;
}
else break;
}
if(srcCursor == start) {
assert(false, "EOF while parsing!");
}
assert(false, "Unrecognized token: " ~ "'" ~
CST[start..srcCursor] ~ "' -- at: " ~ srcCursor.to!string);
}
size_t parseIdentifier() {
size_t start = srcCursor;
if(srcCursor < CST.length) {
char c = CST[srcCursor];
if((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c == '_')) {
++srcCursor;
}
else {
return start;
}
}
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == '_') {
++srcCursor;
}
else {
break;
}
}
return start;
}
// I do not want to use any dynamic arrays here since this all is
// compile time and I do not want DMD to allocate memory for this at
// compile time.
enum MaxHierDepth = 20;
int[MaxHierDepth * 2] parseIdentifierChain() {
int[MaxHierDepth * 2] result;
size_t wTag = srcCursor;
size_t start = srcCursor;
size_t srcTag = srcCursor;
result[0] = -1;
wTag = srcCursor;
parseSpace();
srcTag = srcCursor;
parseIdentifier();
for (size_t i=0; i != MaxHierDepth-1; ++i) {
if(srcCursor > srcTag) {
fill(CST[wTag..srcTag]);
result[2*i] = cast(int) (srcTag - start);
result[2*i + 1] = cast(int) (srcCursor - start);
}
else {
if(i != 0) srcCursor = wTag - 1;
result[2*i] = -1;
break;
}
srcTag = srcCursor;
parseSpace();
if(CST[srcCursor] == '.') {
fill(CST[srcTag..srcCursor]);
++srcCursor;
wTag = srcCursor;
parseSpace();
srcTag = srcCursor;
parseIdentifier();
continue;
}
else if (CST[srcCursor] == '[') {
fill(CST[srcTag..srcCursor]);
// ++srcCursor;
wTag = srcCursor;
// parseSpace();
srcTag = srcCursor;
moveToMatchingBracket();
continue;
}
else {
srcCursor = srcTag;
result[2*i + 2] = -1;
break;
}
}
return result;
}
size_t moveToMatchingBracket() {
size_t start = srcCursor;
uint bracketCount = 0;
while (srcCursor < CST.length) {
if (CST[srcCursor] == '/' && CST[srcCursor+1] == '/') {
parseLineComment();
continue;
}
if (CST[srcCursor] == '/' && CST[srcCursor+1] == '*') {
parseBlockComment();
continue;
}
if (CST[srcCursor] == '/' && CST[srcCursor+1] == '+') {
parseNestedComment();
continue;
}
if (CST[srcCursor] == '[') {
bracketCount++;
srcCursor++;
continue;
}
if (CST[srcCursor] == ']') {
bracketCount--;
srcCursor++;
if (bracketCount == 0) {
break;
}
continue;
}
srcCursor++;
continue;
}
if (bracketCount != 0) {
assert(false, "Unbalanced backet");
}
return start;
}
size_t procIdentifier() {
// parse an identifier and the following '.' heirarcy if any
auto start = srcCursor;
auto srcTag = srcCursor;
int[MaxHierDepth * 2] idChain = parseIdentifierChain();
if(idChain[0] != -1) {
int indx = idMatch(CST[srcTag+idChain[0]..srcTag+idChain[1]]);
if(indx == -1) {
fill(CST[srcTag+idChain[0]..srcTag+idChain[1]]);
fillDeclaration(CST[srcTag+idChain[0]..srcTag+idChain[1]]);
}
else {
fill(varMap[indx].xLat);
fillDeclaration(varMap[indx].xLatBase);
}
if(idChain[2] != -1) {
fill(".");
for (size_t i=1; i != MaxHierDepth-1; ++i) {
if (CST[srcTag+idChain[2*i]] != '[') {
fill(CST[srcTag+idChain[2*i]..srcTag+idChain[2*i+1]]);
}
else {
indexTag ~= outCursor-1;
fill("opIndex(");
++numIndex;
procSubExpr(srcTag+idChain[2*i]+1);
fill(")");
}
if(idChain[2*i+2] == -1) break;
else fill(".");
}
// fill("}(_outer)");
}
}
else {
srcTag = parseLiteral();
if(srcCursor > srcTag) {
fill(CST[srcTag..srcCursor]);
fillDeclaration(CST[srcTag..srcCursor]);
}
else {
srcTag = parseWithArg();
if(srcCursor > srcTag) {
fill("_esdl__arg!");
fill(CST[srcTag+1..srcCursor]);
}
else {
errorToken();
}
}
}
return start;
}
size_t parseLineComment() {
size_t start = srcCursor;
if(srcCursor >= CST.length - 2 ||
CST[srcCursor] != '/' || CST[srcCursor+1] != '/') return start;
else {
srcCursor += 2;
while(srcCursor < CST.length) {
if(CST[srcCursor] == '\n') {
break;
}
else {
if(srcCursor == CST.length) {
// commment unterminated
assert(false, "Line comment not terminated");
}
}
srcCursor += 1;
}
srcCursor += 1;
return start;
}
}
unittest {
size_t curs = 4;
assert(parseLineComment("Foo // Bar;\n\n", curs) == 8);
assert(curs == 12);
}
size_t parseBlockComment() {
size_t start = srcCursor;
if(srcCursor >= CST.length - 2 ||
CST[srcCursor] != '/' || CST[srcCursor+1] != '*') return start;
else {
srcCursor += 2;
while(srcCursor < CST.length - 1) {
if(CST[srcCursor] == '*' && CST[srcCursor+1] == '/') {
break;
}
else {
if(srcCursor == CST.length - 1) {
// commment unterminated
assert(false, "Block comment not terminated");
}
}
srcCursor += 1;
}
srcCursor += 2;
return start;
}
}
unittest {
size_t curs = 4;
assert(parseBlockComment("Foo /* Bar;\n\n */", curs) == 4);
assert(curs == 16);
}
size_t parseNestedComment() {
size_t nesting = 0;
size_t start = srcCursor;
if(srcCursor >= CST.length - 2 ||
CST[srcCursor] != '/' || CST[srcCursor+1] != '+') return start;
else {
srcCursor += 2;
while(srcCursor < CST.length - 1) {
if(CST[srcCursor] == '/' && CST[srcCursor+1] == '+') {
nesting += 1;
srcCursor += 1;
}
else if(CST[srcCursor] == '+' && CST[srcCursor+1] == '/') {
if(nesting == 0) {
break;
}
else {
nesting -= 1;
srcCursor += 1;
}
}
srcCursor += 1;
if(srcCursor >= CST.length - 1) {
// commment unterminated
assert(false, "Block comment not terminated");
}
}
srcCursor += 2;
return start;
}
}
unittest {
size_t curs = 4;
parseNestedComment("Foo /+ Bar;/+// \n+/+*/ +/", curs);
assert(curs == 25);
}
size_t parseLiteral() {
size_t start = srcCursor;
// look for 0b or 0x
if(srcCursor + 2 <= CST.length &&
CST[srcCursor] == '0' &&
(CST[srcCursor+1] == 'x' ||
CST[srcCursor+1] == 'X')) { // hex numbers
srcCursor += 2;
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F') ||
(c == '_')) {
++srcCursor;
}
else {
break;
}
}
}
else if(srcCursor + 2 <= CST.length &&
CST[srcCursor] == '0' &&
(CST[srcCursor+1] == 'b' ||
CST[srcCursor+1] == 'B')) { // binary numbers
srcCursor += 2;
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if((c == '0' || c == '1' || c == '_')) {
++srcCursor;
}
else {
break;
}
}
}
else { // decimals
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if((c >= '0' && c <= '9') ||
(c == '_')) {
++srcCursor;
}
else {
break;
}
}
}
if(srcCursor > start) {
// Look for long/short specifier
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if(c == 'L' || c == 'u' || c == 'U') {
++srcCursor;
}
else {
break;
}
}
}
return start;
}
size_t parseWithArg() {
size_t start = srcCursor;
if(srcCursor < CST.length &&
CST[srcCursor == '@']) {
++srcCursor;
}
else return start;
while(srcCursor < CST.length) {
char c = CST[srcCursor];
if((c >= '0' && c <= '9')) {
++srcCursor;
}
else {
break;
}
}
return start;
}
unittest {
size_t curs = 4;
assert(parseIdentifier("Foo Bar;", curs) == 0);
assert(curs == 7);
}
size_t parseWhiteSpace() {
auto start = srcCursor;
while(srcCursor < CST.length) {
auto c = CST[srcCursor];
// eat up whitespaces
if(c is '\n') ++srcLine;
if(c is ' ' || c is '\n' || c is '\t' || c is '\r' || c is '\f') {
++srcCursor;
continue;
}
else {
break;
}
}
return start;
}
size_t parseLeftParens() {
auto start = srcCursor;
while(srcCursor < CST.length) {
auto srcTag = srcCursor;
parseLineComment();
parseBlockComment();
parseNestedComment();
parseWhiteSpace();
if(srcCursor > srcTag) {
continue;
}
else {
if(srcCursor < CST.length && CST[srcCursor] == '(') {
++numParen;
++srcCursor;
continue;
}
else {
break;
}
}
}
return start;
}
// Parse parenthesis on the right hand side. But stop if and when
// the numParen has already hit zero. This is important since for if
// conditional we want to know where to stop parsing.
size_t parseRightParens() {
auto start = srcCursor;
while(srcCursor < CST.length) {
auto srcTag = srcCursor;
parseLineComment();
parseBlockComment();
parseNestedComment();
parseWhiteSpace();
if(srcCursor > srcTag) {
continue;
}
else {
if(srcCursor < CST.length && CST[srcCursor] == ')') {
if(numParen is 0) break;
--numParen;
++srcCursor;
continue;
}
if(srcCursor < CST.length && CST[srcCursor] == ']') {
if(numIndex is 0) break;
indexTag.length -= 1;
--numIndex;
++srcCursor;
continue;
}
else {
break;
}
}
}
return start;
}
size_t moveToRightParens() {
auto start = srcCursor;
while(srcCursor < CST.length) {
auto srcTag = srcCursor;
parseLineComment();
parseBlockComment();
parseNestedComment();
parseWhiteSpace();
if(srcCursor > srcTag) {
fill(CST[srcTag..srcCursor]);
continue;
}
else {
if(srcCursor < CST.length && CST[srcCursor] == ')') {
if(numParen is 0) break;
--numParen;
++srcCursor;
fill(")");
continue;
}
if(srcCursor < CST.length && CST[srcCursor] == ']') {
if(numIndex is 0) break;
--numIndex;
++srcCursor;
fill(")");
continue;
}
else {
break;
}
}
}
return start;
}
size_t parseSpace() {
auto start = srcCursor;
while(srcCursor < CST.length) {
auto srcTag = srcCursor;
parseLineComment();
parseBlockComment();
parseNestedComment();
parseWhiteSpace();
if(srcCursor > srcTag) {
continue;
}
else {
break;
}
}
return start;
}
unittest {
size_t curs = 0;
assert(parseLeftParens(" // foo\nFoo Bar;", curs) == 11);
assert(curs == 11);
}
char[] translate(string solver, string name) {
_solver = solver;
translateBlock(name);
setupBuffer();
translateBlock(name);
return outBuffer;
}
void translateBlock(string name) {
string blockName;
import std.conv: to;
fill("// Constraint @ File: " ~ FILE ~ " Line: " ~ LINE.to!string ~ "\n\n");
if (name == "") {
fill("override CstBlock getCstExpr() {\n"// ~
// "\n auto cstExpr = new CstBlock;\n"
);
blockName = "_esdl__cst_block";
}
else {
fill("CstBlock _esdl__cst_func_" ~ name ~ "() {\n"// ~
// "\n auto cstExpr = new CstBlock;\n"
);
blockName = "_esdl__cst_block_" ~ name;
}
fill(" if (" ~ blockName ~ " !is null) return " ~
blockName ~ ";\n");
fill(" CstBlock _esdl__block = new CstBlock();\n");
procBlock();
fill(" " ~ blockName ~ " = _esdl__block;\n");
fill(" return _esdl__block;\n}\n");
}
char[] translateExpr() {
procExpr();
setupBuffer();
procExpr();
return outBuffer;
}
int idMatch(string id) {
foreach(int i, var; varMap) {
if(var.varName == id) return i;
}
return -1;
}
// Variable translation map
struct VarPair {
string varName;
string xLat;
string xLatBase;
}
struct Condition {
bool _inverse = false;
string _cond;
this(string cond) {
_cond = cond;
}
string cond() {
return _cond;
}
void switchToElse() {
_inverse = true;
}
bool isInverse() {
return _inverse;
}
}
void procForeachBlock() {
string index;
string elem;
string array;
string arrayBase;
size_t srcTag;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
srcTag = parseIdentifier();
if(CST[srcTag..srcCursor] != "foreach") {
import std.conv: to;
assert(false, "Not a FOREACH block at: " ~ srcTag.to!string);
}
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] != '(') {
errorToken();
}
++srcCursor;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
// Parse the index
srcTag = parseIdentifier();
if(srcCursor > srcTag) {
// FIXME -- check if the variable names do not shadow earlier
// names in the table
index = CST[srcTag..srcCursor];
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] == ';') {
elem = index;
index = "";
}
else if(CST[srcCursor] != ',') {
errorToken();
}
++srcCursor;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
}
else {
errorToken();
}
// Parse elem
if(elem.length is 0) {
srcTag = parseIdentifier();
if(srcCursor > srcTag) {
// FIXME -- check if the variable names do not shadow earlier
// names in the table
elem = CST[srcTag..srcCursor];
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] != ';') {
errorToken();
}
++srcCursor;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
}
else {
errorToken();
}
}
// Parse array
srcTag = parseIdentifier();
if(srcCursor > srcTag) {
// FIXME -- check if the variable names do not shadow earlier
// names in the table
array = CST[srcTag..srcCursor];
arrayBase = CST[srcTag..srcCursor];
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] != ')') {
errorToken();
}
++srcCursor;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
}
else {
errorToken();
}
int indx = idMatch(array);
if(indx != -1) {
array = varMap[indx].xLat;
arrayBase = varMap[indx].xLatBase;
}
// add index
iterators ~= array ~ ".iterator()";
if(index.length != 0) {
VarPair x;
x.varName = index;
x.xLat = array ~ ".iterator()";
x.xLatBase = arrayBase;
varMap ~= x;
}
VarPair x;
x.varName = elem;
x.xLat = array ~ ".elements()";
x.xLatBase = arrayBase;
varMap ~= x;
if(CST[srcCursor] is '{') {
++srcCursor;
procBlock();
}
else {
procStmt();
}
iterators = iterators[0..$-1];
if(index.length != 0) {
varMap = varMap[0..$-2];
}
else {
varMap = varMap[0..$-1];
}
}
void procIfBlock() {
size_t srcTag;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
srcTag = parseIdentifier();
if(CST[srcTag..srcCursor] != "if") {
import std.conv: to;
assert(false, "Not a IF block at: " ~ srcTag.to!string);
}
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] != '(') {
errorToken();
}
++srcCursor;
fill("/* IF Block: ");
auto outTag = outCursor;
procExpr();
if(dryRun) {
dummy.length = outCursor-outTag;
Condition ifCond = dummy;
ifConds ~= ifCond;
}
else {
Condition ifCond = Condition(cast(string) outBuffer[outTag..outCursor]);
ifConds ~= ifCond;
}
fill("*/\n");
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] != ')') {
errorToken();
}
++srcCursor;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] is '{') {
++srcCursor;
procBlock();
}
else {
procStmt();
}
// In case there is an else clause
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
srcTag = parseIdentifier();
if(CST[srcTag..srcCursor] != "else") { // no else
srcCursor = srcTag; // revert the cursor
ifConds = ifConds[0..$-1];
return;
}
else {
fill("// Else \n");
ifConds[$-1].switchToElse();
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor] is '{') {
++srcCursor;
procBlock();
}
else {
procStmt();
}
ifConds = ifConds[0..$-1];
}
}
void procBeforeStmt() {
size_t srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
srcTag = parseIdentifier();
if(CST[srcTag..srcCursor] != "solve") {
import std.conv: to;
assert(false, "Not a solve statement at: " ~ srcTag.to!string);
}
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
procIdentifier();
fill(".solveBefore(");
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
srcTag = parseIdentifier();
if(CST[srcTag..srcCursor] != "before") {
import std.conv: to;
assert(false, "Expected keyword \"before\" at: " ~ srcTag.to!string);
}
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
procIdentifier();
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor++] !is ';') {
assert(false, "Error: -- ';' missing at end of statement; at " ~
srcCursor.to!string);
}
fill(");\n");
}
enum StmtToken: byte
{ STMT = 0,
FOREACH,
IFCOND,
ENDCST, // end of text
BEFORE,
BLOCK,
ENDBLOCK,
// ANYTHING ELSE COMES HERE
ERROR,
}
// Just return whether the next statement is a normal statement
// FOREACH or IFCOND etc
StmtToken nextStmtToken() {
auto savedCursor = srcCursor;
auto savedParen = numParen;
scope(exit) {
srcCursor = savedCursor; // restore
numParen = savedParen; // restore
}
size_t srcTag;
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(srcCursor == CST.length) return StmtToken.ENDCST;
srcTag = parseLeftParens();
// if a left parenthesis has been found at the beginning it can only
// be a normal statement
if(srcCursor > srcTag) return StmtToken.STMT;
if ((CST[srcCursor] >= 'A' && CST[srcCursor] <= 'Z') ||
(CST[srcCursor] >= 'a' && CST[srcCursor] <= 'z') ||
(CST[srcCursor] == '_')) {
srcTag = parseIdentifier();
if(srcCursor > srcTag) {
if(CST[srcTag..srcCursor] == "foreach") return StmtToken.FOREACH;
if(CST[srcTag..srcCursor] == "if") return StmtToken.IFCOND;
if(CST[srcTag..srcCursor] == "solve") return StmtToken.BEFORE;
// not a keyword
return StmtToken.STMT;
}
}
if (CST[srcCursor] is '{') return StmtToken.BLOCK;
if (CST[srcCursor] is '}') return StmtToken.ENDBLOCK;
return StmtToken.STMT;
// return StmtToken.ERROR;
}
void procSubExpr(size_t cursor) {
auto savedCursor = srcCursor;
auto savedNumIndex = numIndex;
auto savedNumParen = numParen;
srcCursor = cursor;
numIndex = 0;
numParen = 0;
procExpr();
numIndex = savedNumIndex;
numParen = savedNumParen;
srcCursor = savedCursor;
}
void procExpr() {
bool cmpRHS;
bool andRHS;
bool orRHS;
bool impRHS;
size_t srcTag = 0;
size_t cmpDstAnchor = fill(" ");
size_t andDstAnchor = fill(" ");
size_t orDstAnchor = fill(" ");
size_t impDstAnchor = fill(" ");
loop:
while(srcCursor < CST.length) {
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(srcCursor == CST.length) break;
// Parse any left braces now
srcTag = parseLeftParens();
fill(CST[srcTag..srcCursor]);
// Parse any unary operators
auto uTok = parseUnaryOperator();
final switch(uTok) {
case OpUnaryToken.NEG: fill("-"); continue loop;
case OpUnaryToken.NOT: fill("*"); continue loop;
case OpUnaryToken.INV: fill("~"); continue loop;
case OpUnaryToken.NONE: break;
}
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
fill("_esdl__vec(");
srcTag = procIdentifier();
fill(", \"");
fill(CST[srcTag..srcCursor]);
fill("\"");
fill(")");
// fillDeclaration(CST[srcTag..srcCursor]);
srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
srcTag = moveToRightParens();
// fill(CST[srcTag..srcCursor]);
srcTag = srcCursor;
OpToken opToken = parseOperator();
final switch(opToken) {
case OpToken.NONE:
// errorToken();
// break;
// case OpToken.END:
if(cmpRHS is true) {
fill(")");
cmpRHS = false;
}
if(andRHS is true) {
fill(")");
andRHS = false;
}
if(orRHS is true) {
fill(")");
orRHS = false;
}
if(impRHS is true) {
fill(")");
impRHS = false;
}
return;
// break;
case OpToken.LOGICIMP:
if(cmpRHS is true) {
fill(")");
cmpRHS = false;
}
if(andRHS is true) {
fill(")");
andRHS = false;
}
if(orRHS is true) {
fill(")");
orRHS = false;
}
place('(', impDstAnchor);
fill(").implies(");
cmpDstAnchor = fill(" ");
andDstAnchor = fill(" ");
orDstAnchor = fill(" ");
impRHS = true;
break;
case OpToken.LOGICOR: // take care of cmp/and
if(cmpRHS is true) {
fill(")");
cmpRHS = false;
}
if(andRHS is true) {
fill(")");
andRHS = false;
}
if(orRHS !is true) {
place('(', orDstAnchor);
orRHS = true;
}
fill(")._esdl__logicOr(");
cmpDstAnchor = fill(" ");
andDstAnchor = fill(" ");
break;
case OpToken.LOGICAND: // take care of cmp
if(cmpRHS is true) {
fill(")");
cmpRHS = false;
}
if(andRHS !is true) {
place('(', andDstAnchor);
andRHS = true;
}
fill(") ._esdl__logicAnd(");
cmpDstAnchor = fill(" ");
break;
case OpToken.EQU:
place('(', cmpDstAnchor);
cmpRHS = true;
fill(")._esdl__equ (");
break;
case OpToken.NEQ:
place('(', cmpDstAnchor);
cmpRHS = true;
fill(")._esdl__neq (");
break;
case OpToken.LTE:
place('(', cmpDstAnchor);
cmpRHS = true;
fill(")._esdl__lte (");
break;
case OpToken.GTE:
place('(', cmpDstAnchor);
cmpRHS = true;
fill(")._esdl__gte (");
break;
case OpToken.LTH:
place('(', cmpDstAnchor);
cmpRHS = true;
fill(")._esdl__lth (");
break;
case OpToken.GTH:
place('(', cmpDstAnchor);
cmpRHS = true;
fill(")._esdl__gth (");
break;
case OpToken.AND:
fill(" & ");
break;
case OpToken.OR:
fill(" | ");
break;
case OpToken.XOR:
fill(" ^ ");
break;
case OpToken.ADD:
fill(" + ");
break;
case OpToken.SUB:
fill(" - ");
break;
case OpToken.MUL:
fill(" * ");
break;
case OpToken.DIV:
fill(" / ");
break;
case OpToken.REM:
fill(" % ");
break;
case OpToken.LSH:
fill(" << ");
break;
case OpToken.RSH:
fill(" >> ");
break;
case OpToken.INDEX:
indexTag ~= outCursor;
fill(".opIndex(");
++numIndex;
break;
case OpToken.SLICE:
if(!dryRun) {
size_t tag = indexTag[$-1];
outBuffer[tag..tag+8] = ".opSlice";
}
fill(",");
break;
}
}
}
// translate the expression and also consume the semicolon thereafter
void procExprStmt() {
fill(" _esdl__block ~= new CstPredicate(" ~ _solver ~ ", ");
if(ifConds.length !is 0) {
fill("// Conditions \n ( ");
foreach(ifCond; ifConds[0..$-1]) {
if(ifCond.isInverse()) fill("*");
fill(ifCond.cond);
fill(" &\n ");
}
if(ifConds[$-1].isInverse()) fill("*");
fill(ifConds[$-1].cond);
fill(").implies( // End of Conditions\n");
fill(" ( ");
procExpr();
fill(")");
}
else {
procExpr();
}
if(numParen !is 0) {
import std.conv: to;
assert(false, "Unbalanced parenthesis on line: " ~
srcLine.to!string);
}
auto srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
if(CST[srcCursor++] !is ';') {
assert(false, "Error: -- ';' missing at end of statement; at " ~
srcCursor.to!string);
}
if(ifConds.length !is 0) {
fill(")");
}
// no parent CstPredicate
fill(", null");
if (iterators.length != 0) {
foreach (iterator; iterators) {
fill(", " ~ iterator);
}
}
fill(");\n");
}
void procStmt() {
import std.conv: to;
size_t srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
StmtToken stmtToken = nextStmtToken();
final switch(stmtToken) {
case StmtToken.FOREACH:
procForeachBlock();
return;
case StmtToken.IFCOND:
procIfBlock();
return;
case StmtToken.BEFORE:
procBeforeStmt();
return;
case StmtToken.ERROR:
assert(false, "Unidentified symbol in constraints at: " ~
srcCursor.to!string);
case StmtToken.BLOCK:
assert(false, "Unidentified symbol in constraints");
case StmtToken.ENDBLOCK:
case StmtToken.ENDCST:
assert(false, "Unexpeceted end of constraint block");
case StmtToken.STMT:
procExprStmt();
}
}
void procBlock() {
while(srcCursor <= CST.length) {
size_t srcTag = parseSpace();
fill(CST[srcTag..srcCursor]);
StmtToken stmtToken = nextStmtToken();
switch(stmtToken) {
case StmtToken.ENDCST:
fill(" // END OF CONSTRAINT BLOCK \n");
return;
case StmtToken.ENDBLOCK:
fill(" // END OF BLOCK \n");
srcCursor++; // skip the end of block brace '}'
return;
default:
procStmt();
}
}
}
unittest {
// assert(translate("FOO;"));
// assert(translate("FOO > BAR;"));
// assert(translate("FOO > BAR || FOO == BAR;"));
// 012345678901234567890123456789012345678901234567890123456789
assert(translate("_num_seq <= 2 || seq_kind1 >= 2 ; seq_kind2 < _num_seq || seq_kind3 == 0;
"));
}
}
| D |
// PERMUTE_ARGS:
// REQUIRED_ARGS: -dip1000 -o- -X -Xf${RESULTS_DIR}/compilable/json.out
// POST_SCRIPT: compilable/extra-files/json-postscript.sh
module json;
static this() {}
static ~this() {}
alias int myInt;
myInt x; // bug 3404
struct Foo(T) { T t; }
class Bar(int T) { int t = T; }
interface Baz(T...) { T[0] t() const; } // bug 3466
template P(alias T) {}
class Bar2 : Bar!1, Baz!(int, 2, null) {
this() {}
~this() {} // bug 4178
static foo() {}
protected abstract Foo!int baz();
override int t() const { return 0; }
}
class Bar3 : Bar2 {
private int val;
this(int i) { val = i; }
protected override Foo!int baz() { return Foo!int(val); }
}
struct Foo2 {
Bar2 bar2;
union U {
struct {
short s;
int i;
}
Object o;
}
}
struct Foo3(bool b) {
version(D_Ddoc) {
/// Doc 1
void method1();
}
static if (b) {
/// Doc 2
void method2();
} else {
/// Doc 3
void method3();
}
/// Doc 4
void method4();
}
/++
+ Documentation test
+/
@trusted myInt bar(ref uint blah, Bar2 foo = new Bar3(7)) // bug 4477
{
return -1;
}
@property int outer() nothrow
in {
assert(true);
}
out(result) {
assert(result == 18);
}
body {
int x = 8;
int inner(void* v) nothrow
{
int y = 2;
assert(true);
return x + y;
}
int z = inner(null);
return x + z;
}
/** Issue 9484 - selective and renamed imports */
import imports.jsonimport1 : target1, target2;
import imports.jsonimport2 : alias1 = target1, alias2 = target2;
import imports.jsonimport3 : alias3 = target1, alias4 = target2, target3;
import imports.jsonimport4;
struct S
{
/** Issue 9480 - Template name should be stripped of parameters */
this(T)(T t) { }
}
/** Issue 9755 - Protection not emitted properly for Templates. */
private struct S1_9755(T) { }
package struct S2_9755(T) { }
class C_9755
{
protected static class CI_9755(T) { }
}
/** Issue 10011 - init property is wrong for object initializer. */
const Object c_10011 = new Object();
///
enum Numbers
{
unspecified1,
one = 2,
two = 3,
FILE_NOT_FOUND = 101,
unspecified3,
unspecified4,
four = 4,
}
template IncludeConstraint(T) if (T == string) {}
static foreach(enum i; 0..3)
{
mixin("int a" ~ i.stringof ~ " = 1;");
}
alias Seq(T...) = T;
static foreach(int i, alias a; Seq!(a0, a1, a2))
{
mixin("alias b" ~ i.stringof ~ " = a;");
}
// return ref, return scope, return ref scope
ref int foo(return ref int a) @safe
{
return a;
}
int* foo(return scope int* a) @safe
{
return a;
}
ref int* foo(scope return ref int* a) @safe
{
return a;
}
struct SafeS
{
@safe:
ref SafeS foo() return
{
return this;
}
SafeS foo2() return scope
{
return this;
}
ref SafeS foo3() return scope
{
return this;
}
int* p;
}
extern int vlinkageDefault;
extern(D) int vlinkageD;
extern(C) int vlinakgeC;
extern(C++) __gshared int vlinkageCpp;
extern(Windows) int vlinkageWindows;
extern(Pascal) int vlinkagePascal;
extern(Objective-C) int vlinkageObjc;
extern int flinkageDefault();
extern(D) int flinkageD();
extern(C) int linakgeC();
extern(C++) int flinkageCpp();
extern(Windows) int flinkageWindows();
extern(Pascal) int flinkagePascal();
extern(Objective-C) int flinkageObjc();
| D |
/*
TEST_OUTPUT:
---
fail_compilation/diag8318.d(13): Error: function `diag8318.Bar8318.foo` return type inference is not supported if may override base class function
---
*/
class Foo8318
{
auto foo() { return "Foo.foo"; }
}
class Bar8318 : Foo8318
{
override auto foo() { return "Bar.foo"; }
}
/*
TEST_OUTPUT:
---
fail_compilation/diag8318.d(24): Error: function `diag8318.C10021.makeI` return type inference is not supported if may override base class function
---
*/
interface I10021 { I10021 makeI(); }
class D10021 : I10021 { D10021 makeI() { return this; } }
class C10021 : I10021 { auto makeI() { return this; } }
/*
TEST_OUTPUT:
---
fail_compilation/diag8318.d(38): Error: function `diag8318.Bar10195.baz` return type inference is not supported if may override base class function
---
*/
interface Foo10195
{
int baz();
}
class Bar10195 : Foo10195
{
override auto baz() { return 1; }
}
/*
TEST_OUTPUT:
---
fail_compilation/diag8318.d(50): Error: function `diag8318.B14173.foo` does not override any function
---
*/
class A14173 {}
class B14173 : A14173
{
override foo() {}
}
| D |
/*
* hunt-proton: AMQP Protocol library for D programming language.
*
* Copyright (C) 2018-2019 HuntLabs
*
* Website: https://www.huntlabs.net/
*
* Licensed under the Apache-2.0 License.
*
*/
module hunt.proton.engine.impl.ssl.SslEngineFacadeFactory;
//import java.io.Closeable;
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.FileReader;
//import java.io.IOException;
//import java.io.InputStream;
//import java.io.Reader;
//import java.lang.reflect.Constructor;
//import java.lang.reflect.InvocationTargetException;
//import java.lang.reflect.Method;
//import java.security.KeyManagementException;
//import java.security.KeyPair;
//import java.security.KeyStore;
//import java.security.KeyStoreException;
//import java.security.NoSuchAlgorithmException;
//import java.security.PrivateKey;
//import java.security.Provider;
//import java.security.Security;
//import java.security.UnrecoverableKeyException;
//import java.security.cert.Certificate;
//import java.security.cert.CertificateException;
//import java.security.cert.CertificateFactory;
//import java.security.cert.X509Certificate;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collection;
//import java.util.List;
//import java.util.logging.Level;
//import java.util.logging.Logger;
//
//import javax.net.ssl.KeyManagerFactory;
//import javax.net.ssl.SSLContext;
//import javax.net.ssl.SSLEngine;
//import javax.net.ssl.SSLParameters;
//import javax.net.ssl.TrustManager;
//import javax.net.ssl.TrustManagerFactory;
//import javax.net.ssl.X509TrustManager;
//
//import hunt.proton.engine.SslDomain;
//import hunt.proton.engine.SslPeerDetails;
//import hunt.proton.engine.TransportException;
//
//class SslEngineFacadeFactory
//{
// private static Logger _logger = Logger.getLogger(SslEngineFacadeFactory.class.getName());
//
// /**
// * The protocol name used to create an {@link SSLContext}, taken from Java's list of
// * standard names at http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html
// *
// * TODO allow the protocol name to be overridden somehow
// */
// private static String TLS_PROTOCOL = "TLS";
//
// // BouncyCastle Reflection Helpers
// private static Constructor<?> pemParserCons;
// private static Method pemReadMethod;
//
// private static Constructor<?> JcaPEMKeyConverterCons;
// private static Class<?> PEMKeyPairClass;
// private static Method getKeyPairMethod;
// private static Method getPrivateKeyMethod;
//
// private static Class<?> PEMEncryptedKeyPairClass;
// private static Method decryptKeyPairMethod;
//
// private static Constructor<?> JcePEMDecryptorProviderBuilderCons;
// private static Method builderMethod;
//
// private static Class<?> PrivateKeyInfoClass;
// private static Exception bouncyCastleSetupException;
//
// static
// {
// // Setup BouncyCastle Reflection artifacts
// Constructor<?> pemParserConsResult = null;
// Method pemReadMethodResult = null;
// Constructor<?> JcaPEMKeyConverterConsResult = null;
// Class<?> PEMKeyPairClassResult = null;
// Method getKeyPairMethodResult = null;
// Method getPrivateKeyMethodResult = null;
// Class<?> PEMEncryptedKeyPairClassResult = null;
// Method decryptKeyPairMethodResult = null;
// Constructor<?> JcePEMDecryptorProviderBuilderConsResult = null;
// Method builderMethodResult = null;
// Class<?> PrivateKeyInfoClassResult = null;
// Exception bouncyCastleSetupExceptionResult = null;
//
// try
// {
// Class<?> pemParserClass = Class.forName("org.bouncycastle.openssl.PEMParser");
// pemParserConsResult = pemParserClass.getConstructor(Reader.class);
// pemReadMethodResult = pemParserClass.getMethod("readObject");
//
// Class<?> jcaPEMKeyConverterClass = Class.forName("org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter");
// JcaPEMKeyConverterConsResult = jcaPEMKeyConverterClass.getConstructor();
// PEMKeyPairClassResult = Class.forName("org.bouncycastle.openssl.PEMKeyPair");
// getKeyPairMethodResult = jcaPEMKeyConverterClass.getMethod("getKeyPair", PEMKeyPairClassResult);
//
// Class<?> PEMDecrypterProvider = Class.forName("org.bouncycastle.openssl.PEMDecryptorProvider");
//
// PEMEncryptedKeyPairClassResult = Class.forName("org.bouncycastle.openssl.PEMEncryptedKeyPair");
// decryptKeyPairMethodResult = PEMEncryptedKeyPairClassResult.getMethod("decryptKeyPair", PEMDecrypterProvider);
//
// Class<?> jcePEMDecryptorProviderBuilderClass = Class.forName(
// "org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder");
// JcePEMDecryptorProviderBuilderConsResult = jcePEMDecryptorProviderBuilderClass.getConstructor();
// builderMethodResult = jcePEMDecryptorProviderBuilderClass.getMethod("build", char[].class);
//
// PrivateKeyInfoClassResult = Class.forName("org.bouncycastle.asn1.pkcs.PrivateKeyInfo");
// getPrivateKeyMethodResult = jcaPEMKeyConverterClass.getMethod("getPrivateKey", PrivateKeyInfoClassResult);
//
// registerBouncyCastleProvider();
// }
// catch (Exception e)
// {
// bouncyCastleSetupExceptionResult = e;
// }
// finally {
// pemParserCons = pemParserConsResult;
// pemReadMethod = pemReadMethodResult;
// JcaPEMKeyConverterCons = JcaPEMKeyConverterConsResult;
// PEMKeyPairClass = PEMKeyPairClassResult;
// getKeyPairMethod = getKeyPairMethodResult;
// getPrivateKeyMethod = getPrivateKeyMethodResult;
// PEMEncryptedKeyPairClass = PEMEncryptedKeyPairClassResult;
// decryptKeyPairMethod = decryptKeyPairMethodResult;
// JcePEMDecryptorProviderBuilderCons = JcePEMDecryptorProviderBuilderConsResult;
// builderMethod = builderMethodResult;
// PrivateKeyInfoClass = PrivateKeyInfoClassResult;
// bouncyCastleSetupException = bouncyCastleSetupExceptionResult;
// }
// }
//
// static void registerBouncyCastleProvider()
// throws ClassNotFoundException, InstantiationException, IllegalAccessException,
// InvocationTargetException, NoSuchMethodException
// {
// // Try loading BC as a provider
// Class<?> klass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
//
// Provider bouncyCastleProvider = (Provider) klass.getConstructor().newInstance();
// synchronized (Security.class)
// {
// if(Security.getProvider(bouncyCastleProvider.getName()) is null)
// {
// Security.addProvider(bouncyCastleProvider);
// }
// }
// }
//
// SslEngineFacadeFactory()
// {
// }
//
// /**
// * This is a list of all anonymous cipher suites supported by Java 6, excluding those that
// * use MD5. These are all supported by both Oracle's and IBM's Java 6 implementation.
// */
// private static List<String> ANONYMOUS_CIPHER_SUITES = Arrays.asList(
// "TLS_DH_anon_WITH_AES_128_CBC_SHA",
// "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
// "SSL_DH_anon_WITH_DES_CBC_SHA",
// "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA");
//
// /** lazily initialized */
// private SSLContext _sslContext;
//
//
// /**
// * Returns a {@link ProtonSslEngine}. May cache the domain's settings so callers should invoke
// * {@link #resetCache()} if the domain changes.
// *
// * @param peerDetails may be used to return an engine that supports SSL resume.
// */
// public ProtonSslEngine createProtonSslEngine(SslDomain domain, SslPeerDetails peerDetails)
// {
// SSLEngine engine = createAndInitialiseSslEngine(domain, peerDetails);
// if(_logger.isLoggable(Level.FINE))
// {
// _logger.fine("Created SSL engine: " + engineToString(engine));
// }
// return new DefaultSslEngineFacade(engine);
// }
//
//
// /**
// * Guarantees that no cached settings are used in subsequent calls to
// * {@link #createProtonSslEngine(SslDomain, SslPeerDetails)}.
// */
// public void resetCache()
// {
// _sslContext = null;
// }
//
//
// private SSLEngine createAndInitialiseSslEngine(SslDomain domain, SslPeerDetails peerDetails)
// {
// SslDomain.Mode mode = domain.getMode();
//
// SSLContext sslContext = getOrCreateSslContext(domain);
// SSLEngine sslEngine = createSslEngine(sslContext, peerDetails);
//
// if (domain.getPeerAuthentication() == SslDomain.VerifyMode.ANONYMOUS_PEER)
// {
// addAnonymousCipherSuites(sslEngine);
// }
// else
// {
// if (mode == SslDomain.Mode.SERVER)
// {
// sslEngine.setNeedClientAuth(true);
// }
//
// if(domain.getPeerAuthentication() == SslDomain.VerifyMode.VERIFY_PEER_NAME)
// {
// SSLParameters sslParameters = sslEngine.getSSLParameters();
// sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
// sslEngine.setSSLParameters(sslParameters);
// }
// }
//
// if(_logger.isLoggable(Level.FINE))
// {
// _logger.log(Level.FINE, mode + " Enabled cipher suites " + Arrays.asList(sslEngine.getEnabledCipherSuites()));
// }
//
// boolean useClientMode = mode == SslDomain.Mode.CLIENT;
// sslEngine.setUseClientMode(useClientMode);
//
// removeSSLv3Support(sslEngine);
//
// return sslEngine;
// }
//
// private static String SSLV3_PROTOCOL = "SSLv3";
//
// private static void removeSSLv3Support(SSLEngine engine)
// {
// List<String> enabledProtocols = Arrays.asList(engine.getEnabledProtocols());
// if(enabledProtocols.contains(SSLV3_PROTOCOL))
// {
// List<String> allowedProtocols = new ArrayList<String>(enabledProtocols);
// allowedProtocols.remove(SSLV3_PROTOCOL);
// engine.setEnabledProtocols(allowedProtocols.toArray(new String[allowedProtocols.size()]));
// }
// }
//
// /**
// * @param sslPeerDetails is allowed to be null. A non-null value is used to hint that SSL resumption
// * should be attempted
// */
// private SSLEngine createSslEngine(SSLContext sslContext, SslPeerDetails sslPeerDetails)
// {
// SSLEngine sslEngine;
// if(sslPeerDetails is null)
// {
// sslEngine = sslContext.createSSLEngine();
// }
// else
// {
// sslEngine = sslContext.createSSLEngine(sslPeerDetails.getHostname(), sslPeerDetails.getPort());
// }
// return sslEngine;
// }
//
// private SSLContext getOrCreateSslContext(SslDomain sslDomain)
// {
// if(_sslContext is null && sslDomain.getSslContext() !is null)
// {
// _sslContext = sslDomain.getSslContext();
// }
// else if(_sslContext is null)
// {
// if(_logger.isLoggable(Level.FINE))
// {
// _logger.fine("lazily creating new SSLContext using domain " + sslDomain);
// }
//
// char[] dummyPassword = "unused-passphrase".toCharArray(); // Dummy password required by KeyStore and KeyManagerFactory, but never referred to again
//
// try
// {
// SSLContext sslContext = SSLContext.getInstance(TLS_PROTOCOL);
// KeyStore ksKeys = createKeyStoreFrom(sslDomain, dummyPassword);
//
// KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
// kmf.init(ksKeys, dummyPassword);
//
// TrustManager[] trustManagers;
// if (sslDomain.getPeerAuthentication() == SslDomain.VerifyMode.ANONYMOUS_PEER)
// {
// trustManagers = new TrustManager[] { new AlwaysTrustingTrustManager() };
// }
// else
// {
// TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
// tmf.init(ksKeys);
// trustManagers = tmf.getTrustManagers();
// }
//
// sslContext.init(kmf.getKeyManagers(), trustManagers, null);
// _sslContext = sslContext;
// }
// catch (NoSuchAlgorithmException e)
// {
// throw new TransportException("Unexpected exception creating SSLContext", e);
// }
// catch (KeyStoreException e)
// {
// throw new TransportException("Unexpected exception creating SSLContext", e);
// }
// catch (UnrecoverableKeyException e)
// {
// throw new TransportException("Unexpected exception creating SSLContext", e);
// }
// catch (KeyManagementException e)
// {
// throw new TransportException("Unexpected exception creating SSLContext", e);
// }
// }
// return _sslContext;
// }
//
// private KeyStore createKeyStoreFrom(SslDomain sslDomain, char[] dummyPassword)
// {
// try
// {
// KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
// keystore.load(null, null);
//
// if (sslDomain.getTrustedCaDb() !is null)
// {
// String caCertAlias = "cacert";
//
// if(_logger.isLoggable(Level.FINE))
// {
// _logger.log(Level.FINE, "_sslParams.getTrustedCaDb() : " + sslDomain.getTrustedCaDb());
// }
// int i = 1;
// for(Certificate trustedCaCert : readCertificates(sslDomain.getTrustedCaDb()))
// {
// keystore.setCertificateEntry(caCertAlias + (i++), trustedCaCert);
// }
// }
//
// if (sslDomain.getCertificateFile() !is null
// && sslDomain.getPrivateKeyFile() !is null)
// {
// String clientPrivateKeyAlias = "clientPrivateKey";
//
// Certificate clientCertificate = (Certificate) readCertificate(sslDomain.getCertificateFile());
// PrivateKey clientPrivateKey = readPrivateKey(sslDomain.getPrivateKeyFile(), sslDomain.getPrivateKeyPassword());
//
// keystore.setKeyEntry(clientPrivateKeyAlias, clientPrivateKey,
// dummyPassword, new Certificate[] { clientCertificate });
// }
//
// return keystore;
// }
// catch (KeyStoreException e)
// {
// throw new TransportException("Unexpected exception creating keystore", e);
// }
// catch (NoSuchAlgorithmException e)
// {
// throw new TransportException("Unexpected exception creating keystore", e);
// }
// catch (CertificateException e)
// {
// throw new TransportException("Unexpected exception creating keystore", e);
// }
// catch (IOException e)
// {
// throw new TransportException("Unexpected exception creating keystore", e);
// }
// }
//
// private void addAnonymousCipherSuites(SSLEngine sslEngine)
// {
// List<String> supportedSuites = Arrays.asList(sslEngine.getSupportedCipherSuites());
// List<String> currentEnabledSuites = Arrays.asList(sslEngine.getEnabledCipherSuites());
//
// List<String> enabledSuites = buildEnabledSuitesIncludingAnonymous(ANONYMOUS_CIPHER_SUITES, supportedSuites, currentEnabledSuites);
// sslEngine.setEnabledCipherSuites(enabledSuites.toArray(new String[0]));
// }
//
// private List<String> buildEnabledSuitesIncludingAnonymous(
// List<String> anonymousCipherSuites, List<String> supportedSuites, List<String> currentEnabled)
// {
// List<String> newEnabled = new ArrayList<String>(currentEnabled);
//
// int addedAnonymousCipherSuites = 0;
// for (String anonymousCipherSuiteName : anonymousCipherSuites)
// {
// if (supportedSuites.contains(anonymousCipherSuiteName))
// {
// newEnabled.add(anonymousCipherSuiteName);
// addedAnonymousCipherSuites++;
// }
// }
//
// if (addedAnonymousCipherSuites > 0 && _logger.isLoggable(Level.FINE))
// {
// _logger.fine("There are now " + newEnabled.size()
// + " cipher suites enabled (previously " + currentEnabled.size()
// + "), including " + addedAnonymousCipherSuites + " out of the "
// + anonymousCipherSuites.size() + " requested anonymous ones." );
// }
//
// return newEnabled;
// }
//
// private String engineToString(SSLEngine engine)
// {
// return new StringBuilder("[ " )
// .append(engine)
// .append(", needClientAuth=").append(engine.getNeedClientAuth())
// .append(", useClientMode=").append(engine.getUseClientMode())
// .append(", peerHost=").append(engine.getPeerHost())
// .append(", peerPort=").append(engine.getPeerPort())
// .append(" ]").toString();
// }
//
// Certificate readCertificate(String pemFile)
// {
// InputStream is = null;
//
// try
// {
// CertificateFactory cFactory = CertificateFactory.getInstance("X.509");
// is = new FileInputStream(pemFile);
// return cFactory.generateCertificate(is);
// }
// catch (CertificateException ce)
// {
// String msg = "Failed to load certificate [" + pemFile + "]";
// _logger.log(Level.SEVERE, msg, ce);
// throw new TransportException(msg, ce);
// }
// catch (FileNotFoundException e)
// {
// String msg = "Certificate file not found [" + pemFile + "]";
// _logger.log(Level.SEVERE, msg);
// throw new TransportException(msg, e);
// }
// finally
// {
// closeSafely(is);
// }
// }
//
// Collection<? extends Certificate> readCertificates(String pemFile)
// {
// InputStream is = null;
//
// try
// {
// CertificateFactory cFactory = CertificateFactory.getInstance("X.509");
// is = new FileInputStream(pemFile);
// return cFactory.generateCertificates(is);
// }
// catch (CertificateException ce)
// {
// String msg = "Failed to load certificates [" + pemFile + "]";
// _logger.log(Level.SEVERE, msg, ce);
// throw new TransportException(msg, ce);
// }
// catch (FileNotFoundException e)
// {
// String msg = "Certificates file not found [" + pemFile + "]";
// _logger.log(Level.SEVERE, msg);
// throw new TransportException(msg, e);
// }
// finally
// {
// closeSafely(is);
// }
// }
//
//
// PrivateKey readPrivateKey(String pemFile, String password)
// {
// if (bouncyCastleSetupException !is null)
// {
// throw new TransportException("BouncyCastle failed to load", bouncyCastleSetupException);
// }
//
// Object pemObject = readPemObject(pemFile);
// PrivateKey privateKey = null;
//
// try
// {
// Object keyConverter = JcaPEMKeyConverterCons.newInstance();
// setProvider(keyConverter, "BC");
//
// if (PEMEncryptedKeyPairClass.isInstance(pemObject))
// {
// Object decryptorBuilder = JcePEMDecryptorProviderBuilderCons.newInstance();
//
// // Build a PEMDecryptProvider
// Object decryptProvider = builderMethod.invoke(decryptorBuilder, password.toCharArray());
//
// Object decryptedKeyPair = decryptKeyPairMethod.invoke(pemObject, decryptProvider);
// KeyPair keyPair = (KeyPair) getKeyPairMethod.invoke(keyConverter, decryptedKeyPair);
//
// privateKey = keyPair.getPrivate();
// }
// else if (PEMKeyPairClass.isInstance(pemObject))
// {
// // It's a KeyPair but not encrypted.
// KeyPair keyPair = (KeyPair) getKeyPairMethod.invoke(keyConverter, pemObject);
// privateKey = keyPair.getPrivate();
// }
// else if (PrivateKeyInfoClass.isInstance(pemObject))
// {
// // It's an unencrypted private key
// privateKey = (PrivateKey) getPrivateKeyMethod.invoke(keyConverter, pemObject);
// }
// else
// {
// String msg = "Unable to load PrivateKey, Unpexected Object [" + pemObject.getClass().getName()
// + "]";
// _logger.log(Level.SEVERE, msg);
// throw new TransportException(msg);
// }
// }
// catch (InstantiationException | IllegalAccessException | IllegalArgumentException
// | InvocationTargetException | NoSuchMethodException | SecurityException e)
// {
// String msg = "Failed to process key file [" + pemFile + "] - " + e.getMessage();
// throw new TransportException(msg, e);
// }
//
// return privateKey;
// }
//
// private Object readPemObject(String pemFile)
// {
// Reader reader = null;
// Object pemParser = null;
// Object pemObject = null;
//
// try
// {
// reader = new FileReader(pemFile);
// pemParser = pemParserCons.newInstance(reader); // = new PEMParser(reader);
// pemObject = pemReadMethod.invoke(pemParser); // = pemParser.readObject();
// }
// catch (IOException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e)
// {
// _logger.log(Level.SEVERE, "Unable to read PEM object. Perhaps you need the unlimited strength libraries in <java-home>/jre/lib/security/ ?", e);
// throw new TransportException("Unable to read PEM object from file " + pemFile, e);
// }
// finally
// {
// closeSafely(reader);
// }
//
// return pemObject;
// }
//
// private void setProvider(Object obj, String provider) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
// {
// Class<?> aClz = obj.getClass();
// Method setProvider = aClz.getMethod("setProvider", String.class);
// setProvider.invoke(obj, provider);
// }
//
// private void closeSafely(Closeable c)
// {
// if (c !is null)
// {
// try
// {
// c.close();
// }
// catch (IOException e)
// {
// // Swallow
// }
// }
// }
//
// private static class AlwaysTrustingTrustManager implements X509TrustManager
// {
// @Override
// public X509Certificate[] getAcceptedIssuers()
// {
// return null;
// }
//
// @Override
// public void checkServerTrusted(X509Certificate[] arg0, String arg1)
// throws CertificateException
// {
// // Do not check certificate
// }
//
// @Override
// public void checkClientTrusted(X509Certificate[] arg0, String arg1)
// throws CertificateException
// {
// // Do not check certificate
// }
// }
//}
| D |
PLONG PLAT ED95 KD LOMAGAGE HIMAGAGE SLAT SLONG RESULTNO DP DM WT ROCKTYPE
21.8999996 87.1999969 3.5 52 0 4 -37 143.399994 9069 4.4000001 4.4000001 0.966731536 extrusives, basalts
22.5 87 27.2999992 85.5 16 23 -9.60000038 119.400002 7801 14.8999996 28.5 0.477272727 extrusives, basalts
213.300003 85.5 9.89999962 22.3999996 16 23 -9.60000038 119.400002 7788 5.4000001 10.3000002 0.900673401 extrusives, andesites, dacites
52 88 1.89999998 323 0 1 -38 140.699997 1147 2 2.79999995 0.472222222 extrusives, basalts, baked contacts
216 82 1.60000002 999.900024 0 1 -38 140.699997 1148 1.60000002 2.29999995 0.4375 extrusives, basalts
244.5 81.6999969 9.80000019 0 2 10 -9.60000038 119.300003 1209 5.80000019 10.6999998 0.606060606 extrusives
51 49 12 0 4 6 -9.30000019 124.300003 1207 6.0999999 12.1000004 0.475 extrusives, pillow basalts, intrusives
282.100006 86.3000031 4.80000019 37 0 5 -38 143.5 1818 5.5 7.19999981 0.961 extrusives
266.299988 86.5999985 1.5 82 0 5 -38.5 143.5 1897 1.89999998 1.89999998 0.970905525 extrusives
264.299988 78.5 3.70000005 43.0999985 17 19 -30.2999992 150.199997 1890 4.5 4.5 0.956314879 extrusives
56 83 6 56 0 5 -38 143.5 1859 8 8 0.8815427 extrusives
246 79.4000015 0 0 15 20 -32 150 1924 4.19999981 4.19999981 0.973812344 extrusives, basalts
| D |
/*
* [The "BSD license"]
* Copyright (c) 2016 Terence Parr
* Copyright (c) 2016 Sam Harwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module antlr.v4.runtime.atn.RangeTransition;
import std.conv;
import antlr.v4.runtime.atn.Transition;
import antlr.v4.runtime.atn.TransitionStates;
import antlr.v4.runtime.atn.ATNState;
import antlr.v4.runtime.misc.IntervalSet;
alias tostring = to!string;
/**
* TODO add class description
*/
class RangeTransition : Transition
{
public int from;
public int to;
public this(ATNState target, int from, int to)
{
super(target);
this.from = from;
this.to = to;
}
/**
* @uml
* @override
*/
public override int getSerializationType()
{
return TransitionStates.RANGE;
}
/**
* @uml
* @override
*/
public override IntervalSet label()
{
return IntervalSet.of(from, to);
}
/**
* @uml
* @override
*/
public override bool matches(int symbol, int minVocabSymbol, int maxVocabSymbol)
{
return symbol >= from && symbol <= to;
}
/**
* @uml
* @override
*/
public override string toString()
{
return "'" ~ tostring(from) ~ "'..'" ~ tostring(to) ~ "'";
}
}
| D |
/* crypto/pem/pem.h */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
module deimos.openssl.pem;
import deimos.openssl._d_util;
import deimos.openssl.pkcs7; // Needed for PKCS7.
public import deimos.openssl.e_os2;
version(OPENSSL_NO_BIO) {} else {
public import deimos.openssl.bio;
}
version(OPENSSL_NO_STACK) {} else {
public import deimos.openssl.stack;
}
public import deimos.openssl.evp;
public import deimos.openssl.x509;
public import deimos.openssl.pem2;
extern (C):
nothrow:
enum PEM_BUFSIZE = 1024;
enum PEM_OBJ_UNDEF = 0;
enum PEM_OBJ_X509 = 1;
enum PEM_OBJ_X509_REQ = 2;
enum PEM_OBJ_CRL = 3;
enum PEM_OBJ_SSL_SESSION = 4;
enum PEM_OBJ_PRIV_KEY = 10;
enum PEM_OBJ_PRIV_RSA = 11;
enum PEM_OBJ_PRIV_DSA = 12;
enum PEM_OBJ_PRIV_DH = 13;
enum PEM_OBJ_PUB_RSA = 14;
enum PEM_OBJ_PUB_DSA = 15;
enum PEM_OBJ_PUB_DH = 16;
enum PEM_OBJ_DHPARAMS = 17;
enum PEM_OBJ_DSAPARAMS = 18;
enum PEM_OBJ_PRIV_RSA_PUBLIC = 19;
enum PEM_OBJ_PRIV_ECDSA = 20;
enum PEM_OBJ_PUB_ECDSA = 21;
enum PEM_OBJ_ECPARAMETERS = 22;
enum PEM_ERROR = 30;
enum PEM_DEK_DES_CBC = 40;
enum PEM_DEK_IDEA_CBC = 45;
enum PEM_DEK_DES_EDE = 50;
enum PEM_DEK_DES_ECB = 60;
enum PEM_DEK_RSA = 70;
enum PEM_DEK_RSA_MD2 = 80;
enum PEM_DEK_RSA_MD5 = 90;
alias NID_md2 PEM_MD_MD2;
alias NID_md5 PEM_MD_MD5;
alias NID_sha PEM_MD_SHA;
alias NID_md2WithRSAEncryption PEM_MD_MD2_RSA;
alias NID_md5WithRSAEncryption PEM_MD_MD5_RSA;
alias NID_sha1WithRSAEncryption PEM_MD_SHA_RSA;
enum PEM_STRING_X509_OLD = "X509 CERTIFICATE";
enum PEM_STRING_X509 = "CERTIFICATE";
enum PEM_STRING_X509_PAIR = "CERTIFICATE PAIR";
enum PEM_STRING_X509_TRUSTED = "TRUSTED CERTIFICATE";
enum PEM_STRING_X509_REQ_OLD = "NEW CERTIFICATE REQUEST";
enum PEM_STRING_X509_REQ = "CERTIFICATE REQUEST";
enum PEM_STRING_X509_CRL = "X509 CRL";
enum PEM_STRING_EVP_PKEY = "ANY PRIVATE KEY";
enum PEM_STRING_PUBLIC = "PUBLIC KEY";
enum PEM_STRING_RSA = "RSA PRIVATE KEY";
enum PEM_STRING_RSA_PUBLIC = "RSA PUBLIC KEY";
enum PEM_STRING_DSA = "DSA PRIVATE KEY";
enum PEM_STRING_DSA_PUBLIC = "DSA PUBLIC KEY";
enum PEM_STRING_PKCS7 = "PKCS7";
enum PEM_STRING_PKCS7_SIGNED = "PKCS #7 SIGNED DATA";
enum PEM_STRING_PKCS8 = "ENCRYPTED PRIVATE KEY";
enum PEM_STRING_PKCS8INF = "PRIVATE KEY";
enum PEM_STRING_DHPARAMS = "DH PARAMETERS";
enum PEM_STRING_SSL_SESSION = "SSL SESSION PARAMETERS";
enum PEM_STRING_DSAPARAMS = "DSA PARAMETERS";
enum PEM_STRING_ECDSA_PUBLIC = "ECDSA PUBLIC KEY";
enum PEM_STRING_ECPARAMETERS = "EC PARAMETERS";
enum PEM_STRING_ECPRIVATEKEY = "EC PRIVATE KEY";
enum PEM_STRING_PARAMETERS = "PARAMETERS";
enum PEM_STRING_CMS = "CMS";
/* Note that this structure is initialised by PEM_SealInit and cleaned up
by PEM_SealFinal (at least for now) */
struct PEM_Encode_Seal_st {
EVP_ENCODE_CTX encode;
EVP_MD_CTX md;
EVP_CIPHER_CTX cipher;
}
alias PEM_Encode_Seal_st PEM_ENCODE_SEAL_CTX;
/* enc_type is one off */
enum PEM_TYPE_ENCRYPTED = 10;
enum PEM_TYPE_MIC_ONLY = 20;
enum PEM_TYPE_MIC_CLEAR = 30;
enum PEM_TYPE_CLEAR = 40;
struct pem_recip_st {
char* name;
X509_NAME* dn;
int cipher;
int key_enc;
/* char iv[8]; unused and wrong size */
}
alias pem_recip_st PEM_USER;
struct pem_ctx_st
{
int type; /* what type of object */
struct proc_type_ {
int version_;
int mode;
}
proc_type_ proc_type;
char* domain;
struct DEK_info_{
int cipher;
/* unused, and wrong size
ubyte[8] iv; */
}
DEK_info_ DEK_info;
PEM_USER* originator;
int num_recipient;
PEM_USER** recipient;
/* XXX(ben): don#t think this is used!
STACK* x509_chain; / * certificate chain */
EVP_MD* md; /* signature type */
int md_enc; /* is the md encrypted or not? */
int md_len; /* length of md_data */
char* md_data; /* message digest, could be pkey encrypted */
EVP_CIPHER* dec; /* date encryption cipher */
int key_len; /* key length */
ubyte* key; /* key */
/* unused, and wrong size
ubyte[8] iv; */
int data_enc; /* is the data encrypted */
int data_len;
ubyte* data;
}
alias pem_ctx_st PEM_CTX;
/* These macros make the PEM_read/PEM_write functions easier to maintain and
* write. Now they are all implemented with either:
* IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)
*/
/+#ifdef OPENSSL_NO_FP_API
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/
#else
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
type* PEM_read_##name(FILE* fp, type** x, pem_password_cb* cb, void* u)\
{ \
return PEM_ASN1_read((d2i_of_void*)d2i_##asn1, str,fp,(void**)x,cb,u); \
}
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
int PEM_write_##name(FILE* fp, type* x) \
{ \
return PEM_ASN1_write((i2d_of_void*)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \
}
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
int PEM_write_##name(FILE* fp, const(type)* x) \
{ \
return PEM_ASN1_write((i2d_of_void*)i2d_##asn1,str,fp,(void*)x,NULL,NULL,0,NULL,NULL); \
}
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
int PEM_write_##name(FILE* fp, type* x, const(EVP_CIPHER)* enc, \
ubyte* kstr, int klen, pem_password_cb* cb, \
void* u) \
{ \
return PEM_ASN1_write((i2d_of_void*)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
}
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
int PEM_write_##name(FILE* fp, type* x, const(EVP_CIPHER)* enc, \
ubyte* kstr, int klen, pem_password_cb* cb, \
void* u) \
{ \
return PEM_ASN1_write((i2d_of_void*)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
}
#endif
#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
type* PEM_read_bio_##name(BIO* bp, type** x, pem_password_cb* cb, void* u)\
{ \
return PEM_ASN1_read_bio((d2i_of_void*)d2i_##asn1, str,bp,(void**)x,cb,u); \
}
#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
int PEM_write_bio_##name(BIO* bp, type* x) \
{ \
return PEM_ASN1_write_bio((i2d_of_void*)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \
}
#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
int PEM_write_bio_##name(BIO* bp, const(type)* x) \
{ \
return PEM_ASN1_write_bio((i2d_of_void*)i2d_##asn1,str,bp,(void*)x,NULL,NULL,0,NULL,NULL); \
}
#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
int PEM_write_bio_##name(BIO* bp, type* x, const(EVP_CIPHER)* enc, \
ubyte* kstr, int klen, pem_password_cb* cb, void* u) \
{ \
return PEM_ASN1_write_bio((i2d_of_void*)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \
}
#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
int PEM_write_bio_##name(BIO* bp, type* x, const(EVP_CIPHER)* enc, \
ubyte* kstr, int klen, pem_password_cb* cb, void* u) \
{ \
return PEM_ASN1_write_bio((i2d_of_void*)i2d_##asn1,str,bp,(void*)x,enc,kstr,klen,cb,u); \
}
#define IMPLEMENT_PEM_write(name, type, str, asn1) \
IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
IMPLEMENT_PEM_write_fp(name, type, str, asn1)
#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
#define IMPLEMENT_PEM_read(name, type, str, asn1) \
IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
IMPLEMENT_PEM_read_fp(name, type, str, asn1)
#define IMPLEMENT_PEM_rw(name, type, str, asn1) \
IMPLEMENT_PEM_read(name, type, str, asn1) \
IMPLEMENT_PEM_write(name, type, str, asn1)
#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
IMPLEMENT_PEM_read(name, type, str, asn1) \
IMPLEMENT_PEM_write_const(name, type, str, asn1)
#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
IMPLEMENT_PEM_read(name, type, str, asn1) \
IMPLEMENT_PEM_write_cb(name, type, str, asn1)
+/
/* These are the same except they are for the declarations */
version (OPENSSL_NO_FP_API) {
string DECLARE_PEM_read_fp(string name, string type)() { return ""; }
string DECLARE_PEM_read_fp(string name, string type)() { return ""; }
string DECLARE_PEM_write_fp(string name, string type)() { return ""; }
string DECLARE_PEM_write_fp_const(string name, string type)() { return ""; }
string DECLARE_PEM_write_cb_fp(string name, string type)() { return ""; }
} else {
string DECLARE_PEM_read_fp(string name, string type)() {
return type ~ "* PEM_read_" ~ name ~ "(FILE* fp, " ~ type ~ "** x, pem_password_cb* cb, void* u);";
}
string DECLARE_PEM_write_fp(string name, string type)() {
return "int PEM_write_" ~ name ~ "(FILE* fp, " ~ type ~ "* x);";
}
string DECLARE_PEM_write_fp_const(string name, string type)() {
return "int PEM_write_" ~ name ~ "(FILE* fp, const(" ~ type ~ ")* x);";
}
string DECLARE_PEM_write_cb_fp(string name, string type)() {
return "int PEM_write_" ~ name ~ "(FILE* fp, " ~ type ~ "* x, const(EVP_CIPHER)* enc,
ubyte* kstr, int klen, pem_password_cb* cb, void* u);";
}
}
version (OPENSSL_NO_BIO) {
string DECLARE_PEM_read_bio(string name, string type)() { return ""; }
string DECLARE_PEM_write_bio(string name, string type)() { return ""; }
string DECLARE_PEM_write_bio_const(string name, string type)() { return ""; }
string DECLARE_PEM_write_cb_bio(string name, string type)() { return ""; }
} else {
string DECLARE_PEM_read_bio(string name, string type)() {
return type ~ "* PEM_read_bio_" ~ name ~ "(BIO* bp, " ~ type ~ "** x, pem_password_cb* cb, void* u);";
}
string DECLARE_PEM_write_bio(string name, string type)() {
return "int PEM_write_bio_" ~ name ~ "(BIO* bp, " ~ type ~ "* x);";
}
string DECLARE_PEM_write_bio_const(string name, string type)() {
return "int PEM_write_bio_" ~ name ~ "(BIO* bp, const(" ~ type ~ ")* x);";
}
string DECLARE_PEM_write_cb_bio(string name, string type)() {
return "int PEM_write_bio_" ~ name ~ "(BIO* bp, " ~ type ~ "* x, const(EVP_CIPHER)* enc,
ubyte* kstr, int klen, pem_password_cb* cb, void* u);";
}
}
string DECLARE_PEM_write(string name, string type)() {
return DECLARE_PEM_write_bio!(name, type)() ~ "\n" ~
DECLARE_PEM_write_fp!(name, type)();
}
string DECLARE_PEM_write_const(string name, string type)() {
return DECLARE_PEM_write_bio_const!(name, type)() ~ "\n" ~
DECLARE_PEM_write_fp_const!(name, type)();
}
string DECLARE_PEM_write_cb(string name, string type)() {
return DECLARE_PEM_write_cb_bio!(name, type)() ~ "\n" ~
DECLARE_PEM_write_cb_fp!(name, type)();
}
string DECLARE_PEM_read(string name, string type)() {
return DECLARE_PEM_read_bio!(name, type)() ~ "\n" ~
DECLARE_PEM_read_fp!(name, type)();
}
string DECLARE_PEM_rw(string name, string type)() {
return DECLARE_PEM_read!(name, type)() ~ "\n" ~
DECLARE_PEM_write!(name, type)();
}
string DECLARE_PEM_rw_const(string name, string type)() {
return DECLARE_PEM_read!(name, type)() ~ "\n" ~
DECLARE_PEM_write_const!(name, type)();
}
string DECLARE_PEM_rw_cb(string name, string type)() {
return DECLARE_PEM_read!(name, type)() ~ "\n" ~
DECLARE_PEM_write_cb!(name, type)();
}
version (all) {
/* "userdata": new with OpenSSL 0.9.4 */
alias typeof(*(ExternC!(int function(char* buf, int size, int rwflag, void* userdata))).init) pem_password_cb;
} else {
/* OpenSSL 0.9.3, 0.9.3a */
alias typeof(*(ExternC!(int function(char* buf, int size, int rwflag))).init) pem_password_cb;
}
int PEM_get_EVP_CIPHER_INFO(char* header, EVP_CIPHER_INFO* cipher);
int PEM_do_header (EVP_CIPHER_INFO* cipher, ubyte* data,c_long* len,
pem_password_cb* callback,void* u);
version(OPENSSL_NO_BIO) {} else {
int PEM_read_bio(BIO* bp, char** name, char** header,
ubyte** data,c_long* len);
int PEM_write_bio(BIO* bp,const(char)* name,char* hdr,ubyte* data,
c_long len);
int PEM_bytes_read_bio(ubyte** pdata, c_long* plen, char** pnm, const(char)* name, BIO* bp,
pem_password_cb* cb, void* u);
void* PEM_ASN1_read_bio(d2i_of_void* d2i, const(char)* name, BIO* bp,
void** x, pem_password_cb* cb, void* u);
int PEM_ASN1_write_bio(i2d_of_void* i2d, const(char)* name,BIO* bp, void* x,
const(EVP_CIPHER)* enc,ubyte* kstr,int klen,
pem_password_cb* cb, void* u);
STACK_OF!(X509_INFO) * PEM_X509_INFO_read_bio(BIO* bp, STACK_OF!(X509_INFO) *sk, pem_password_cb* cb, void* u);
int PEM_X509_INFO_write_bio(BIO* bp,X509_INFO* xi, EVP_CIPHER* enc,
ubyte* kstr, int klen, pem_password_cb* cd, void* u);
}
int PEM_read(FILE* fp, char** name, char** header,
ubyte** data,c_long* len);
int PEM_write(FILE* fp,char* name,char* hdr,ubyte* data,c_long len);
void* PEM_ASN1_read(d2i_of_void* d2i, const(char)* name, FILE* fp, void** x,
pem_password_cb* cb, void* u);
int PEM_ASN1_write(i2d_of_void* i2d,const(char)* name,FILE* fp,
void* x,const(EVP_CIPHER)* enc,ubyte* kstr,
int klen,pem_password_cb* callback, void* u);
STACK_OF!(X509_INFO) * PEM_X509_INFO_read(FILE* fp, STACK_OF!(X509_INFO) *sk,
pem_password_cb* cb, void* u);
int PEM_SealInit(PEM_ENCODE_SEAL_CTX* ctx, EVP_CIPHER* type,
EVP_MD* md_type, ubyte** ek, int* ekl,
ubyte* iv, EVP_PKEY** pubk, int npubk);
void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX* ctx, ubyte* out_, int* outl,
ubyte* in_, int inl);
int PEM_SealFinal(PEM_ENCODE_SEAL_CTX* ctx, ubyte* sig,int* sigl,
ubyte* out_, int* outl, EVP_PKEY* priv);
void PEM_SignInit(EVP_MD_CTX* ctx, EVP_MD* type);
void PEM_SignUpdate(EVP_MD_CTX* ctx,ubyte* d,uint cnt);
int PEM_SignFinal(EVP_MD_CTX* ctx, ubyte* sigret,
uint* siglen, EVP_PKEY* pkey);
int PEM_def_callback(char* buf, int num, int w, void* key);
void PEM_proc_type(char* buf, int type);
void PEM_dek_info(char* buf, const(char)* type, int len, char* str);
public import deimos.openssl.symhacks;
mixin(DECLARE_PEM_rw!("X509", "X509")());
mixin(DECLARE_PEM_rw!("X509_AUX", "X509")());
mixin(DECLARE_PEM_rw!("X509_CERT_PAIR", "X509_CERT_PAIR")());
mixin(DECLARE_PEM_rw!("X509_REQ", "X509_REQ")());
mixin(DECLARE_PEM_write!("X509_REQ_NEW", "X509_REQ")());
mixin(DECLARE_PEM_rw!("X509_CRL", "X509_CRL")());
mixin(DECLARE_PEM_rw!("PKCS7", "PKCS7")());
mixin(DECLARE_PEM_rw!("NETSCAPE_CERT_SEQUENCE", "NETSCAPE_CERT_SEQUENCE")());
mixin(DECLARE_PEM_rw!("PKCS8", "X509_SIG")());
mixin(DECLARE_PEM_rw!("PKCS8_PRIV_KEY_INFO", "PKCS8_PRIV_KEY_INFO")());
version(OPENSSL_NO_RSA) {} else {
mixin(DECLARE_PEM_rw_cb!("RSAPrivateKey", "RSA")());
mixin(DECLARE_PEM_rw_const!("RSAPublicKey", "RSA")());
mixin(DECLARE_PEM_rw!("RSA_PUBKEY", "RSA")());
}
version(OPENSSL_NO_DSA) {} else {
mixin(DECLARE_PEM_rw_cb!("DSAPrivateKey", "DSA")());
mixin(DECLARE_PEM_rw!("DSA_PUBKEY", "DSA")());
mixin(DECLARE_PEM_rw_const!("DSAparams", "DSA")());
}
version(OPENSSL_NO_EC) {} else {
mixin(DECLARE_PEM_rw_const!("ECPKParameters", "EC_GROUP")());
mixin(DECLARE_PEM_rw_cb!("ECPrivateKey", "EC_KEY")());
mixin(DECLARE_PEM_rw!("EC_PUBKEY", "EC_KEY")());
}
version(OPENSSL_NO_DH) {} else {
mixin(DECLARE_PEM_rw_const!("DHparams", "DH")());
}
mixin(DECLARE_PEM_rw_cb!("PrivateKey", "EVP_PKEY")());
mixin(DECLARE_PEM_rw!("PUBKEY", "EVP_PKEY")());
int PEM_write_bio_PKCS8PrivateKey_nid(BIO* bp, EVP_PKEY* x, int nid,
char* kstr, int klen,
pem_password_cb* cb, void* u);
int PEM_write_bio_PKCS8PrivateKey(BIO*, EVP_PKEY*, const(EVP_CIPHER)*,
char*, int, pem_password_cb*, void*);
int i2d_PKCS8PrivateKey_bio(BIO* bp, EVP_PKEY* x, const(EVP_CIPHER)* enc,
char* kstr, int klen,
pem_password_cb* cb, void* u);
int i2d_PKCS8PrivateKey_nid_bio(BIO* bp, EVP_PKEY* x, int nid,
char* kstr, int klen,
pem_password_cb* cb, void* u);
EVP_PKEY* d2i_PKCS8PrivateKey_bio(BIO* bp, EVP_PKEY** x, pem_password_cb* cb, void* u);
int i2d_PKCS8PrivateKey_fp(FILE* fp, EVP_PKEY* x, const(EVP_CIPHER)* enc,
char* kstr, int klen,
pem_password_cb* cb, void* u);
int i2d_PKCS8PrivateKey_nid_fp(FILE* fp, EVP_PKEY* x, int nid,
char* kstr, int klen,
pem_password_cb* cb, void* u);
int PEM_write_PKCS8PrivateKey_nid(FILE* fp, EVP_PKEY* x, int nid,
char* kstr, int klen,
pem_password_cb* cb, void* u);
EVP_PKEY* d2i_PKCS8PrivateKey_fp(FILE* fp, EVP_PKEY** x, pem_password_cb* cb, void* u);
int PEM_write_PKCS8PrivateKey(FILE* fp,EVP_PKEY* x,const(EVP_CIPHER)* enc,
char* kstr,int klen, pem_password_cb* cd, void* u);
EVP_PKEY* PEM_read_bio_Parameters(BIO* bp, EVP_PKEY** x);
int PEM_write_bio_Parameters(BIO* bp, EVP_PKEY* x);
EVP_PKEY* b2i_PrivateKey(const(ubyte)** in_, c_long length);
EVP_PKEY* b2i_PublicKey(const(ubyte)** in_, c_long length);
EVP_PKEY* b2i_PrivateKey_bio(BIO* in_);
EVP_PKEY* b2i_PublicKey_bio(BIO* in_);
int i2b_PrivateKey_bio(BIO* out_, EVP_PKEY* pk);
int i2b_PublicKey_bio(BIO* out_, EVP_PKEY* pk);
version(OPENSSL_NO_RC4) {} else {
EVP_PKEY* b2i_PVK_bio(BIO* in_, pem_password_cb* cb, void* u);
int i2b_PVK_bio(BIO* out_, EVP_PKEY* pk, int enclevel,
pem_password_cb* cb, void* u);
}
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
void ERR_load_PEM_strings();
/* Error codes for the PEM functions. */
/* Function codes. */
enum PEM_F_B2I_DSS = 127;
enum PEM_F_B2I_PVK_BIO = 128;
enum PEM_F_B2I_RSA = 129;
enum PEM_F_CHECK_BITLEN_DSA = 130;
enum PEM_F_CHECK_BITLEN_RSA = 131;
enum PEM_F_D2I_PKCS8PRIVATEKEY_BIO = 120;
enum PEM_F_D2I_PKCS8PRIVATEKEY_FP = 121;
enum PEM_F_DO_B2I = 132;
enum PEM_F_DO_B2I_BIO = 133;
enum PEM_F_DO_BLOB_HEADER = 134;
enum PEM_F_DO_PK8PKEY = 126;
enum PEM_F_DO_PK8PKEY_FP = 125;
enum PEM_F_DO_PVK_BODY = 135;
enum PEM_F_DO_PVK_HEADER = 136;
enum PEM_F_I2B_PVK = 137;
enum PEM_F_I2B_PVK_BIO = 138;
enum PEM_F_LOAD_IV = 101;
enum PEM_F_PEM_ASN1_READ = 102;
enum PEM_F_PEM_ASN1_READ_BIO = 103;
enum PEM_F_PEM_ASN1_WRITE = 104;
enum PEM_F_PEM_ASN1_WRITE_BIO = 105;
enum PEM_F_PEM_DEF_CALLBACK = 100;
enum PEM_F_PEM_DO_HEADER = 106;
enum PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY = 118;
enum PEM_F_PEM_GET_EVP_CIPHER_INFO = 107;
enum PEM_F_PEM_PK8PKEY = 119;
enum PEM_F_PEM_READ = 108;
enum PEM_F_PEM_READ_BIO = 109;
enum PEM_F_PEM_READ_BIO_PARAMETERS = 140;
enum PEM_F_PEM_READ_BIO_PRIVATEKEY = 123;
enum PEM_F_PEM_READ_PRIVATEKEY = 124;
enum PEM_F_PEM_SEALFINAL = 110;
enum PEM_F_PEM_SEALINIT = 111;
enum PEM_F_PEM_SIGNFINAL = 112;
enum PEM_F_PEM_WRITE = 113;
enum PEM_F_PEM_WRITE_BIO = 114;
enum PEM_F_PEM_WRITE_PRIVATEKEY = 139;
enum PEM_F_PEM_X509_INFO_READ = 115;
enum PEM_F_PEM_X509_INFO_READ_BIO = 116;
enum PEM_F_PEM_X509_INFO_WRITE_BIO = 117;
/* Reason codes. */
enum PEM_R_BAD_BASE64_DECODE = 100;
enum PEM_R_BAD_DECRYPT = 101;
enum PEM_R_BAD_END_LINE = 102;
enum PEM_R_BAD_IV_CHARS = 103;
enum PEM_R_BAD_MAGIC_NUMBER = 116;
enum PEM_R_BAD_PASSWORD_READ = 104;
enum PEM_R_BAD_VERSION_NUMBER = 117;
enum PEM_R_BIO_WRITE_FAILURE = 118;
enum PEM_R_CIPHER_IS_NULL = 127;
enum PEM_R_ERROR_CONVERTING_PRIVATE_KEY = 115;
enum PEM_R_EXPECTING_PRIVATE_KEY_BLOB = 119;
enum PEM_R_EXPECTING_PUBLIC_KEY_BLOB = 120;
enum PEM_R_INCONSISTENT_HEADER = 121;
enum PEM_R_KEYBLOB_HEADER_PARSE_ERROR = 122;
enum PEM_R_KEYBLOB_TOO_SHORT = 123;
enum PEM_R_NOT_DEK_INFO = 105;
enum PEM_R_NOT_ENCRYPTED = 106;
enum PEM_R_NOT_PROC_TYPE = 107;
enum PEM_R_NO_START_LINE = 108;
enum PEM_R_PROBLEMS_GETTING_PASSWORD = 109;
enum PEM_R_PUBLIC_KEY_NO_RSA = 110;
enum PEM_R_PVK_DATA_TOO_SHORT = 124;
enum PEM_R_PVK_TOO_SHORT = 125;
enum PEM_R_READ_KEY = 111;
enum PEM_R_SHORT_HEADER = 112;
enum PEM_R_UNSUPPORTED_CIPHER = 113;
enum PEM_R_UNSUPPORTED_ENCRYPTION = 114;
enum PEM_R_UNSUPPORTED_KEY_COMPONENTS = 126;
| D |
/*
Generated by Entice Designer
Entice Designer written by Christopher E. Miller
www.dprogramming.com/entice.php
*/
module gui.about;
private import dfl.all;
class About: dfl.form.Form
{
// Do not modify or move this block of variables.
//~Entice Designer variables begin here.
dfl.picturebox.PictureBox pictureBox1;
dfl.label.Label label1;
dfl.label.Label label2;
dfl.label.Label label3;
//~Entice Designer variables end here.
this()
{
initializeAbout();
this.pictureBox1.image = Application.resources.getIcon(101);
this.icon = Application.resources.getIcon(101);
}
private void initializeAbout() {
// Do not manually modify this function.
//~Entice Designer 0.8.2.1 code begins here.
//~DFL Form
formBorderStyle = dfl.form.FormBorderStyle.FIXED_DIALOG;
maximizeBox = false;
startPosition = dfl.form.FormStartPosition.CENTER_PARENT;
text = "Sobre";
clientSize = dfl.drawing.Size(258, 109);
//~DFL dfl.picturebox.PictureBox=pictureBox1
pictureBox1 = new dfl.picturebox.PictureBox();
pictureBox1.name = "pictureBox1";
pictureBox1.bounds = Rect(24, 36, 32, 32);
pictureBox1.parent = this;
//~DFL dfl.label.Label=label1
label1 = new dfl.label.Label();
label1.name = "label1";
label1.text = "Emulador de GameBoy";
label1.bounds = Rect(80, 24, 160, 16);
label1.parent = this;
//~DFL dfl.label.Label=label2
label2 = new dfl.label.Label();
label2.name = "label2";
label2.text = "Por Carlos Ballesteros Velasco";
label2.bounds = Rect(80, 48, 160, 16);
label2.parent = this;
//~DFL dfl.label.Label=label3
label3 = new dfl.label.Label();
label3.name = "label3";
label3.text = "1ª Versión Mayo 2007";
label3.bounds = Rect(80, 72, 160, 16);
label3.parent = this;
//~Entice Designer 0.8.2.1 code ends here.
}
}
| D |
/**
A simple implementation of the signals pattern.
*/
module raijin.patterns.signals;
import std.algorithm;
/**
The implementation of the signals pattern.
*/
struct Signals(Slot)
{
/**
Adds a function/delegate to the array of functions/delegates to be called later.
Params:
slot = The function/delegate to add.
*/
void connect(Slot slot)
{
slots_ ~= slot;
}
/**
Remove a function/delegate from the array of functions/delegates.
Params:
slot = The function/delegate to remove.
*/
void disconnect(Slot slot)
{
slots_ = slots_.remove!((Slot a) { return a is slot; });
}
/**
Removes all stored delegates/functions from the signals array.
*/
void disconnectAll()
{
slots_ = [];
}
/**
Calls all functions/delegates in the signals array.
*/
void emit(Args...)(Args args)
{
slots_.each!(a => a(args));
}
private:
Slot[] slots_;
}
///
unittest
{
import std.stdio : writeln;
writeln;
writeln("<=====================Beginning test for signals module=====================>");
alias NotifyFunction = void delegate(); // Must be a delegate if functions are inside the unittest block.
Signals!NotifyFunction signals;
void firstFunc()
{
writeln("This is the FirstFunc calling...");
}
void secondFunc()
{
writeln("This is the SecondFunc calling...");
}
signals.connect(&firstFunc);
signals.connect(&secondFunc);
signals.emit();
writeln("Removing firstFunc.");
signals.disconnect(&firstFunc);
signals.emit();
writeln("Removing all slots.");
signals.disconnectAll();
signals.emit();
alias NotifyDelegate = void delegate();
alias NotifyDelegateArg = void delegate(string value);
class TestDelegates
{
this()
{
signals_.connect(&aVoidDel);
signals_.connect(&aVoidDel2);
signals_.emit();
signals_.disconnect(&aVoidDel2);
signals_.emit();
signals_.disconnectAll();
signals_.emit();
signals_.connect(&aArgDel);
signals_.emit();
}
void aVoidDel()
{
writeln("Calling TestDelegates.aVoidDel");
}
void aVoidDel2()
{
writeln("Calling TestDelegates.aVoidDel2");
}
void aArgDel()
{
writeln("Calling TestDelegates.aArgDel");
}
private:
Signals!NotifyDelegate signals_;
}
auto test = new TestDelegates;
}
| D |
import pyd.pyd, pyd.embedded, pyd.extra;
import deimos.python.Python;
import std.complex;
import std.string;
static this() {
py_init();
}
unittest {
alias cfloat_ = Complex!float;
cfloat_[] data = [
cfloat_(1,2),
cfloat_(1,3),
cfloat_(1,4),
cfloat_(1,6),
];
auto npa = d_to_python_numpy_ndarray(data);
auto npop = new PydObject(npa);
assert(npop[0].imag.to_d!float() == 2);
assert(npop[0].getattr("real").to_d!float() == 1);
foreach(i, datum; data) {
assert(npop[i].imag.to_d!float() == datum.im);
assert(npop[i].getattr("real").to_d!float() == datum.re);
}
}
unittest {
alias cfloat_ = const(Complex!float);
cfloat_[] data = [
cfloat_(1,2),
cfloat_(1,3),
cfloat_(1,4),
cfloat_(1,6),
];
auto npa = d_to_python_numpy_ndarray(data);
auto npop = new PydObject(npa);
assert(npop[0].imag.to_d!float() == 2);
assert(npop[0].getattr("real").to_d!float() == 1);
foreach(i, datum; data) {
assert(npop[i].imag.to_d!float() == datum.im);
assert(npop[i].getattr("real").to_d!float() == datum.re);
}
}
unittest {
bool[] data = [true, false, true, true, false];
auto npa = new PydObject(d_to_python_numpy_ndarray(data));
foreach(i, datum; data) {
assert(npa[i].to_d!bool() == datum);
}
}
unittest {
InterpContext context = new InterpContext();
context.py_stmts(outdent("
import numpy
a = numpy.eye(2, dtype='complex64')
"));
context.a.to_d!(Complex!float[][] )();
}
unittest {
InterpContext context = new InterpContext();
context.py_stmts(outdent("
import numpy
a = numpy.eye(2, dtype='complex128')
"));
context.a.to_d!(Complex!double[][] )();
}
void main() {}
| D |
/Users/Fares/Documents/Projects/TransitApp/build/Pods.build/Debug-iphonesimulator/MaterialKit.build/Objects-normal/x86_64/MKImageView.o : /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKActivityIndicator.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKButton.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKCardView.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKCollectionViewCell.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKColor.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKEmbedDrawerControllerSegue.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKEmbedMainControllerSegue.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKImageView.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKLabel.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKLayer.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKNavigationBar.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKRefreshControl.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSideDrawerViewController.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSnackbar.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSwitch.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKTableViewCell.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKTextField.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/Fares/Documents/Projects/TransitApp/Pods/Target\ Support\ Files/MaterialKit/MaterialKit-umbrella.h /Users/Fares/Documents/Projects/TransitApp/build/Pods.build/Debug-iphonesimulator/MaterialKit.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule
/Users/Fares/Documents/Projects/TransitApp/build/Pods.build/Debug-iphonesimulator/MaterialKit.build/Objects-normal/x86_64/MKImageView~partial.swiftmodule : /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKActivityIndicator.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKButton.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKCardView.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKCollectionViewCell.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKColor.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKEmbedDrawerControllerSegue.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKEmbedMainControllerSegue.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKImageView.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKLabel.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKLayer.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKNavigationBar.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKRefreshControl.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSideDrawerViewController.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSnackbar.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSwitch.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKTableViewCell.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKTextField.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/Fares/Documents/Projects/TransitApp/Pods/Target\ Support\ Files/MaterialKit/MaterialKit-umbrella.h /Users/Fares/Documents/Projects/TransitApp/build/Pods.build/Debug-iphonesimulator/MaterialKit.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule
/Users/Fares/Documents/Projects/TransitApp/build/Pods.build/Debug-iphonesimulator/MaterialKit.build/Objects-normal/x86_64/MKImageView~partial.swiftdoc : /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKActivityIndicator.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKButton.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKCardView.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKCollectionViewCell.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKColor.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKEmbedDrawerControllerSegue.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKEmbedMainControllerSegue.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKImageView.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKLabel.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKLayer.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKNavigationBar.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKRefreshControl.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSideDrawerViewController.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSnackbar.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKSwitch.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKTableViewCell.swift /Users/Fares/Documents/Projects/TransitApp/Pods/MaterialKit/Source/MKTextField.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/Fares/Documents/Projects/TransitApp/Pods/Target\ Support\ Files/MaterialKit/MaterialKit-umbrella.h /Users/Fares/Documents/Projects/TransitApp/build/Pods.build/Debug-iphonesimulator/MaterialKit.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule
| D |
#objdump: -r
#name: macro rept
#source: ../macros/rept.s
.*: +file format .*
RELOCATION RECORDS FOR .*
OFFSET[ ]+TYPE[ ]+VALUE.*
0+08[ ]+[a-zA-Z0-9_]+[ ]+foo1
0+04[ ]+[a-zA-Z0-9_]+[ ]+foo1
0+00[ ]+[a-zA-Z0-9_]+[ ]+foo1
| D |
module heightsheets.level1;
import std.algorithm;
import std.stdio;
import heightsheets.heightsheets;
import heightsheets.level0;
import graphics.camera;
import graphics.ogl;
import graphics.shader;
import modules.module_;
import worldgen.maps;
import worldstate.worldstate;
import cgy.math.vector : vec3f, vec2i;
immutable int level1SectorCount = 16; //Spans 16 sectors
immutable int level1QuadCount = 64; //64 quads
immutable int level1VertexCount = level1QuadCount + 1;
immutable int level1SampleDistance = level1SectorCount * SectorSize.x / level1QuadCount; //Distance in tiles between samples
final class Level1Sheet {
uint vertVBO;
uint normVBO;
uint colorVBO;
uint idxVBO;
//This is for level1-stuff. yeah.
vec3f[level1VertexCount][level1VertexCount] vertices; //lol 20k of vertex data on stack
vec3f[level1VertexCount][level1VertexCount] normals; //Another 20k! will it blend?
vec3f[level1VertexCount][level1VertexCount] colors; // EVEN MORE! WILL TEH STACK CORPPTU?
float[level1SectorCount*level1SectorCount] sectorMin;
float[level1SectorCount*level1SectorCount] sectorMax;
ushort[level1QuadCount*level1QuadCount*6] indices;
SectorNum center;
bool[level1SectorCount][level1SectorCount] loaded;
HeightSheets heightSheets;
WorldMap worldMap;
WorldState worldState;
Level0Sheet level0;
this(HeightSheets _heightSheets) {
heightSheets = _heightSheets;
worldMap = heightSheets.worldMap;
worldState = heightSheets.worldState;
level0 = new Level0Sheet(this);
}
bool destroyed = false;
~this() {
BREAK_IF(!destroyed);
}
void destroy() {
level0.destroy();
destroyed = true;
//Should also destroy any opengl stuff?
//Or not?
}
void init() {
level0.init();
}
void buildHeightmap(SectorNum center) {
// Build level1SectorCount * level1SectorCount sectors of level1-data (1 square kilometer)
// That is (level1SectorCount*4+1)x(level1SectorCount*4+1) vertices
//Dont be surprised if it doesnt!
this.center = center;
vec3f centerTp = center.toTilePos.value.convert!float;
//South-western corner of this heightsheet starts in this sectornum.
SectorXYNum startSect = SectorXYNum(SectorXYNum(center).value - vec2i(level1SectorCount / 2));
vec2i baseTp = startSect.getTileXYPos().value;
sectorMin[] = float.max;
sectorMax[] = -float.max;
foreach(y ; 0 .. level1VertexCount) {
foreach(x ; 0 .. level1VertexCount) {
vec2i tp = baseTp + vec2i(level1SampleDistance) * vec2i(x, y);
float X = cast(float) tp.x;
float Y = cast(float) tp.y;
float Z;
if(x == 0 || x == level1QuadCount || y == 0 || y == level1QuadCount) {
Z = worldMap.getApproxHeight(TileXYPos(tp), 2);
} else {
Z = worldMap.getApproxHeight(TileXYPos(tp), 1);
}
vertices[y][x].set(X,Y,Z);
vertices[y][x] -= centerTp;
//colors[y][x] = worldMap.getAreaColor(TileXYPos(tp));
colors[y][x] = worldMap.isInsideWorld(TileXYPos(tp).toTilePos(0)) ? vec3f(0.4) : vec3f(0.8, 0.1, 0.1);
}
}
foreach(y ; 0 .. level1SectorCount) {
foreach(x ; 0 .. level1SectorCount) {
foreach(dx ; 0 .. 5) {
foreach(dy ; 0 .. 5) {
//Find min and max for sectors within our areas.
// It may be possible that within our 2d-neighborhood we are above
// or below the ground, and the heightsheet for the ground may need to be built depending on that,
// so we find where the ground is(here) and uses it to compare with what is loaded (later)
sectorMin[level1SectorCount * y + x] = min(sectorMin[level1SectorCount * y + x], vertices[y*4+dx][x*4+dy].z);
sectorMax[level1SectorCount * y + x] = max(sectorMax[level1SectorCount * y + x], vertices[y*4+dx][x*4+dy].z);
}
}
}
}
indices[] = 0;
foreach(sectY ; 0 .. level1SectorCount) {
foreach(sectX ; 0 .. level1SectorCount) {
if( !shouldMakeHeightSheet(vec2i(sectX, sectY))) {
loaded[sectY][sectX] = false;
continue;
}
loaded[sectY][sectX] = true;
foreach(dy ; 0 .. 4) {
auto y = sectY * 4 + dy;
foreach(dx ; 0 .. 4) {
auto x = sectX * 4 + dx;
vec2i tp = baseTp + vec2i(level1SampleDistance) * vec2i(x, y);
int base = 6*(level1QuadCount*y+x);
indices[base + 1] = cast(ushort)((level1VertexCount) * (y + 0) + x + 0);
indices[base + 0] = cast(ushort)((level1VertexCount) * (y + 1) + x + 0);
indices[base + 2] = cast(ushort)((level1VertexCount) * (y + 0) + x + 1);
indices[base + 4] = cast(ushort)((level1VertexCount) * (y + 1) + x + 0);
indices[base + 3] = cast(ushort)((level1VertexCount) * (y + 1) + x + 1);
indices[base + 5] = cast(ushort)((level1VertexCount) * (y + 0) + x + 1);
}
}
}
}
float get(int x, int y) {
if(x < 0 || x > level1QuadCount || y < 0 || y > level1QuadCount) {
//Should make it so that it returns an extrapolated version, or something? dnot care so much myself :P
x = x < 0 ? 0 : x;
x = x > level1QuadCount ? level1QuadCount : x;
y = y < 0 ? 0 : y;
y = y > level1QuadCount ? level1QuadCount : y;
return vertices[y][x].z;
} else {
return vertices[y][x].z;
}
}
foreach(y ; 0 .. level1VertexCount) {
foreach(x ; 0 .. level1VertexCount) {
float Xn = get(x-1, y );
float Xp = get(x+1, y );
float c = get(x , y );
float Yn = get(x , y-1);
float Yp = get(x , y+1);
vec3f Nx1 = vec3f(Xn - c, 0.0f, level1SampleDistance);
vec3f Nx2 = vec3f(c - Xp, 0.0f, level1SampleDistance);
vec3f Ny1 = vec3f(0.0f, Yn - c, level1SampleDistance);
vec3f Ny2 = vec3f(0.0f, c - Yp, level1SampleDistance);
normals[y][x] = (Nx1 + Nx2 + Ny1 + Ny2).normalizeThis();
}
}
if(vertVBO == 0) {
vertVBO = CreateBuffer(BufferType.Array, vertices.sizeof, vertices.ptr, GL_STATIC_DRAW);
} else {
glBindBuffer(GL_ARRAY_BUFFER, vertVBO);
glBufferSubData(GL_ARRAY_BUFFER, 0, vertices.sizeof, vertices.ptr);
}
if(normVBO == 0) {
normVBO = CreateBuffer(BufferType.Array, normals.sizeof, normals.ptr, GL_STATIC_DRAW);
} else {
glBindBuffer(GL_ARRAY_BUFFER, normVBO);
glBufferSubData(GL_ARRAY_BUFFER, 0, normals.sizeof, normals .ptr);
}
if(colorVBO == 0) {
colorVBO = CreateBuffer(BufferType.Array, colors.sizeof, colors.ptr, GL_STATIC_DRAW);
} else {
glBindBuffer(GL_ARRAY_BUFFER, colorVBO );
glBufferSubData(GL_ARRAY_BUFFER, 0, colors.sizeof, colors.ptr);
}
if(idxVBO == 0) {
idxVBO = CreateBuffer(BufferType.ElementArray, indices.sizeof, indices.ptr, GL_STATIC_DRAW);
} else {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVBO);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, indices.sizeof, indices.ptr);
}
level0.buildHeightmap(center);
}
void render(Camera camera) {
glBindBuffer(GL_ARRAY_BUFFER, vertVBO); glError();
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, vec3f.sizeof, cast(void*) 0); glError();
glBindBuffer(GL_ARRAY_BUFFER, normVBO); glError();
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, vec3f.sizeof, cast(void*) 0); glError();
glBindBuffer(GL_ARRAY_BUFFER, colorVBO); glError();
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, vec3f.sizeof, cast(void*) 0); glError();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVBO);
glDrawElements(GL_TRIANGLES, level1QuadCount*level1QuadCount*6, GL_UNSIGNED_SHORT, cast(void*) 0);
level0.render(camera);
}
//Indexed [0..level1SectorCount] in x,y
//Loops over the range of sectors that the heightsheet covers at a xy-secnum,
//checks if it is part of the current world, if not then we are free to make heightsheets.
bool shouldMakeHeightSheet(vec2i sectorNum) {
double maxZ = sectorMax[sectorNum.y * level1SectorCount + sectorNum.x] + center.toTilePos.value.z;
double minZ = sectorMin[sectorNum.y * level1SectorCount + sectorNum.x] + center.toTilePos.value.z;
SectorXYNum startSect = SectorXYNum(SectorXYNum(center).value - vec2i(level1SectorCount / 2));
SectorXYNum thisSect = SectorXYNum(startSect.value + sectorNum);
TileXYPos tp = thisSect.getTileXYPos;
TilePos maxTP = tp.toTilePos(cast(int)maxZ);
TilePos minTP = tp.toTilePos(cast(int)minZ);
auto maxSector = maxTP.getSectorNum();
auto minSector = minTP.getSectorNum();
foreach(z ; minSector.value.z .. maxSector.value.z+1) {
auto testNum = thisSect.getSectorNum(z);
if(worldState.isActiveSector(testNum)) {
if(worldState.isAirSector(testNum)) continue;
return false;
}
}
return true;
}
}
| D |
module gfm.math.fixedpoint;
import std.traits;
import gfm.math.wideint,
gfm.math.funcs;
/**
M.N fixed point integer.
Only signed integers are supported.
Only supports basic arithmetic.
If M + N > 32, then wide integers are used and this will likely be slow.
Params:
M = number of bits before the mark, M > 0
N = number of bits after the mark, N > 0
Bugs: No proper rounding.
*/
align(1) struct FixedPoint(int M, int N)
{
align(1):
static assert(M > 0); // M == 0 is unsupported
static assert(N > 0); // N == 0 also unsupported, but in this case you can use wideint!M
public
{
alias TypeNeeded!(N + M) value_t;
/// Construct with an assignable value.
@nogc this(U)(U x) pure nothrow
{
opAssign!U(x);
}
/// Construct with an assignable value.
@nogc ref FixedPoint opAssign(U)(U x) pure nothrow if (is(U: FixedPoint))
{
value = x.value;
return this;
}
@nogc ref FixedPoint opAssign(U)(U x) pure nothrow if (isIntegral!U)
{
value = x * ONE; // exact
return this;
}
@nogc ref FixedPoint opAssign(U)(U x) pure nothrow if (isFloatingPoint!U)
{
value = cast(value_t)(x * ONE); // truncation
return this;
}
// casting to float
@nogc U opCast(U)() pure const nothrow if (isFloatingPoint!U)
{
return cast(U)(value) / ONE;
}
// casting to integer (truncation)
@nogc U opCast(U)() pure const nothrow if (isIntegral!U)
{
return cast(U)(value) >> N;
}
@nogc ref FixedPoint opOpAssign(string op, U)(U x) pure nothrow if (is(U: FixedPoint))
{
static if (op == "+")
{
value += x.value;
return this;
}
else static if (op == "-")
{
value -= x.value;
return this;
}
else static if (op == "*")
{
alias TypeNeeded!(2 * N + M) inter_t;
value = cast(value_t)((cast(inter_t)value * x.value) >> N);
return this;
}
else static if (op == "/")
{
alias TypeNeeded!(2 * N + M) inter_t;
value = cast(value_t)((cast(inter_t)value << N) / x.value);
// ^ possible overflow when downcasting
return this;
}
else
{
static assert(false, "FixedPoint does not support operator " ~ op);
}
}
@nogc ref FixedPoint opOpAssign(string op, U)(U x) pure nothrow if (isConvertible!U)
{
FixedPoint conv = x;
return opOpAssign!op(conv);
}
@nogc FixedPoint opBinary(string op, U)(U x) pure const nothrow if (is(U: FixedPoint) || (isConvertible!U))
{
FixedPoint temp = this;
return temp.opOpAssign!op(x);
}
@nogc FixedPoint opBinaryRight(string op, U)(U x) pure const nothrow if (isConvertible!U)
{
FixedPoint temp = x;
return temp.opOpAssign!op(this);
}
@nogc bool opEquals(U)(U other) pure const nothrow if (is(U : FixedPoint))
{
return value == other.value;
}
@nogc bool opEquals(U)(U other) pure const nothrow if (isConvertible!U)
{
FixedPoint conv = other;
return opEquals(conv);
}
@nogc int opCmp(in FixedPoint other) pure const nothrow
{
if (value > other.value)
return 1;
else if (value < other.value)
return -1;
else
return 0;
}
@nogc FixedPoint opUnary(string op)() pure const nothrow if (op == "+")
{
return this;
}
@nogc FixedPoint opUnary(string op)() pure const nothrow if (op == "-")
{
FixedPoint res = void;
res.value = -value;
return res;
}
value_t value;
}
private
{
enum value_t ONE = cast(value_t)1 << N;
enum value_t HALF = ONE >>> 1;
enum value_t LOW_MASK = ONE - 1;
enum value_t HIGH_MASK = ~LOW_MASK;
static assert((ONE & LOW_MASK) == 0);
// define types that can be converted to FixedPoint, but are not FixedPoint
template isConvertible(T)
{
enum bool isConvertible = (!is(T : FixedPoint))
&& is(typeof(
{
T x;
FixedPoint v = x;
}()));
}
}
}
// Selects a signed integer type suitable to hold numBits bits.
private template TypeNeeded(int numBits)
{
static if (numBits <= 8)
{
alias byte TypeNeeded;
}
else
{
enum N = nextPowerOf2(numBits);
alias wideint!N TypeNeeded;
}
}
/// abs() function for fixed-point numbers.
@nogc FixedPoint!(M, N) abs(int M, int N)(FixedPoint!(M, N) x) pure nothrow
{
FixedPoint!(M, N) res = void;
res.value = ((x.value >= 0) ? x.value : -x.value);
return res;
}
unittest
{
alias FixedPoint!(4,4) fix4;
alias FixedPoint!(8,8) fix8;
alias FixedPoint!(16,16) fix16;
alias FixedPoint!(24,8) fix24_8;
alias FixedPoint!(32,32) fix32_32;
static assert (is(fix24_8.value_t == int));
static assert (is(fix16.value_t == int));
static assert (is(fix8.value_t == short));
static assert (is(fix4.value_t == byte));
static assert(fix8.ONE == 0x0100);
static assert(fix16.ONE == 0x00010000);
static assert(fix24_8.ONE == 0x0100);
fix16 a = 1, b = 2, c = 3;
assert(a < b);
assert(c >= b);
fix16 d;
auto apb = a + b;
auto bmc = b * c;
d = a + b * c;
assert(d.value == 7 * d.ONE);
assert(d == 7);
assert(32768 * (d / 32768) == 7);
}
| D |
/**
Describes any component that can have child components.
*/
module declui.components.container;
import declui.components.component;
/**
A container is a type of component that is capable of having child components.
*/
interface IContainer : IComponent
{
/**
Adds a child component to the component.
Params:
child = The child component to add.
*/
void add(IComponent child);
}
| D |
module libd.algorithm;
public import
libd.algorithm.common,
libd.algorithm.comparison,
libd.algorithm.search,
libd.algorithm.filtering,
libd.algorithm.mutate; | D |
# FIXED
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/common/osal_memory_icall.c
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/comdef.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/stdint.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/stdint.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/cdefs.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/_types.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/machine/_types.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/machine/_stdint.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/_stdint.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/stdbool.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_defs.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/limits.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_memory.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_timers.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/stdlib.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/_ti_config.h
OSAL/osal_memory_icall.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/linkage.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_assert.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h
OSAL/osal_memory_icall.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall_jt.h
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/common/osal_memory_icall.c:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/comdef.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/stdint.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/stdint.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/cdefs.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/_types.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/machine/_types.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/machine/_stdint.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/sys/_stdint.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/stdbool.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_defs.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/limits.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_memory.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_timers.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/stdlib.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/_ti_config.h:
C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.5.LTS/include/linkage.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_assert.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall_jt.h:
| D |
module query.prefix;
import std.typecons;
import std.variant;
import std.conv;
import std.exception;
import std.stdio;
import entity.prefix;
import relationaldb.all;
class PrefixQuery
{
protected RelationalDBInterface relationalDb;
this(RelationalDBInterface relationalDb) @safe
{
this.relationalDb = relationalDb;
}
public bool exists(in string prefixCode) @trusted
{
enforce(prefixCode != "", "Please supply a prefix code");
string sql = "
SELECT count(`prefix`) as numRows
FROM prefix
WHERE prefix = ?
";
auto numRows = this.relationalDb.getColumnValueInt(
sql,
variantArray(prefixCode)
);
return (numRows > 0);
}
public Prefix getPrefix(in string prefixCode) @trusted
{
enforce(prefixCode != "", "Please supply a prefix code");
string sql = "
SELECT *
FROM prefix
WHERE prefix = ?
";
Prefix prefix = this.relationalDb.loadRow!Prefix(
sql,
variantArray(prefixCode)
);
return prefix;
}
} | D |
/home/kono/myprojects/rust_tutorial/guessing_game/target/debug/deps/rand_hc-1b8885716260aa60.rmeta: /home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/lib.rs /home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/hc128.rs
/home/kono/myprojects/rust_tutorial/guessing_game/target/debug/deps/librand_hc-1b8885716260aa60.rlib: /home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/lib.rs /home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/hc128.rs
/home/kono/myprojects/rust_tutorial/guessing_game/target/debug/deps/rand_hc-1b8885716260aa60.d: /home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/lib.rs /home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/hc128.rs
/home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/lib.rs:
/home/kono/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_hc-0.1.0/src/hc128.rs:
| D |
// Copyright Ferdinand Majerech 2013-2014.
// 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)
/// Default policy controlling compile-time parameters to the entity system.
module tharsis.entity.entitypolicy;
import std.traits;
import tharsis.entity.componenttypeinfo;
//XXX if minComponentPerEntityPrealloc is >= 1, specify we never run out of
// component space during a frame, which allows us to simplify
// some componentIterator code (e.g. no branch to check if we've ran out
// of space).
/// Default policy controlling compile-time parameters to the entity system.
struct DefaultEntityPolicy
{
/// Maximum possible number of user-defined component types.
///
/// ComponentTypeIDs of user-defined component types must be
/// >= maxReservedComponentTypes and
/// < maxReservedComponentTypes + maxUserComponentTypes.
enum maxUserComponentTypes = 64;
/// Maximum entities added during one frame.
enum maxNewEntitiesPerFrame = 4096;
/// Minimum size of component buffers (in components) for every component
/// type to preallocate.
enum minComponentPrealloc = 1024;
/// The multiplier to increase allocated size during an emergency reallocation.
enum reallocMult = 2.5;
/// Minimum relative size of component buffers (in components) for every
/// component type compared to entity count.
enum minComponentPerEntityPrealloc = 0.05;
/// Data type used internally for component counts in an entity.
///
/// The maximum number of components of one type in an entity is
/// ComponentCount.max. Using data types such as uint or ulong will
/// increase memory usage.
alias ushort ComponentCount;
}
/// Check if an entity policy is valid.
template validateEntityPolicy(Policy)
{
static assert(std.traits.isUnsigned!(Policy.ComponentCount),
"ComponentCount must be an unsigned integer type");
static assert(Policy.reallocMult > 1.0,
"reallocMult must be greater than 1");
}
/// The maximum possible number of component types when using specified entity
/// policy, including builtins, defaults and user defined.
template maxComponentTypes(Policy)
{
enum maxComponentTypes =
maxReservedComponentTypes + Policy.maxUserComponentTypes;
static assert(maxComponentTypes < ushort.max,
"Too many component types");
}
| D |
module deadcode.platform.linuxlinetrace;
// Tracewrapper by Adam D. Ruppe
version (linux):
version (unittest) import deadcode.test;
import core.runtime;
class WrappedTraceHandler : Throwable.TraceInfo {
Throwable.TraceInfo ti;
this(Throwable.TraceInfo ti) {
this.ti = ti;
}
int opApply(scope int delegate(ref const(char[])) dg) const {
return opApply( (ref size_t, ref const(char[]) buf)
{ return dg(buf); });
}
unittest
{
auto h = new WrappedTraceHandler(null);
int cb(ref const(char[]) msg)
{
return 0;
}
Assert(0, h.opApply(&cb));
}
int opApply(scope int delegate(ref size_t, ref const(char[])) dg) const
{
// disable the custom tracehandler while we're in here
// to avoid any recursive calls
auto backToIt = Runtime.traceHandler;
Runtime.traceHandler = null;
scope(exit) Runtime.traceHandler = backToIt;
return opApplyInternal(dg, ti);
}
private int opApplyInternal(T)(scope int delegate(ref size_t, ref const(char[])) dg, T ti) const
{
if (ti is null)
{
size_t x = 0;
char[] y = null;
return dg(x, y);
}
int ret = 0;
foreach(size_t i, const(char[]) tmpbuf; ti) {
const(char)[] b = tmpbuf;
// the address is in brackets right at the end
if(b.length > 2 && b[$-1] == ']') {
int idx;
inner: for(idx = cast(int) b.length - 1; idx > 0; idx--)
if(b[idx] == '[') {
idx++;
break inner;
}
if(idx) {
auto addr = b[idx .. $-1];
try {
string pretty;
import std.process;
auto exe = execute(["addr2line", "-e", Runtime.args[0], addr]);
if(exe.status == 0 && exe.output.length && exe.output[0] != '?') {
pretty = exe.output[0 .. $-1];
version(hide_names)
b = pretty;
else
b = b[0 .. idx] ~ pretty ~ b[$-1 .. $];
} else {
version(hide_names)
continue;
}
} catch(Exception e) {
// failure isn't a big deal to me
}
}
}
ret = dg(i, b);
if(ret) break;
}
return ret;
}
unittest
{
auto h = new WrappedTraceHandler(null);
enum testTrace = "./deadcode-platform-test-unittest(_D4core7runtime18runModuleUnitTestsUZ19unittestSegvHandlerUNbiPS4core3sys5posix6signal9siginfo_tPvZv+0x38)[0x9079d0]";
enum testV = 42;
enum testR = 100;
class MockTraceInfo
{
int opApply(scope int delegate(ref size_t, ref const(char[])) dg) const
{
auto d = testTrace.dup;
size_t v = testV;
auto r = dg(v, d);
return r;
}
}
int cb(ref size_t v, ref const(char[]) msg)
{
Assert(testV, v);
AssertContains(msg.idup, "deadcode-platform-test-unittest");
return testR;
}
auto mock = new MockTraceInfo();
int res = h.opApplyInternal(&cb, mock);
Assert(testR, res);
}
override string toString() const {
import std.conv;
return text(ti, "\n(WrappedTraceHandler)\n");
}
unittest
{
auto h = new WrappedTraceHandler(null);
Assert("null\n(WrappedTraceHandler)\n", h.toString());
}
}
Throwable.TraceInfo handler(void* ptr) {
return new WrappedTraceHandler(defaultTraceHandler(ptr));
}
static this() {
Runtime.traceHandler = &handler;
}
| 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 vtkTransform2D;
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 SWIGTYPE_p_double;
static import SWIGTYPE_p_float;
static import vtkMatrix3x3;
static import vtkPoints2D;
static import vtkObject;
class vtkTransform2D : vtkObject.vtkObject {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(vtkd_im.vtkTransform2D_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(vtkTransform2D 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 vtkTransform2D New() {
void* cPtr = vtkd_im.vtkTransform2D_New();
vtkTransform2D ret = (cPtr is null) ? null : new vtkTransform2D(cPtr, false);
return ret;
}
public static int IsTypeOf(string type) {
auto ret = vtkd_im.vtkTransform2D_IsTypeOf((type ? std.string.toStringz(type) : null));
return ret;
}
public static vtkTransform2D SafeDownCast(vtkObjectBase.vtkObjectBase o) {
void* cPtr = vtkd_im.vtkTransform2D_SafeDownCast(vtkObjectBase.vtkObjectBase.swigGetCPtr(o));
vtkTransform2D ret = (cPtr is null) ? null : new vtkTransform2D(cPtr, false);
return ret;
}
public vtkTransform2D NewInstance() const {
void* cPtr = vtkd_im.vtkTransform2D_NewInstance(cast(void*)swigCPtr);
vtkTransform2D ret = (cPtr is null) ? null : new vtkTransform2D(cPtr, false);
return ret;
}
alias vtkObject.vtkObject.NewInstance NewInstance;
public void Identity() {
vtkd_im.vtkTransform2D_Identity(cast(void*)swigCPtr);
}
public void Inverse() {
vtkd_im.vtkTransform2D_Inverse(cast(void*)swigCPtr);
}
public void Translate(double x, double y) {
vtkd_im.vtkTransform2D_Translate__SWIG_0(cast(void*)swigCPtr, x, y);
}
public void Translate(SWIGTYPE_p_double.SWIGTYPE_p_double x) {
vtkd_im.vtkTransform2D_Translate__SWIG_1(cast(void*)swigCPtr, SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(x));
}
public void Translate(SWIGTYPE_p_float.SWIGTYPE_p_float x) {
vtkd_im.vtkTransform2D_Translate__SWIG_2(cast(void*)swigCPtr, SWIGTYPE_p_float.SWIGTYPE_p_float.swigGetCPtr(x));
}
public void Rotate(double angle) {
vtkd_im.vtkTransform2D_Rotate(cast(void*)swigCPtr, angle);
}
public void Scale(double x, double y) {
vtkd_im.vtkTransform2D_Scale__SWIG_0(cast(void*)swigCPtr, x, y);
}
public void Scale(SWIGTYPE_p_double.SWIGTYPE_p_double s) {
vtkd_im.vtkTransform2D_Scale__SWIG_1(cast(void*)swigCPtr, SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(s));
}
public void Scale(SWIGTYPE_p_float.SWIGTYPE_p_float s) {
vtkd_im.vtkTransform2D_Scale__SWIG_2(cast(void*)swigCPtr, SWIGTYPE_p_float.SWIGTYPE_p_float.swigGetCPtr(s));
}
public void SetMatrix(vtkMatrix3x3.vtkMatrix3x3 matrix) {
vtkd_im.vtkTransform2D_SetMatrix__SWIG_0(cast(void*)swigCPtr, vtkMatrix3x3.vtkMatrix3x3.swigGetCPtr(matrix));
}
public void SetMatrix(SWIGTYPE_p_double.SWIGTYPE_p_double elements) {
vtkd_im.vtkTransform2D_SetMatrix__SWIG_1(cast(void*)swigCPtr, SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(elements));
}
public vtkMatrix3x3.vtkMatrix3x3 GetMatrix() {
void* cPtr = vtkd_im.vtkTransform2D_GetMatrix__SWIG_0(cast(void*)swigCPtr);
vtkMatrix3x3.vtkMatrix3x3 ret = (cPtr is null) ? null : new vtkMatrix3x3.vtkMatrix3x3(cPtr, false);
return ret;
}
public void GetMatrix(vtkMatrix3x3.vtkMatrix3x3 matrix) {
vtkd_im.vtkTransform2D_GetMatrix__SWIG_1(cast(void*)swigCPtr, vtkMatrix3x3.vtkMatrix3x3.swigGetCPtr(matrix));
}
public void GetPosition(SWIGTYPE_p_double.SWIGTYPE_p_double pos) {
vtkd_im.vtkTransform2D_GetPosition__SWIG_0(cast(void*)swigCPtr, SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(pos));
}
public void GetPosition(SWIGTYPE_p_float.SWIGTYPE_p_float pos) {
vtkd_im.vtkTransform2D_GetPosition__SWIG_1(cast(void*)swigCPtr, SWIGTYPE_p_float.SWIGTYPE_p_float.swigGetCPtr(pos));
}
public void GetScale(SWIGTYPE_p_double.SWIGTYPE_p_double pos) {
vtkd_im.vtkTransform2D_GetScale__SWIG_0(cast(void*)swigCPtr, SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(pos));
}
public void GetScale(SWIGTYPE_p_float.SWIGTYPE_p_float pos) {
vtkd_im.vtkTransform2D_GetScale__SWIG_1(cast(void*)swigCPtr, SWIGTYPE_p_float.SWIGTYPE_p_float.swigGetCPtr(pos));
}
public void GetInverse(vtkMatrix3x3.vtkMatrix3x3 inverse) {
vtkd_im.vtkTransform2D_GetInverse(cast(void*)swigCPtr, vtkMatrix3x3.vtkMatrix3x3.swigGetCPtr(inverse));
}
public void GetTranspose(vtkMatrix3x3.vtkMatrix3x3 transpose) {
vtkd_im.vtkTransform2D_GetTranspose(cast(void*)swigCPtr, vtkMatrix3x3.vtkMatrix3x3.swigGetCPtr(transpose));
}
public void TransformPoints(float* inPts, float* outPts, int n) {
vtkd_im.vtkTransform2D_TransformPoints__SWIG_0(cast(void*)swigCPtr, cast(void*)inPts, cast(void*)outPts, n);
}
public void TransformPoints(double* inPts, double* outPts, int n) {
vtkd_im.vtkTransform2D_TransformPoints__SWIG_1(cast(void*)swigCPtr, cast(void*)inPts, cast(void*)outPts, n);
}
public void TransformPoints(vtkPoints2D.vtkPoints2D inPts, vtkPoints2D.vtkPoints2D outPts) {
vtkd_im.vtkTransform2D_TransformPoints__SWIG_2(cast(void*)swigCPtr, vtkPoints2D.vtkPoints2D.swigGetCPtr(inPts), vtkPoints2D.vtkPoints2D.swigGetCPtr(outPts));
}
public void InverseTransformPoints(float* inPts, float* outPts, int n) {
vtkd_im.vtkTransform2D_InverseTransformPoints__SWIG_0(cast(void*)swigCPtr, cast(void*)inPts, cast(void*)outPts, n);
}
public void InverseTransformPoints(double* inPts, double* outPts, int n) {
vtkd_im.vtkTransform2D_InverseTransformPoints__SWIG_1(cast(void*)swigCPtr, cast(void*)inPts, cast(void*)outPts, n);
}
public void InverseTransformPoints(vtkPoints2D.vtkPoints2D inPts, vtkPoints2D.vtkPoints2D outPts) {
vtkd_im.vtkTransform2D_InverseTransformPoints__SWIG_2(cast(void*)swigCPtr, vtkPoints2D.vtkPoints2D.swigGetCPtr(inPts), vtkPoints2D.vtkPoints2D.swigGetCPtr(outPts));
}
public void MultiplyPoint(SWIGTYPE_p_float.SWIGTYPE_p_float arg0, SWIGTYPE_p_float.SWIGTYPE_p_float arg1) {
vtkd_im.vtkTransform2D_MultiplyPoint__SWIG_0(cast(void*)swigCPtr, SWIGTYPE_p_float.SWIGTYPE_p_float.swigGetCPtr(arg0), SWIGTYPE_p_float.SWIGTYPE_p_float.swigGetCPtr(arg1));
}
public void MultiplyPoint(SWIGTYPE_p_double.SWIGTYPE_p_double arg0, SWIGTYPE_p_double.SWIGTYPE_p_double arg1) {
vtkd_im.vtkTransform2D_MultiplyPoint__SWIG_1(cast(void*)swigCPtr, SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(arg0), SWIGTYPE_p_double.SWIGTYPE_p_double.swigGetCPtr(arg1));
}
}
| D |
/**
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (C) ?-2019 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/xmm.d, backend/_xmm.d)
*/
module dmd.backend.xmm;
// Online documentation: https://dlang.org/phobos/dmd_backend_xmm.html
// XMM opcodes
enum
{
ADDSS = 0xF30F58, // ADDSS xmm1, xmm2/mem32 F3 0F 58 /r
ADDSD = 0xF20F58, // ADDSD xmm1, xmm2/mem64 F2 0F 58 /r
ADDPS = 0x000F58, // ADDPS xmm1, xmm2/mem128 0F 58 /r
ADDPD = 0x660F58, // ADDPD xmm1, xmm2/mem128 66 0F 58 /r
PADDB = 0x660FFC, // PADDB xmm1, xmm2/mem128 66 0F FC /r
PADDW = 0x660FFD, // PADDW xmm1, xmm2/mem128 66 0F FD /r
PADDD = 0x660FFE, // PADDD xmm1, xmm2/mem128 66 0F FE /r
PADDQ = 0x660FD4, // PADDQ xmm1, xmm2/mem128 66 0F D4 /r
SUBSS = 0xF30F5C, // SUBSS xmm1, xmm2/mem32 F3 0F 5C /r
SUBSD = 0xF20F5C, // SUBSD xmm1, xmm2/mem64 F2 0F 5C /r
SUBPS = 0x000F5C, // SUBPS xmm1, xmm2/mem128 0F 5C /r
SUBPD = 0x660F5C, // SUBPD xmm1, xmm2/mem128 66 0F 5C /r
PSUBB = 0x660FF8, // PSUBB xmm1, xmm2/mem128 66 0F F8 /r
PSUBW = 0x660FF9, // PSUBW xmm1, xmm2/mem128 66 0F F9 /r
PSUBD = 0x660FFA, // PSUBD xmm1, xmm2/mem128 66 0F FA /r
PSUBQ = 0x660FFB, // PSUBQ xmm1, xmm2/mem128 66 0F FB /r
MULSS = 0xF30F59, // MULSS xmm1, xmm2/mem32 F3 0F 59 /r
MULSD = 0xF20F59, // MULSD xmm1, xmm2/mem64 F2 0F 59 /r
MULPS = 0x000F59, // MULPS xmm1, xmm2/mem128 0F 59 /r
MULPD = 0x660F59, // MULPD xmm1, xmm2/mem128 66 0F 59 /r
PMULLW = 0x660FD5, // PMULLW xmm1, xmm2/mem128 66 0F D5 /r
DIVSS = 0xF30F5E, // DIVSS xmm1, xmm2/mem32 F3 0F 5E /r
DIVSD = 0xF20F5E, // DIVSD xmm1, xmm2/mem64 F2 0F 5E /r
DIVPS = 0x000F5E, // DIVPS xmm1, xmm2mem/128 0F 5E /r
DIVPD = 0x660F5E, // DIVPD xmm1, xmm2/mem128 66 0F 5E /r
PAND = 0x660FDB, // PAND xmm1, xmm2/mem128 66 0F DB /r
POR = 0x660FEB, // POR xmm1, xmm2/mem128 66 0F EB /r
UCOMISS = 0x000F2E, // UCOMISS xmm1, xmm2/mem32 0F 2E /r
UCOMISD = 0x660F2E, // UCOMISD xmm1, xmm2/mem64 66 0F 2E /r
XORPS = 0x000F57, // XORPS xmm1, xmm2/mem128 0F 57 /r
XORPD = 0x660F57, // XORPD xmm1, xmm2/mem128 66 0F 57 /r
// Use STO and LOD instead of MOV to distinguish the direction
STOSS = 0xF30F11, // MOVSS xmm1/mem32, xmm2 F3 0F 11 /r
STOSD = 0xF20F11, // MOVSD xmm1/mem64, xmm2 F2 0F 11 /r
STOAPS = 0x000F29, // MOVAPS xmm1/mem128, xmm2 0F 29 /r
STOAPD = 0x660F29, // MOVAPD xmm1/mem128, xmm2 66 0F 29 /r
STODQA = 0x660F7F, // MOVDQA xmm1/mem128, xmm2 66 0F 7F /r
STOD = 0x660F7E, // MOVD reg/mem64, xmm 66 0F 7E /r
STOQ = 0x660FD6, // MOVQ xmm1/mem64, xmm2 66 0F D6 /
LODSS = 0xF30F10, // MOVSS xmm1, xmm2/mem32 F3 0F 10 /r
LODSD = 0xF20F10, // MOVSD xmm1, xmm2/mem64 F2 0F 10 /r
LODAPS = 0x000F28, // MOVAPS xmm1, xmm2/mem128 0F 28 /r
LODAPD = 0x660F28, // MOVAPD xmm1, xmm2/mem128 66 0F 28 /r
LODDQA = 0x660F6F, // MOVDQA xmm1, xmm2/mem128 66 0F 6F /r
LODD = 0x660F6E, // MOVD xmm, reg/mem64 66 0F 6E /r
LODQ = 0xF30F7E, // MOVQ xmm1, xmm2/mem64 F3 0F 7E /r
LODDQU = 0xF30F6F, // MOVDQU xmm1, xmm2/mem128 F3 0F 6F /r
STODQU = 0xF30F7F, // MOVDQU xmm1/mem128, xmm2 F3 0F 7F /r
MOVDQ2Q = 0xF20FD6, // MOVDQ2Q mmx, xmm F2 0F D6 /r
MOVHLPS = 0x0F12, // MOVHLPS xmm1, xmm2 0F 12 /r
LODHPD = 0x660F16, // MOVHPD xmm, mem64 66 0F 16 /r
STOHPD = 0x660F17, // MOVHPD mem64, xmm 66 0F 17 /r
LODHPS = 0x0F16, // MOVHPS xmm, mem64 0F 16 /r
STOHPS = 0x0F17, // MOVHPS mem64, xmm 0F 17 /r
MOVLHPS = 0x0F16, // MOVLHPS xmm1, xmm2 0F 16 /r
LODLPD = 0x660F12, // MOVLPD xmm, mem64 66 0F 12 /r
STOLPD = 0x660F13, // MOVLPD mem64, xmm 66 0F 13 /r
LODLPS = 0x0F12, // MOVLPS xmm, mem64 0F 12 /r
STOLPS = 0x0F13, // MOVLPS mem64, xmm 0F 13 /r
MOVMSKPD = 0x660F50, // MOVMSKPD reg32, xmm 66 0F 50 /r
MOVMSKPS = 0x0F50, // MOVMSKPS reg32, xmm 0F 50 /r
MOVNTDQ = 0x660FE7, // MOVNTDQ mem128, xmm 66 0F E7 /r
MOVNTI = 0x0FC3, // MOVNTI m32,r32 0F C3 /r
// MOVNTI m64,r64 0F C3 /r
MOVNTPD = 0x660F2B, // MOVNTPD mem128, xmm 66 0F 2B /r
MOVNTPS = 0x0F2B, // MOVNTPS mem128, xmm 0F 2B /r
MOVNTQ = 0x0FE7, // MOVNTQ m64, mmx 0F E7 /r
MOVQ2DQ = 0xF30FD6, // MOVQ2DQ xmm, mmx F3 0F D6 /r
LODUPD = 0x660F10, // MOVUPD xmm1, xmm2/mem128 66 0F 10 /r
STOUPD = 0x660F11, // MOVUPD xmm1/mem128, xmm2 66 0F 11 /r
LODUPS = 0x0F10, // MOVUPS xmm1, xmm2/mem128 0F 10 /r
STOUPS = 0x0F11, // MOVUPS xmm1/mem128, xmm2 0F 11 /r
PACKSSDW = 0x660F6B, // PACKSSDW xmm1, xmm2/mem128 66 0F 6B /r
PACKSSWB = 0x660F63, // PACKSSWB xmm1, xmm2/mem128 66 0F 63 /r
PACKUSWB = 0x660F67, // PACKUSWB xmm1, xmm2/mem128 66 0F 67 /r
PADDSB = 0x660FEC, // PADDSB xmm1, xmm2/mem128 66 0F EC /r
PADDSW = 0x660FED, // PADDSW xmm1, xmm2/mem128 66 0F ED /r
PADDUSB = 0x660FDC, // PADDUSB xmm1, xmm2/mem128 66 0F DC /r
PADDUSW = 0x660FDD, // PADDUSW xmm1, xmm2/mem128 66 0F DD /r
PANDN = 0x660FDF, // PANDN xmm1, xmm2/mem128 66 0F DF /r
PCMPEQB = 0x660F74, // PCMPEQB xmm1, xmm2/mem128 66 0F 74 /r
PCMPEQD = 0x660F76, // PCMPEQD xmm1, xmm2/mem128 66 0F 76 /r
PCMPEQW = 0x660F75, // PCMPEQW xmm1, xmm2/mem128 66 0F 75 /r
PCMPGTB = 0x660F64, // PCMPGTB xmm1, xmm2/mem128 66 0F 64 /r
PCMPGTD = 0x660F66, // PCMPGTD xmm1, xmm2/mem128 66 0F 66 /r
PCMPGTW = 0x660F65, // PCMPGTW xmm1, xmm2/mem128 66 0F 65 /r
PMADDWD = 0x660FF5, // PMADDWD xmm1, xmm2/mem128 66 0F F5 /r
PSLLW = 0x660FF1, // PSLLW xmm1, xmm2/mem128 66 0F F1 /r
// PSLLW xmm, imm8 66 0F 71 /6 ib
PSLLD = 0x660FF2, // PSLLD xmm1, xmm2/mem128 66 0F F2 /r
// PSLLD xmm, imm8 66 0F 72 /6 ib
PSLLQ = 0x660FF3, // PSLLQ xmm1, xmm2/mem128 66 0F F3 /r
// PSLLQ xmm, imm8 66 0F 73 /6 ib
PSRAW = 0x660FE1, // PSRAW xmm1, xmm2/mem128 66 0F E1 /r
// PSRAW xmm, imm8 66 0F 71 /4 ib
PSRAD = 0x660FE2, // PSRAD xmm1, xmm2/mem128 66 0F E2 /r
// PSRAD xmm, imm8 66 0F 72 /4 ib
PSRLW = 0x660FD1, // PSRLW xmm1, xmm2/mem128 66 0F D1 /r
// PSRLW xmm, imm8 66 0F 71 /2 ib
PSRLD = 0x660FD2, // PSRLD xmm1, xmm2/mem128 66 0F D2 /r
// PSRLD xmm, imm8 66 0F 72 /2 ib
PSRLQ = 0x660FD3, // PSRLQ xmm1, xmm2/mem128 66 0F D3 /r
// PSRLQ xmm, imm8 66 0F 73 /2 ib
PSUBSB = 0x660FE8, // PSUBSB xmm1, xmm2/mem128 66 0F E8 /r
PSUBSW = 0x660FE9, // PSUBSW xmm1, xmm2/mem128 66 0F E9 /r
PSUBUSB = 0x660FD8, // PSUBUSB xmm1, xmm2/mem128 66 0F D8 /r
PSUBUSW = 0x660FD9, // PSUBUSW xmm1, xmm2/mem128 66 0F D9 /r
PUNPCKHBW = 0x660F68, // PUNPCKHBW xmm1, xmm2/mem128 66 0F 68 /r
PUNPCKHDQ = 0x660F6A, // PUNPCKHDQ xmm1, xmm2/mem128 66 0F 6A /r
PUNPCKHWD = 0x660F69, // PUNPCKHWD xmm1, xmm2/mem128 66 0F 69 /r
PUNPCKLBW = 0x660F60, // PUNPCKLBW xmm1, xmm2/mem128 66 0F 60 /r
PUNPCKLDQ = 0x660F62, // PUNPCKLDQ xmm1, xmm2/mem128 66 0F 62 /r
PUNPCKLWD = 0x660F61, // PUNPCKLWD xmm1, xmm2/mem128 66 0F 61 /r
PXOR = 0x660FEF, // PXOR xmm1, xmm2/mem128 66 0F EF /r
ANDPD = 0x660F54, // ANDPD xmm1, xmm2/mem128 66 0F 54 /r
ANDPS = 0x0F54, // ANDPS xmm1, xmm2/mem128 0F 54 /r
ANDNPD = 0x660F55, // ANDNPD xmm1, xmm2/mem128 66 0F 55 /r
ANDNPS = 0x0F55, // ANDNPS xmm1, xmm2/mem128 0F 55 /r
CMPPS = 0x0FC2, // CMPPS xmm1, xmm2/mem128, imm8 0F C2 /r ib
CMPPD = 0x660FC2, // CMPPD xmm1, xmm2/mem128, imm8 66 0F C2 /r ib
CMPSD = 0xF20FC2, // CMPSD xmm1, xmm2/mem64, imm8 F2 0F C2 /r ib
CMPSS = 0xF30FC2, // CMPSS xmm1, xmm2/mem32, imm8 F3 0F C2 /r ib
COMISD = 0x660F2F, // COMISD xmm1, xmm2/mem64 66 0F 2F /r
COMISS = 0x0F2F, // COMISS xmm1, xmm2/mem32 0F 2F /r
CVTDQ2PD = 0xF30FE6, // CVTDQ2PD xmm1, xmm2/mem64 F3 0F E6 /r
CVTDQ2PS = 0x0F5B, // CVTDQ2PS xmm1, xmm2/mem128 0F 5B /r
CVTPD2DQ = 0xF20FE6, // CVTPD2DQ xmm1, xmm2/mem128 F2 0F E6 /r
CVTPD2PI = 0x660F2D, // CVTPD2PI mmx, xmm2/mem128 66 0F 2D /r
CVTPD2PS = 0x660F5A, // CVTPD2PS xmm1, xmm2/mem128 66 0F 5A /r
CVTPI2PD = 0x660F2A, // CVTPI2PD xmm, mmx/mem64 66 0F 2A /r
CVTPI2PS = 0x0F2A, // CVTPI2PS xmm, mmx/mem64 0F 2A /r
CVTPS2DQ = 0x660F5B, // CVTPS2DQ xmm1, xmm2/mem128 66 0F 5B /r
CVTPS2PD = 0x0F5A, // CVTPS2PD xmm1, xmm2/mem64 0F 5A /r
CVTPS2PI = 0x0F2D, // CVTPS2PI mmx, xmm/mem64 0F 2D /r
CVTSD2SI = 0xF20F2D, // CVTSD2SI reg32, xmm/mem64 F2 0F 2D /r
// CVTSD2SI reg64, xmm/mem64 F2 0F 2D /r
CVTSD2SS = 0xF20F5A, // CVTSD2SS xmm1, xmm2/mem64 F2 0F 5A /r
CVTSI2SD = 0xF20F2A, // CVTSI2SD xmm, reg/mem32 F2 0F 2A /r
// CVTSI2SD xmm, reg/mem64 F2 0F 2A /r
CVTSI2SS = 0xF30F2A, // CVTSI2SS xmm, reg/mem32 F3 0F 2A /r
// CVTSI2SS xmm, reg/mem64 F3 0F 2A /r
CVTSS2SD = 0xF30F5A, // CVTSS2SD xmm1, xmm2/mem32 F3 0F 5A /r
CVTSS2SI = 0xF30F2D, // CVTSS2SI reg32, xmm2/mem32 F3 0F 2D /r
// CVTSS2SI reg64, xmm2/mem32 F3 0F 2D /r
CVTTPD2PI = 0x660F2C, // CVTPD2PI mmx, xmm/mem128 66 0F 2C /r
CVTTPD2DQ = 0x660FE6, // CVTTPD2DQ xmm1, xmm2/mem128 66 0F E6 /r
CVTTPS2DQ = 0xF30F5B, // CVTTPS2DQ xmm1, xmm2/mem128 F3 0F 5B /r
CVTTPS2PI = 0x0F2C, // CVTTPS2PI mmx xmm/mem64 0F 2C /r
CVTTSD2SI = 0xF20F2C, // CVTTSD2SI reg32, xmm/mem64 F2 0F 2C /r
// CVTTSD2SI reg64, xmm/mem64 F2 0F 2C /r
CVTTSS2SI = 0xF30F2C, // CVTTSS2SI reg32, xmm/mem32 F3 0F 2C /r
// CVTTSS2SI reg64, xmm/mem32 F3 0F 2C /r
MASKMOVDQU = 0x660FF7, // MASKMOVDQU xmm1, xmm2 66 0F F7 /r
MASKMOVQ = 0x0FF7, // MASKMOVQ mm1,mm2 0F F7 /r
MAXPD = 0x660F5F, // MAXPD xmm1, xmm2/mem128 66 0F 5F /r
MAXPS = 0x0F5F, // MAXPS xmm1, xmm2/mem128 0F 5F /r
MAXSD = 0xF20F5F, // MAXSD xmm1, xmm2/mem64 F2 0F 5F /r
MAXSS = 0xF30F5F, // MAXSS xmm1, xmm2/mem32 F3 0F 5F /r
MINPD = 0x660F5D, // MINPD xmm1, xmm2/mem128 66 0F 5D /r
MINPS = 0x0F5D, // MINPS xmm1, xmm2/mem128 0F 5D /r
MINSD = 0xF20F5D, // MINSD xmm1, xmm2/mem64 F2 0F 5D /r
MINSS = 0xF30F5D, // MINSS xmm1, xmm2/mem32 F3 0F 5D /r
ORPD = 0x660F56, // ORPD xmm1, xmm2/mem128 66 0F 56 /r
ORPS = 0x0F56, // ORPS xmm1, xmm2/mem128 0F 56 /r
PAVGB = 0x660FE0, // PAVGB xmm1, xmm2/mem128 66 0F E0 /r
PAVGW = 0x660FE3, // PAVGW xmm1, xmm2/mem128 66 0F E3 /r
PMAXSW = 0x660FEE, // PMAXSW xmm1, xmm2/mem128 66 0F EE /
PINSRW = 0x660FC4, // PINSRW xmm, reg32/mem16, imm8 66 0F C4 /r ib
PMAXUB = 0x660FDE, // PMAXUB xmm1, xmm2/mem128 66 0F DE /r
PMINSW = 0x660FEA, // PMINSW xmm1, xmm2/mem128 66 0F EA /r
PMINUB = 0x660FDA, // PMINUB xmm1, xmm2/mem128 66 0F DA /r
PMOVMSKB = 0x660FD7, // PMOVMSKB reg32, xmm 66 0F D7 /r
PMULHUW = 0x660FE4, // PMULHUW xmm1, xmm2/mem128 66 0F E4 /r
PMULHW = 0x660FE5, // PMULHW xmm1, xmm2/mem128 66 0F E5 /
PMULUDQ = 0x660FF4, // PMULUDQ xmm1, xmm2/mem128 66 0F F4 /r
PSADBW = 0x660FF6, // PSADBW xmm1, xmm2/mem128 66 0F F6 /r
PUNPCKHQDQ = 0x660F6D, // PUNPCKHQDQ xmm1, xmm2/mem128 66 0F 6D /r
PUNPCKLQDQ = 0x660F6C, // PUNPCKLQDQ xmm1, xmm2/mem128 66 0F 6C /r
RCPPS = 0x0F53, // RCPPS xmm1, xmm2/mem128 0F 53 /r
RCPSS = 0xF30F53, // RCPSS xmm1, xmm2/mem32 F3 0F 53 /r
RSQRTPS = 0x0F52, // RSQRTPS xmm1, xmm2/mem128 0F 52 /r
RSQRTSS = 0xF30F52, // RSQRTSS xmm1, xmm2/mem32 F3 0F 52 /r
SQRTPD = 0x660F51, // SQRTPD xmm1, xmm2/mem128 66 0F 51 /r
SHUFPD = 0x660FC6, // SHUFPD xmm1, xmm2/mem128, imm8 66 0F C6 /r ib
SHUFPS = 0x0FC6, // SHUFPS xmm1, xmm2/mem128, imm8 0F C6 /r ib
SQRTPS = 0x0F51, // SQRTPS xmm1, xmm2/mem128 0F 51 /r
SQRTSD = 0xF20F51, // SQRTSD xmm1, xmm2/mem64 F2 0F 51 /r
SQRTSS = 0xF30F51, // SQRTSS xmm1, xmm2/mem32 F3 0F 51 /r
UNPCKHPD = 0x660F15, // UNPCKHPD xmm1, xmm2/mem12866 0F 15 /r
UNPCKHPS = 0x0F15, // UNPCKHPS xmm1, xmm2/mem1280F 15 /r
UNPCKLPD = 0x660F14, // UNPCKLPD xmm1, xmm2/mem128 66 0F 14 /r
UNPCKLPS = 0x0F14, // UNPCKLPS xmm1, xmm2/mem1280F 14 /r
PSHUFD = 0x660F70, // PSHUFD xmm1, xmm2/mem128, imm8 66 0F 70 /r ib
PSHUFHW = 0xF30F70, // PSHUFHW xmm1, xmm2/mem128, imm8 F3 0F 70 /r ib
PSHUFLW = 0xF20F70, // PSHUFLW xmm1, xmm2/mem128, imm8 F2 0F 70 /r ib
PSHUFW = 0x0F70, // PSHUFW mm1, mm2/mem64, imm8 0F 70 /r ib
PSLLDQ = 0x07660F73, // PSLLDQ xmm, imm8 66 0F 73 /7 ib
PSRLDQ = 0x03660F73, // PSRLDQ xmm, imm8 66 0F 73 /3 ib
PREFETCH = 0x0F18,
PEXTRW = 0x660FC5, // PEXTRW reg32, xmm, imm8 66 0F C5 /r ib
STMXCSR = 0x0FAE, // STMXCSR mem32 0F AE /3
// SSE3 Pentium 4 (Prescott)
ADDSUBPD = 0x660FD0, // ADDSUBPD xmm1, xmm2/m128
ADDSUBPS = 0xF20FD0,
HADDPD = 0x660F7C,
HADDPS = 0xF20F7C,
HSUBPD = 0x660F7D,
HSUBPS = 0xF20F7D,
MOVDDUP = 0xF20F12,
MOVSHDUP = 0xF30F16,
MOVSLDUP = 0xF30F12,
LDDQU = 0xF20FF0,
MONITOR = 0x0F01C8,
MWAIT = 0x0F01C9,
// SSSE3
PALIGNR = 0x660F3A0F,
PHADDD = 0x660F3802,
PHADDW = 0x660F3801,
PHADDSW = 0x660F3803,
PABSB = 0x660F381C,
PABSD = 0x660F381E,
PABSW = 0x660F381D,
PSIGNB = 0x660F3808,
PSIGND = 0x660F380A,
PSIGNW = 0x660F3809,
PSHUFB = 0x660F3800,
PMADDUBSW = 0x660F3804,
PMULHRSW = 0x660F380B,
PHSUBD = 0x660F3806,
PHSUBW = 0x660F3805,
PHSUBSW = 0x660F3807,
// SSE4.1
// See Intel SSE4 Programming Reference
BLENDPD = 0x660F3A0D, // 66 0F 3A 0D /r ib BLENDPD xmm1, xmm2/m128, imm8
BLENDPS = 0x660F3A0C, // 66 0F 3A 0C /r ib BLENDPS xmm1, xmm2/m128, imm8
BLENDVPD = 0x660F3815, // 66 0F 38 15 /r BLENDVPD xmm1, xmm2/m128, <XMM0>
BLENDVPS = 0x660F3814, // 66 0F 38 14 /r BLENDVPS xmm1, xmm2/m128, <XMM0>
DPPD = 0x660F3A41,
DPPS = 0x660F3A40,
EXTRACTPS = 0x660F3A17,
INSERTPS = 0x660F3A21,
MPSADBW = 0x660F3A42,
PBLENDVB = 0x660F3810,
PBLENDW = 0x660F3A0E,
PEXTRD = 0x660F3A16,
PEXTRQ = 0x660F3A16,
PINSRB = 0x660F3A20, // 66 0F 3A 20 /r ib PINSRB xmm1, r32/m8, imm8
PINSRD = 0x660F3A22,
PINSRQ = 0x660F3A22,
MOVNTDQA = 0x660F382A,
PACKUSDW = 0x660F382B,
PCMPEQQ = 0x660F3829,
PEXTRB = 0x660F3A14, // 66 0F 3A 14 /r ib PEXTRB r32/m8, xmm2, imm8
// 66 REX.W 0F 3A 14 /r ib PEXTRB r64/m8, xmm2, imm8
PHMINPOSUW = 0x660F3841, // 66 0F 38 41 /r PHMINPOSUW xmm1, xmm2/m128
PMAXSB = 0x660F383C,
PMAXSD = 0x660F383D,
PMAXUD = 0x660F383F,
PMAXUW = 0x660F383E,
PMINSB = 0x660F3838,
PMINSD = 0x660F3839,
PMINUD = 0x660F383B,
PMINUW = 0x660F383A,
PMOVSXBW = 0x660F3820,
PMOVSXBD = 0x660F3821,
PMOVSXBQ = 0x660F3822,
PMOVSXWD = 0x660F3823,
PMOVSXWQ = 0x660F3824,
PMOVSXDQ = 0x660F3825,
PMOVZXBW = 0x660F3830,
PMOVZXBD = 0x660F3831,
PMOVZXBQ = 0x660F3832,
PMOVZXWD = 0x660F3833,
PMOVZXWQ = 0x660F3834,
PMOVZXDQ = 0x660F3835,
PMULDQ = 0x660F3828,
PMULLD = 0x660F3840,
PTEST = 0x660F3817, // 66 0F 38 17 /r PTEST xmm1, xmm2/m128
ROUNDPD = 0x660F3A09, // 66 0F 3A 09 /r ib ROUNDPD xmm1, xmm2/m128, imm8
ROUNDPS = 0x660F3A08,
ROUNDSD = 0x660F3A0B,
ROUNDSS = 0x660F3A0A,
// SSE4.2
PCMPESTRI = 0x660F3A61,
PCMPESTRM = 0x660F3A60,
PCMPISTRI = 0x660F3A63,
PCMPISTRM = 0x660F3A62,
PCMPGTQ = 0x660F3837,
// CRC32
// SSE4a (AMD only)
// EXTRQ,INSERTQ,MOVNTSD,MOVNTSS
// POPCNT and LZCNT (have their own CPUID bits)
POPCNT = 0xF30FB8,
// LZCNT
// AVX
XGETBV = 0x0F01D0,
XSETBV = 0x0F01D1,
VBROADCASTSS = 0x660F3818,
VBROADCASTSD = 0x660F3819,
VBROADCASTF128 = 0x660F381A,
VINSERTF128 = 0x660F3A18,
// AVX2
VPBROADCASTB = 0x660F3878,
VPBROADCASTW = 0x660F3879,
VPBROADCASTD = 0x660F3858,
VPBROADCASTQ = 0x660F3859,
VBROADCASTI128 = 0x660F385A,
VINSERTI128 = 0x660F3A38,
// AES
AESENC = 0x660F38DC,
AESENCLAST = 0x660F38DD,
AESDEC = 0x660F38DE,
AESDECLAST = 0x660F38DF,
AESIMC = 0x660F38DB,
AESKEYGENASSIST = 0x660F3ADF,
}
| D |
/Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/KituraNet.build/Server/ServerMonitor.swift.o : /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGI.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTP.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ClientResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIRecordCreate.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerDelegate.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/KeepAliveState.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerState.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ListenerGroup.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ConnectionUpgrader.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketManager.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketHandler.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerLifecycleListener.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HeadersContainer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/URLParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/HTTPParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIRecordParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/Server.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Error.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/IncomingHTTPSocketProcessor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketProcessor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketProcessorCreator.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerMonitor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/SPIUtils.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/ParseResults.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/HTTPParserStatus.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ClientRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/BufferList.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ConnectionUpgradeFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/LoggerAPI.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/SSLService.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/Socket.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/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/CHTTPParser.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/http_parser.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/utils.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/module.modulemap /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CCurl/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/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/KituraNet.build/ServerMonitor~partial.swiftmodule : /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGI.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTP.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ClientResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIRecordCreate.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerDelegate.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/KeepAliveState.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerState.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ListenerGroup.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ConnectionUpgrader.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketManager.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketHandler.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerLifecycleListener.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HeadersContainer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/URLParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/HTTPParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIRecordParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/Server.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Error.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/IncomingHTTPSocketProcessor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketProcessor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketProcessorCreator.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerMonitor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/SPIUtils.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/ParseResults.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/HTTPParserStatus.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ClientRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/BufferList.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ConnectionUpgradeFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/LoggerAPI.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/SSLService.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/Socket.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/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/CHTTPParser.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/http_parser.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/utils.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/module.modulemap /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CCurl/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/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/KituraNet.build/ServerMonitor~partial.swiftdoc : /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGI.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTP.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServerResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ClientResponse.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIRecordCreate.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerDelegate.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/KeepAliveState.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerState.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ListenerGroup.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ConnectionUpgrader.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketManager.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketHandler.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerLifecycleListener.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HeadersContainer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/URLParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/HTTPParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIRecordParser.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/Server.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServer.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Error.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/IncomingHTTPSocketProcessor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketProcessor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/IncomingSocketProcessorCreator.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/Server/ServerMonitor.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/SPIUtils.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/ParseResults.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTPParser/HTTPParserStatus.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/FastCGI/FastCGIServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/HTTP/HTTPServerRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ClientRequest.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/BufferList.swift /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/KituraNet/ConnectionUpgradeFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/LoggerAPI.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/SSLService.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/Socket.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/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/CHTTPParser.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/http_parser.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CHTTPParser/include/utils.h /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/module.modulemap /Users/pavlosnicolaou/Documents/workshop/Kitura/KituraWebInterface/KituraWebInterface_Starter/.build/checkouts/Kitura-net.git-6847998409280116426/Sources/CCurl/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 |
/Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/DerivedData/Notes/Build/Intermediates/Notes.build/Debug-iphonesimulator/Notes.build/Objects-normal/x86_64/AppDelegate.o : /Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/Notes/AppDelegate.swift /Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/NotesTableViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule
/Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/DerivedData/Notes/Build/Intermediates/Notes.build/Debug-iphonesimulator/Notes.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule : /Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/Notes/AppDelegate.swift /Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/NotesTableViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule
/Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/DerivedData/Notes/Build/Intermediates/Notes.build/Debug-iphonesimulator/Notes.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc : /Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/Notes/AppDelegate.swift /Users/tangzekun/Dropbox/CIS/CIS399/SimpleNotes/Notes/NotesTableViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule
| D |
module android.java.java.util.Base64_Decoder_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import1 = android.java.java.io.InputStream_d_interface;
import import2 = android.java.java.lang.Class_d_interface;
import import0 = android.java.java.nio.ByteBuffer_d_interface;
@JavaName("Base64$Decoder")
final class Base64_Decoder : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import byte[] decode(byte[]);
@Import byte[] decode(string);
@Import int decode(byte, byte[][]);
@Import import0.ByteBuffer decode(import0.ByteBuffer);
@Import import1.InputStream wrap(import1.InputStream);
@Import import2.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import void notify();
@Import void notifyAll();
@Import void wait(long);
@Import void wait(long, int);
@Import void wait();
mixin IJavaObjectImplementation!(false);
public static immutable string _javaParameterString = "Ljava/util/Base64$Decoder;";
}
| D |
module mach.sdl;
public:
import mach.sdl.application;
import mach.sdl.audio;
import mach.sdl.error;
import mach.sdl.framelimiter;
import mach.sdl.glenum;
import mach.sdl.gldebug;
import mach.sdl.graphics;
import mach.sdl.haptic;
import mach.sdl.input;
import mach.sdl.init;
import mach.sdl.window;
| D |
module UnrealScript.Engine.MusicTrackDataStructures;
import ScriptClasses;
import UnrealScript.Helpers;
import UnrealScript.Engine.SoundCue;
import UnrealScript.Core.UObject;
extern(C++) interface MusicTrackDataStructures : UObject
{
public extern(D):
private static __gshared ScriptClass mStaticClass;
@property final static ScriptClass StaticClass() { mixin(MGSCC("Class Engine.MusicTrackDataStructures")); }
private static __gshared MusicTrackDataStructures mDefaultProperties;
@property final static MusicTrackDataStructures DefaultProperties() { mixin(MGDPC("MusicTrackDataStructures", "MusicTrackDataStructures Engine.Default__MusicTrackDataStructures")); }
struct MusicTrackStruct
{
private ubyte __buffer__[36];
public extern(D):
private static __gshared ScriptStruct mStaticClass;
@property final static ScriptStruct StaticClass() { mixin(MGSCS("ScriptStruct Engine.MusicTrackDataStructures.MusicTrackStruct")); }
@property final
{
auto ref
{
ScriptString MP3Filename() { mixin(MGPS("ScriptString", 24)); }
float FadeOutVolumeLevel() { mixin(MGPS("float", 20)); }
float FadeOutTime() { mixin(MGPS("float", 16)); }
float FadeInVolumeLevel() { mixin(MGPS("float", 12)); }
float FadeInTime() { mixin(MGPS("float", 8)); }
SoundCue TheSoundCue() { mixin(MGPS("SoundCue", 0)); }
}
bool bPersistentAcrossLevels() { mixin(MGBPS(4, 0x2)); }
bool bPersistentAcrossLevels(bool val) { mixin(MSBPS(4, 0x2)); }
bool bAutoPlay() { mixin(MGBPS(4, 0x1)); }
bool bAutoPlay(bool val) { mixin(MSBPS(4, 0x1)); }
}
}
}
| D |
module xf.xpose.testb;
private {
import xf.xpose.Serialization;
import tango.io.Stdout;
import tango.text.convert.Sprint;
Sprint!(char) format;
static this() {
format = new Sprint!(char);
}
}
interface IShape {
float area();
char[] toString();
}
class Shape {
float area() { return 1.0f; }
//pragma(msg, expose!(SerializationExpose)(`area`));
mixin(expose!(SerializationExpose)(`area`));
}
//pragma(msg, expose_ext!(IShape,SerializationExpose)(`IShape.area`));
//mixin(expose_ext!(IShape,SerializationExpose)(`IShape.area`));
interface IPolygon : IShape {
int n_vertices();
}
class Square : IPolygon
{
float dx,dy;
this() {}
this(float w, float h) { dx = w; dy = h; }
override float area() {
return dx*dy;
}
override int n_vertices() {
return 4;
}
char[] toString() {
return format(`Square, dx='{}' dy='{}'`, dx, dy);
}
void writeDx(Serializer s) {
s(cast(int)(dx * 8));
}
void readDx(Unserializer s) {
int tmp;
s(tmp);
dx = (1.f / 8) * tmp;
}
void onUnserialized() {
Stdout.formatln("Square just got unserialized");
}
mixin(expose!(SerializationExpose)(`dx write=writeDx;read=readDx|dy`));
}
class Circle : IShape
{
float radius;
this() {}
this(float r) { radius = r; }
override float area() {
return 3.14*radius*radius;
}
char[] toString() {
return format(`Circle, radius='{}'`, radius);
}
mixin(expose!(SerializationExpose)(`radius`));
}
struct Shapes
{
IShape[] shapes;
char[] toString() {
char[] ret = `[`;
foreach(i,s; shapes) {
ret ~= s.toString;
ret ~= (i==shapes.length-1)? `]` : `, `;
}
return ret;
}
}
struct ShapesExport {
mixin(expose!(SerializationExpose)(`Shapes`, `shapes|virt read=vread; write=vwrite`));
static void vread(Shapes* obj, Unserializer s) {
Stdout.formatln("virtual read");
}
static void vwrite(Shapes* obj, Serializer s) {
Stdout.formatln("virtual write");
}
void onUnserialized(Shapes* sh) {
Stdout.formatln("Shapes just got unserialized");
}
}
void main() {
char[] stringified;
{
Shapes shapes;
shapes.shapes ~= new Square(0.5,2.0);
shapes.shapes ~= new Circle(1.0);
Stdout.formatln("Before: {}", shapes);
stringified = shapes.toString;
// serialize -----------------------------------------------------------------------
(new Serializer(`iface.dat`))(shapes).close;
}
{
// unserialize ---------------------------------------------------------------------
scope auto u = new Unserializer(`iface.dat`);
auto shapes = u.get!(Shapes);
Stdout.formatln("After: {}", shapes);
assert(shapes.toString == stringified);
}
Stdout.formatln("Terminating test");
}
| D |
/Users/brunodaluz/Desktop/project/Build/Intermediates/project.build/Debug/DatabaseKit.build/Objects-normal/x86_64/DatabaseKeyedCache.o : /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/Deprecated.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/KeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/DatabaseKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/DictionaryKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/MemoryKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPoolCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseStringFindable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseConnectable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseQueryable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/URL+DatabaseName.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/Database.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/ConfiguredDatabase.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseConfig.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPoolConfig.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/KeyedCacheSupporting.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/LogSupporting.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLog.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/Container+ConnectionPool.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPool.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/Container+CachedConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/Container+NewConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Service/DatabaseKitProvider.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLogger.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseIdentifier.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLogHandler.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/PrintLogHandler.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/DatabaseKitError.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/Databases.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/Exports.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOAtomics/include/cpp_magic.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIODarwin/include/c_nio_darwin.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOAtomics/include/c-atomics.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOLinux/include/c_nio_linux.h /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio-zlib-support.git-4597058737275259177/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/brunodaluz/Desktop/project/Build/Intermediates/project.build/Debug/DatabaseKit.build/Objects-normal/x86_64/DatabaseKeyedCache~partial.swiftmodule : /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/Deprecated.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/KeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/DatabaseKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/DictionaryKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/MemoryKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPoolCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseStringFindable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseConnectable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseQueryable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/URL+DatabaseName.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/Database.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/ConfiguredDatabase.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseConfig.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPoolConfig.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/KeyedCacheSupporting.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/LogSupporting.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLog.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/Container+ConnectionPool.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPool.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/Container+CachedConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/Container+NewConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Service/DatabaseKitProvider.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLogger.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseIdentifier.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLogHandler.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/PrintLogHandler.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/DatabaseKitError.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/Databases.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/Exports.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOAtomics/include/cpp_magic.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIODarwin/include/c_nio_darwin.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOAtomics/include/c-atomics.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOLinux/include/c_nio_linux.h /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio-zlib-support.git-4597058737275259177/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/brunodaluz/Desktop/project/Build/Intermediates/project.build/Debug/DatabaseKit.build/Objects-normal/x86_64/DatabaseKeyedCache~partial.swiftdoc : /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/Deprecated.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/KeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/DatabaseKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/DictionaryKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/MemoryKeyedCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPoolCache.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseStringFindable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseConnectable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseQueryable.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/URL+DatabaseName.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/Database.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/ConfiguredDatabase.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseConfig.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPoolConfig.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/KeyedCache/KeyedCacheSupporting.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/LogSupporting.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLog.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/Container+ConnectionPool.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/ConnectionPool/DatabaseConnectionPool.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/Container+CachedConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/DatabaseConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Connection/Container+NewConnection.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Service/DatabaseKitProvider.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLogger.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/DatabaseIdentifier.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/DatabaseLogHandler.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Log/PrintLogHandler.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/DatabaseKitError.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Database/Databases.swift /Users/brunodaluz/Desktop/project/.build/checkouts/database-kit.git--8359960696545479939/Sources/DatabaseKit/Utilities/Exports.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/brunodaluz/Desktop/project/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOAtomics/include/cpp_magic.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIODarwin/include/c_nio_darwin.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOAtomics/include/c-atomics.h /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio.git--325538877768392360/Sources/CNIOLinux/include/c_nio_linux.h /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/brunodaluz/Desktop/project/.build/checkouts/swift-nio-zlib-support.git-4597058737275259177/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/brunodaluz/Desktop/project/project.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
| D |
/*******************************************************************************
copyright: Copyright (c) 2004 Kris Bell. все rights reserved
license: BSD стиль: $(LICENSE)
version: Oct 2004: Initial release
Dec 2006: Outback release
author: Kris
*******************************************************************************/
module io.protocol.Writer;
private import io.Buffer;
public import io.model;
public import io.protocol.model;
/*******************************************************************************
Писатель основа-class. Writers provопрe the means в_ добавь formatted
данные в_ an ИБуфер, и expose a convenient метод of handling a
variety of данные типы. In добавьition в_ writing исконный типы such
as целое и ткст, writers also process any class which имеется
implemented the ИЗаписываемое interface (one метод).
все writers support the full установи of исконный данные типы, plus their
fundamental Массив variants. Operations may be chained back-в_-back.
Writers support a Java-esque помести() notation. However, the Dinrus стиль
is в_ place IO элементы внутри their own parenthesis, like so:
---
пиши (счёт) (" green bottles");
---
Note that each записано элемент is distict; this стиль is affectionately
known as "whisper". The код below illustrates basic operation upon a
память буфер:
---
auto буф = new Буфер (256);
// карта same буфер преобр_в Всё читатель и писатель
auto читай = new Читатель (буф);
auto пиши = new Писатель (буф);
цел i = 10;
дол j = 20;
дво d = 3.14159;
ткст c = "fred";
// пиши данные типы out
пиши (c) (i) (j) (d);
// читай them back again
читай (c) (i) (j) (d);
// same thing again, but using помести() syntax instead
пиши.помести(c).помести(i).помести(j).помести(d);
читай.получи(c).получи(i).получи(j).получи(d);
---
Writers may also be использован with any class implementing the ИЗаписываемое
interface, along with any struct implementing an equivalent function.
*******************************************************************************/
class Писатель : ИПисатель
{
// the буфер associated with this писатель. Note that this
// should not change over the lifetime of the читатель, since
// it is assumed в_ be immutable elsewhere
package ИБуфер buffer_;
package ИПротокол.ПисательМассива массивы;
package ИПротокол.Писатель элементы;
// конец of строка sequence
package ткст кс = ФайлКонст.НовСтрЗнак;
/***********************************************************************
Construct a Писатель on the provопрed Protocol
***********************************************************************/
this (ИПротокол протокол)
{
buffer_ = протокол.буфер;
элементы = &протокол.пиши;
массивы = &протокол.пишиМассив;
}
/***********************************************************************
Construct a Писатель on the given ИПотокВывода. We do our own
протокол handling, equivalent в_ the ПротоколНатив.
***********************************************************************/
this (ИПотокВывода поток)
{
auto b = cast(ИБуферированный) поток;
buffer_ = b ? b.буфер() : объБуфер(поток.провод);
массивы = &пишиМассив;
элементы = &пишиЭлемент;
}
/***********************************************************************
Return the associated буфер
***********************************************************************/
final ИБуфер буфер ()
{
return buffer_;
}
/***********************************************************************
Emit a нс
***********************************************************************/
ИПисатель нс ()
{
return помести (кс);
}
/***********************************************************************
установи the нс sequence
***********************************************************************/
ИПисатель нс (ткст кс)
{
this.кс = кс;
return this;
}
/***********************************************************************
Flush the вывод of this писатель и return a chaining ref
***********************************************************************/
final ИПисатель слей ()
{
buffer_.слей;
return this;
}
/***********************************************************************
Flush this писатель. This is a convenience метод использован by
the "whisper" syntax.
***********************************************************************/
final ИПисатель помести ()
{
return слей;
}
/***********************************************************************
Зап via a delegate в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (ИПисатель.Клозура дг)
{
дг (this);
return this;
}
/***********************************************************************
Зап a class в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (ИЗаписываемое x)
{
if (x is пусто)
buffer_.ошибка ("Писатель.помести :: attempt в_ пиши a пусто ИЗаписываемое объект");
return помести (&x.пиши);
}
/***********************************************************************
Зап a булево значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бул x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Bool);
return this;
}
/***********************************************************************
Зап an unsigned байт значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (ббайт x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.UByte);
return this;
}
/***********************************************************************
Зап a байт значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (байт x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Byte);
return this;
}
/***********************************************************************
Зап an unsigned крат значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бкрат x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.UShort);
return this;
}
/***********************************************************************
Зап a крат значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (крат x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Short);
return this;
}
/***********************************************************************
Зап a unsigned цел значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бцел x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.UInt);
return this;
}
/***********************************************************************
Зап an цел значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (цел x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Int);
return this;
}
/***********************************************************************
Зап an unsigned дол значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бдол x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.ULong);
return this;
}
/***********************************************************************
Зап a дол значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (дол x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Long);
return this;
}
/***********************************************************************
Зап a плав значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (плав x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Float);
return this;
}
/***********************************************************************
Зап a дво значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (дво x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Double);
return this;
}
/***********************************************************************
Зап a реал значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (реал x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Real);
return this;
}
/***********************************************************************
Зап a сим значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (сим x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Utf8);
return this;
}
/***********************************************************************
Зап a шим значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (шим x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Utf16);
return this;
}
/***********************************************************************
Зап a дим значение в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (дим x)
{
элементы (&x, x.sizeof, ИПротокол.Тип.Utf32);
return this;
}
/***********************************************************************
Зап a булево Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бул[] x)
{
массивы (x.ptr, x.length * бул.sizeof, ИПротокол.Тип.Bool);
return this;
}
/***********************************************************************
Зап a байт Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (байт[] x)
{
массивы (x.ptr, x.length * байт.sizeof, ИПротокол.Тип.Byte);
return this;
}
/***********************************************************************
Зап an unsigned байт Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (ббайт[] x)
{
массивы (x.ptr, x.length * ббайт.sizeof, ИПротокол.Тип.UByte);
return this;
}
/***********************************************************************
Зап a крат Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (крат[] x)
{
массивы (x.ptr, x.length * крат.sizeof, ИПротокол.Тип.Short);
return this;
}
/***********************************************************************
Зап an unsigned крат Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бкрат[] x)
{
массивы (x.ptr, x.length * бкрат.sizeof, ИПротокол.Тип.UShort);
return this;
}
/***********************************************************************
Зап an цел Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (цел[] x)
{
массивы (x.ptr, x.length * цел.sizeof, ИПротокол.Тип.Int);
return this;
}
/***********************************************************************
Зап an unsigned цел Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бцел[] x)
{
массивы (x.ptr, x.length * бцел.sizeof, ИПротокол.Тип.UInt);
return this;
}
/***********************************************************************
Зап a дол Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (дол[] x)
{
массивы (x.ptr, x.length * дол.sizeof, ИПротокол.Тип.Long);
return this;
}
/***********************************************************************
Зап an unsigned дол Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (бдол[] x)
{
массивы (x.ptr, x.length * бдол.sizeof, ИПротокол.Тип.ULong);
return this;
}
/***********************************************************************
Зап a плав Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (плав[] x)
{
массивы (x.ptr, x.length * плав.sizeof, ИПротокол.Тип.Float);
return this;
}
/***********************************************************************
Зап a дво Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (дво[] x)
{
массивы (x.ptr, x.length * дво.sizeof, ИПротокол.Тип.Double);
return this;
}
/***********************************************************************
Зап a реал Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (реал[] x)
{
массивы (x.ptr, x.length * реал.sizeof, ИПротокол.Тип.Real);
return this;
}
/***********************************************************************
Зап a сим Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (ткст x)
{
массивы (x.ptr, x.length * сим.sizeof, ИПротокол.Тип.Utf8);
return this;
}
/***********************************************************************
Зап a шим Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (шим[] x)
{
массивы (x.ptr, x.length * шим.sizeof, ИПротокол.Тип.Utf16);
return this;
}
/***********************************************************************
Зап a дим Массив в_ the текущ буфер-позиция
***********************************************************************/
final ИПисатель помести (дим[] x)
{
массивы (x.ptr, x.length * дим.sizeof, ИПротокол.Тип.Utf32);
return this;
}
/***********************************************************************
Dump Массив контент преобр_в the буфер. Note that the default
behaviour is в_ префикс with the Массив байт счёт
***********************************************************************/
private проц пишиМассив (ук ист, бцел байты, ИПротокол.Тип тип)
{
помести (байты);
пишиЭлемент (ист, байты, тип);
}
/***********************************************************************
Dump контент преобр_в the буфер
***********************************************************************/
private проц пишиЭлемент (ук ист, бцел байты, ИПротокол.Тип тип)
{
buffer_.добавь (ист [0 .. байты]);
}
}
| D |
INSTANCE Info_Mod_Yasin_Hi (C_INFO)
{
npc = Mod_7111_ASS_Yasin_NW;
nr = 1;
condition = Info_Mod_Yasin_Hi_Condition;
information = Info_Mod_Yasin_Hi_Info;
permanent = 0;
important = 0;
description = "Und, alles fit?";
};
FUNC INT Info_Mod_Yasin_Hi_Condition()
{
return 1;
};
FUNC VOID Info_Mod_Yasin_Hi_Info()
{
AI_Output(hero, self, "Info_Mod_Yasin_Hi_15_00"); //Und, alles fit?
AI_Output(self, hero, "Info_Mod_Yasin_Hi_13_01"); //(wütend) Verschwinde gefälligst.
AI_Output(hero, self, "Info_Mod_Yasin_Hi_15_02"); //Hey, bleib locker. Ich wollte nur wissen, wie es dir geht.
AI_Output(self, hero, "Info_Mod_Yasin_Hi_13_03"); //(faucht) Toll, das siehst du doch. Was willst du denn?
AI_Output(hero, self, "Info_Mod_Yasin_Hi_15_04"); //Gehörst du zu den Gaunern hier?
AI_Output(self, hero, "Info_Mod_Yasin_Hi_13_05"); //(grummelt) Ja, mein Name ist Yasin. Aber vielleicht werde ich nicht mehr lange zu dieser Gemeinschaft gehören.
};
INSTANCE Info_Mod_Yasin_Aufgabe (C_INFO)
{
npc = Mod_7111_ASS_Yasin_NW;
nr = 1;
condition = Info_Mod_Yasin_Aufgabe_Condition;
information = Info_Mod_Yasin_Aufgabe_Info;
permanent = 0;
important = 0;
description = "Wieso das denn?";
};
FUNC INT Info_Mod_Yasin_Aufgabe_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Yasin_Hi))
&& (Npc_KnowsInfo(hero, Info_Mod_Shakir_GaunerWerden))
{
return 1;
};
};
FUNC VOID Info_Mod_Yasin_Aufgabe_Info()
{
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_00"); //Wieso das denn?
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_01"); //(wütend) Ich habe vor einiger Zeit krumme Geschäfte mit einigen der Stadtwachen dieser Stadt gemacht.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_02"); //Einem von diesen Kerlen haben meine Sachen nicht gefallen und er hat mich überall angeschwärzt.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_03"); //Ich musste aus der Stadt fliehen.
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_04"); //Was ist so schlimm daran?
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_05"); //(aufbrausend) Kannst du denn nicht logisch denken oder bist du so blöd?
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_06"); //Der Kerl hat mich verfolgt und hat gesehen, wie ich hier verschwunden bin.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_07"); //Er kennt unser Versteck und wenn wir Pech haben steht hier bald die Miliz auf der Matte.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_08"); //Unsere Anführere sind entsprechend begeistert.
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_09"); //Das ist nicht gut.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_10"); //(verärgert) Ja, das ist nicht gut. Du hast ja alles mitbekommen, also ist die Märchenstunde nun beendet. Kannst du nun gehen?
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_11"); //Kann ich dir bei deinem Problem helfen?
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_12"); //(argwöhnisch) So, wieso solltest du das tun?
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_13"); //Ich bin auf der Suche nach Stimmen, um mich euch anschließen zu können
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_14"); //(überlegt) Ein ehrenwertes Anliegen. Hm ...
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_15"); //Wenn du mir helfen kannst, dann werde ich dir meine Stimme sicherlich geben können.
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_16"); //Was soll ich tun?
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_17"); //Erledige diese schmierige Stadtwache für mich, wie es sich für einen wahren Assassinen gehört.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_18"); //Wenn du ihn tötest bin ich mein Problem los und du hast eine Stimme mehr.
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_19"); //Welche Stadtwache ist das genau?
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_20"); //Mika heißt der Mistkerl. Der steht Tag und Nacht vor dem Tor.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_21"); //Das dumme ist, dass immer einige Torwachen bei ihm stehen.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_22"); //Du musst ihn weglocken und ausschalten. Die Höhle mit dem Teleporter wäre der perfekte Ort dafür.
AI_Output(hero, self, "Info_Mod_Yasin_Aufgabe_15_23"); //Alles klar, der Kerl ist so gut wie erledigt.
AI_Output(self, hero, "Info_Mod_Yasin_Aufgabe_13_24"); //Beeil dich, sonst wird mich unser Rat sicher bald rauswerfen.
Log_CreateTopic (TOPIC_MOD_ASS_YASIN_MIKA, LOG_MISSION);
B_SetTopicStatus (TOPIC_MOD_ASS_YASIN_MIKA, LOG_RUNNING);
B_LogEntry (TOPIC_MOD_ASS_YASIN_MIKA, "Ich habe nun mit dem Gauner Yasin geredet. Dieser berichtete mir, dass Milizsoldat Mika vor der Stadt durch einen Fehler Yasins über das Versteck der Assassinen Bescheid weiß. Wenn Mika nicht bald erledigt ist, werden die Assassinen sicher von der Miliz angegriffen. Ich soll den Mistkerl für Yasin töten, und zwar, wenn es Nacht ist. Ich soll ihn dazu in die Höhle mit dem Teleporter locken und im Geheimen töten.");
};
INSTANCE Info_Mod_Yasin_MikaTot (C_INFO)
{
npc = Mod_7111_ASS_Yasin_NW;
nr = 1;
condition = Info_Mod_Yasin_MikaTot_Condition;
information = Info_Mod_Yasin_MikaTot_Info;
permanent = 0;
important = 0;
description = "Dieser Mika kann nichts mehr erzählen. Ich hab ihn erledigt.";
};
FUNC INT Info_Mod_Yasin_MikaTot_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Yasin_Aufgabe))
&& (Npc_IsDead(Mod_598_MIL_Mika_NW))
{
return 1;
};
};
FUNC VOID Info_Mod_Yasin_MikaTot_Info()
{
AI_Output(hero, self, "Info_Mod_Yasin_MikaTot_15_00"); //Dieser Mika kann nichts mehr erzählen. Ich hab ihn erledigt.
AI_Output(self, hero, "Info_Mod_Yasin_MikaTot_13_01"); //Sicher?
AI_Output(hero, self, "Info_Mod_Yasin_MikaTot_15_02"); //Glaubst du mir etwa nicht?
AI_Output(self, hero, "Info_Mod_Yasin_MikaTot_13_04"); //Doch, doch, natürlich. Jetzt bin ich aber beruhigt. Jemand wie dich kann man brauchen. Meine Stimme hast du.
B_GiveInvItems (self, hero, ItMi_Gold, 100);
B_SetTopicStatus (TOPIC_MOD_ASS_YASIN_MIKA, LOG_SUCCESS);
B_GivePlayerXP (150);
};
INSTANCE Info_Mod_Yasin_Pickpocket (C_INFO)
{
npc = Mod_7111_ASS_Yasin_NW;
nr = 1;
condition = Info_Mod_Yasin_Pickpocket_Condition;
information = Info_Mod_Yasin_Pickpocket_Info;
permanent = 1;
important = 0;
description = Pickpocket_90;
};
FUNC INT Info_Mod_Yasin_Pickpocket_Condition()
{
C_Beklauen (80, ItMi_Gold, 25);
};
FUNC VOID Info_Mod_Yasin_Pickpocket_Info()
{
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
Info_AddChoice (Info_Mod_Yasin_Pickpocket, DIALOG_BACK, Info_Mod_Yasin_Pickpocket_BACK);
Info_AddChoice (Info_Mod_Yasin_Pickpocket, DIALOG_PICKPOCKET, Info_Mod_Yasin_Pickpocket_DoIt);
};
FUNC VOID Info_Mod_Yasin_Pickpocket_BACK()
{
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
};
FUNC VOID Info_Mod_Yasin_Pickpocket_DoIt()
{
if (B_Beklauen() == TRUE)
{
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
}
else
{
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
Info_AddChoice (Info_Mod_Yasin_Pickpocket, DIALOG_PP_BESCHIMPFEN, Info_Mod_Yasin_Pickpocket_Beschimpfen);
Info_AddChoice (Info_Mod_Yasin_Pickpocket, DIALOG_PP_BESTECHUNG, Info_Mod_Yasin_Pickpocket_Bestechung);
Info_AddChoice (Info_Mod_Yasin_Pickpocket, DIALOG_PP_HERAUSREDEN, Info_Mod_Yasin_Pickpocket_Herausreden);
};
};
FUNC VOID Info_Mod_Yasin_Pickpocket_Beschimpfen()
{
B_Say (hero, self, "$PICKPOCKET_BESCHIMPFEN");
B_Say (self, hero, "$DIRTYTHIEF");
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_Theft, 1);
};
FUNC VOID Info_Mod_Yasin_Pickpocket_Bestechung()
{
B_Say (hero, self, "$PICKPOCKET_BESTECHUNG");
var int rnd; rnd = r_max(99);
if (rnd < 25)
|| ((rnd >= 25) && (rnd < 50) && (Npc_HasItems(hero, ItMi_Gold) < 50))
|| ((rnd >= 50) && (rnd < 75) && (Npc_HasItems(hero, ItMi_Gold) < 100))
|| ((rnd >= 75) && (rnd < 100) && (Npc_HasItems(hero, ItMi_Gold) < 200))
{
B_Say (self, hero, "$DIRTYTHIEF");
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_Theft, 1);
}
else
{
if (rnd >= 75)
{
B_GiveInvItems (hero, self, ItMi_Gold, 200);
}
else if (rnd >= 50)
{
B_GiveInvItems (hero, self, ItMi_Gold, 100);
}
else if (rnd >= 25)
{
B_GiveInvItems (hero, self, ItMi_Gold, 50);
};
B_Say (self, hero, "$PICKPOCKET_BESTECHUNG_01");
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
AI_StopProcessInfos (self);
};
};
FUNC VOID Info_Mod_Yasin_Pickpocket_Herausreden()
{
B_Say (hero, self, "$PICKPOCKET_HERAUSREDEN");
if (r_max(99) < Mod_Verhandlungsgeschick)
{
B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_01");
Info_ClearChoices (Info_Mod_Yasin_Pickpocket);
}
else
{
B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_02");
};
};
INSTANCE Info_Mod_Yasin_EXIT (C_INFO)
{
npc = Mod_7111_ASS_Yasin_NW;
nr = 1;
condition = Info_Mod_Yasin_EXIT_Condition;
information = Info_Mod_Yasin_EXIT_Info;
permanent = 1;
important = 0;
description = DIALOG_ENDE;
};
FUNC INT Info_Mod_Yasin_EXIT_Condition()
{
return 1;
};
FUNC VOID Info_Mod_Yasin_EXIT_Info()
{
AI_StopProcessInfos (self);
}; | D |
int[R] aa; // Place before the declaration of key struct
struct R
{
int opCmp(ref const R) const { return 0; }
}
void main()
{}
| D |
module shell;
string[string] vars;
string shell(string[] cmd)
{
import std.stdio;
string command = cmd[0];
string[] args = cmd[1 .. $];
/*
Sigh, this is going to be a bunch of conditionals
*/
if(command == "write")
{
write(args[0]);
return args[0];
}
else if(command == "writeln")
{
writeln(args[0]);
return args[0];
}
else if(command == "read")
{
return readln()[0 .. $ - 1];
}
else if(command == "set")
{
vars[args[0]] = args[1];
return args[1];
}
else if(command == "get")
{
return vars[args[0]];
}
}
| D |
import std.functional;
import common;
import runtime;
class SchemeRead : Context {
private this() {
setSpecial("read", toDelegate(&_read));
setSpecial("copy-context", makeCopyContext(null, this));
}
private static SchemeRead instance;
static SchemeRead getContext() {
if (instance is null) {
instance = new SchemeRead;
}
return instance;
}
}
| D |
/Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/Parsers/FR/FRWeekdayParser.swift.o : /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Date.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Util.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/DEUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ZHUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ENUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/JPUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/FRUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ESUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Chrono.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/Refiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDataRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/JP/JPMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENPrioritizeSpecificDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ForwardDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/OverlapRemovalRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneAbbrRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneOffsetRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/Parser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPStandardParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMorgenTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameMiddleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatStartWithYearParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENISOFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENRelativeDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DESlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashMonthFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/UnlikelyFormatFilter.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Options.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Result.swift /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/Dispatch.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/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/Parsers/FR/FRWeekdayParser~partial.swiftmodule : /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Date.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Util.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/DEUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ZHUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ENUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/JPUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/FRUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ESUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Chrono.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/Refiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDataRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/JP/JPMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENPrioritizeSpecificDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ForwardDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/OverlapRemovalRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneAbbrRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneOffsetRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/Parser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPStandardParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMorgenTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameMiddleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatStartWithYearParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENISOFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENRelativeDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DESlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashMonthFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/UnlikelyFormatFilter.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Options.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Result.swift /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/Dispatch.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/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/Parsers/FR/FRWeekdayParser~partial.swiftdoc : /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Date.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Util.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/DEUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ZHUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ENUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/JPUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/FRUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ESUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Chrono.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/Refiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDataRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/JP/JPMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENPrioritizeSpecificDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ForwardDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/OverlapRemovalRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneAbbrRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneOffsetRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/Parser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPStandardParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMorgenTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameMiddleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatStartWithYearParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENISOFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENRelativeDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DESlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashMonthFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/UnlikelyFormatFilter.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Options.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Result.swift /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/Dispatch.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/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/Parsers/FR/FRWeekdayParser~partial.swiftsourceinfo : /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Date.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/Util.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/DEUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ZHUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ENUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/JPUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/FRUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Utils/ESUtil.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Chrono.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/Refiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDataRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/JP/JPMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateRangeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/MergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/DE/DEMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/FR/FRMergeDateTimeRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/EN/ENPrioritizeSpecificDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ForwardDateRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/OverlapRemovalRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneAbbrRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/ExtractTimezoneOffsetRefiner.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/Parser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPStandardParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMorgenTimeParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DECasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/JP/JPCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESCasualDateParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameMiddleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESMonthNameLittleEndianParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeExpressionParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatStartWithYearParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENISOFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESDeadlineFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENRelativeDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DESlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESSlashDateFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENSlashMonthFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DETimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESTimeAgoFormatParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/DE/DEWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ZH/ZHWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/EN/ENWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/FR/FRWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Parsers/ES/ESWeekdayParser.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Refiners/UnlikelyFormatFilter.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Options.swift /Users/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/Sources/SwiftyChrono/Result.swift /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/Dispatch.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/harrisa/dev/apps/b.mobbing/chrono/SwiftyChrono/.build/x86_64-apple-macosx/debug/SwiftyChrono.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
| D |
prototype Mst_Default_Molerat(C_Npc)
{
name[0] = "Кротокрыс";
guild = GIL_MOLERAT;
aivar[AIV_MM_REAL_ID] = ID_MOLERAT;
level = 4;
B_DS_SetMst_Attribute(cMst_Default_Molerat);
protection[PROT_BLUNT] = 40;
protection[PROT_EDGE] = 40;
protection[PROT_POINT] = 40;
protection[PROT_FIRE] = 0;
protection[PROT_FLY] = 40;
protection[PROT_MAGIC] = 5;
damagetype = DAM_EDGE;
fight_tactic = FAI_MOLERAT;
senses = SENSE_HEAR | SENSE_SEE | SENSE_SMELL;
senses_range = PERC_DIST_MONSTER_ACTIVE_MAX;
aivar[AIV_MM_FollowTime] = FOLLOWTIME_SHORT;
aivar[AIV_MM_FollowInWater] = TRUE;
start_aistate = ZS_MM_AllScheduler;
aivar[AIV_MM_RoamStart] = OnlyRoutine;
};
func void B_SetVisuals_Molerat()
{
Mdl_SetVisual(self,"Molerat.mds");
Mdl_SetVisualBody(self,"Mol_Body",DEFAULT,DEFAULT,"",DEFAULT,DEFAULT,-1);
};
instance Molerat(Mst_Default_Molerat)
{
B_SetVisuals_Molerat();
Npc_SetToFistMode(self);
CreateInvItems(self,ItFoMuttonRaw,1);
CreateInvItems(self,ItMi_MoleratLubric,1);
};
| D |
void main() {
debug {
"==================================".writeln;
while(true) {
auto bench = benchmark!problem(1);
"<<< Process time: %s >>>".writefln(bench[0]);
"==================================".writeln;
}
} else {
problem();
}
}
void problem() {
auto A = scan!real;
auto B = scan!real;
auto W = scan!real * 1000;
enum UNSATISFIABLE = "UNSATISFIABLE";
auto solve() {
bool isSatisfiable = false;
foreach(k; 1..W+1) {
if (A*k <= W && W <= B*k) {
isSatisfiable = true;
break;
}
}
if (!isSatisfiable) {
UNSATISFIABLE.writeln;
return;
}
long low, high;
high = floor(W / A).to!long;
low = ceil(W / B).to!long;
"%s %s".writefln(low, high);
}
static if (is(ReturnType!(solve) == void)) solve(); else solve().writeln;
}
// ----------------------------------------------
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;
T[][] combinations(T)(T[] s, in int 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); }
ulong MOD = 10^^9 + 7;
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; }
enum YESNO = [true: "Yes", false: "No"];
// -----------------------------------------------
| D |
module gfm.opengl.fbo;
import std.string;
import derelict.opengl3.gl3;
import gfm.core.log,
gfm.opengl.opengl,
gfm.opengl.texture,
gfm.opengl.renderbuffer;
/// OpenGL FrameBuffer Object wrapper.
final class GLFBO
{
public
{
/// FBO usage.
enum Usage
{
DRAW, /// This FBO will be used for drawing.
READ /// This FBO will be used for reading.
}
/// Creates one FBO, with specified usage. OpenGL must have been loaded.
/// $(D EXT_framebuffer_object) is used as a fallback if $(D ARB_framebuffer_object) is missing.
/// Throws: $(D OpenGLException) on error.
this(OpenGL gl, Usage usage = Usage.DRAW)
{
if (glGenFramebuffers !is null)
_useEXTFallback = false;
else if (EXT_framebuffer_object())
{
gl._log.warn("ARB_framebuffer_object missing, using EXT_framebuffer_object as fallback");
_useEXTFallback = true;
}
else
throw new OpenGLException("Neither ARB_framebuffer_object nor EXT_framebuffer_object are supported");
if (_useEXTFallback && usage == Usage.READ)
throw new OpenGLException("Unable to read FBO using EXT_framebuffer_object");
_gl = gl;
if (_useEXTFallback)
glGenFramebuffersEXT(1, &_handle);
else
glGenFramebuffers(1, &_handle);
_gl.runtimeCheck();
_colors.length = _gl.maxColorAttachments();
for(int i = 0; i < _colors.length; ++i)
_colors[i] = new GLFBOAttachment(this, GL_COLOR_ATTACHMENT0 + i);
_depth = new GLFBOAttachment(this, GL_DEPTH_ATTACHMENT);
_stencil = new GLFBOAttachment(this, GL_STENCIL_ATTACHMENT);
_depthStencil = new GLFBOAttachment(this, GL_DEPTH_STENCIL_ATTACHMENT);
_usage = usage;
final switch(usage)
{
case Usage.DRAW:
_target = GL_DRAW_FRAMEBUFFER;
break;
case Usage.READ:
_target = GL_READ_FRAMEBUFFER;
}
_initialized = true;
_isBound = false;
}
~this()
{
close();
}
/// Releases the OpenGL FBO resource.
void close()
{
if (_initialized)
{
// detach all
for(int i = 0; i < _colors.length; ++i)
_colors[i].close();
_depth.close();
_stencil.close();
if (_useEXTFallback)
glDeleteFramebuffersEXT(1, &_handle);
else
glDeleteFramebuffers(1, &_handle);
_initialized = false;
}
}
/// Binds this FBO.
/// Throws: $(D OpenGLException) on error.
void use()
{
if (_useEXTFallback)
glBindFramebufferEXT(_target, _handle);
else
glBindFramebuffer(_target, _handle);
_gl.runtimeCheck();
_isBound = true;
for(int i = 0; i < _colors.length; ++i)
_colors[i].updateAttachment();
}
/// Unbinds this FBO.
/// Throws: $(D OpenGLException) on error.
void unuse()
{
_isBound = false;
if (_useEXTFallback)
glBindFramebufferEXT(_target, 0);
else
glBindFramebuffer(_target, 0);
_gl.runtimeCheck();
}
/// Returns: A FBO color attachment.
/// Params:
/// i = Index of color attachment.
GLFBOAttachment color(int i)
{
return _colors[i];
}
/// Returns: FBO depth attachment.
GLFBOAttachment depth()
{
return _depth;
}
/// Returns: FBO stencil attachment.
GLFBOAttachment stencil()
{
return _stencil;
}
}
private
{
OpenGL _gl;
GLuint _handle;
bool _initialized, _isBound;
bool _useEXTFallback;
// attachements
GLFBOAttachment[] _colors;
GLFBOAttachment _depth, _stencil, _depthStencil;
Usage _usage;
GLenum _target; // redundant
void checkStatus()
{
GLenum status = void;
if (_useEXTFallback)
status = glCheckFramebufferStatusEXT(_target);
else
status = glCheckFramebufferStatus(_target);
switch(status)
{
case GL_FRAMEBUFFER_COMPLETE:
return;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
throw new OpenGLException("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
throw new OpenGLException("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
throw new OpenGLException("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT");
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
throw new OpenGLException("GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT");
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
throw new OpenGLException("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER");
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
throw new OpenGLException("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER");
case GL_FRAMEBUFFER_UNSUPPORTED:
throw new OpenGLException("GL_FRAMEBUFFER_UNSUPPORTED");
default: throw new OpenGLException("Unknown FBO error");
}
}
}
}
/// Defines one FBO attachment.
class GLFBOAttachment
{
public
{
/// Attaches a 1D texture to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture1D tex, int level = 0)
{
_newCall = Call(this, Call.Type.TEXTURE_1D, tex, null, level, 0);
updateAttachment();
}
/// Attaches a 2D texture to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture2D tex, int level = 0)
{
_newCall = Call(this, Call.Type.TEXTURE_2D, tex, null, level, 0);
updateAttachment();
}
/// Attaches a 3D texture to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture3D tex, int layer, int level)
{
_newCall = Call(this, Call.Type.TEXTURE_3D, tex, null, level, layer);
updateAttachment();
}
/// Attaches a 1D texture array to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture1DArray tex, int layer)
{
_newCall = Call(this, Call.Type.TEXTURE_3D, tex, null, 0, layer);
updateAttachment();
}
/// Attaches a 2D texture array to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture2DArray tex, int layer)
{
_newCall = Call(this, Call.Type.TEXTURE_3D, tex, null, 0, layer);
updateAttachment();
}
/// Attaches a rectangle texture to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTextureRectangle tex)
{
_newCall = Call(this, Call.Type.TEXTURE_2D, tex, null, 0, 0);
updateAttachment();
}
/// Attaches a multisampled 2D texture to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture2DMultisample tex)
{
_newCall = Call(this, Call.Type.TEXTURE_2D, tex, null, 0, 0);
updateAttachment();
}
/// Attaches a multisampled 2D texture array to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLTexture2DMultisampleArray tex, int layer)
{
_newCall = Call(this, Call.Type.TEXTURE_3D, tex, null, 0, layer);
updateAttachment();
}
/// Attaches a renderbuffer to the FBO.
/// Throws: $(D OpenGLException) on error.
void attach(GLRenderBuffer buffer)
{
_newCall = Call(this, Call.Type.RENDERBUFFER, null, buffer, 0, 0);
updateAttachment();
}
}
private
{
this(GLFBO fbo, GLenum attachment)
{
_fbo = fbo;
_gl = fbo._gl;
_attachment = attachment;
_lastCall = _newCall = Call(this, Call.Type.DISABLED, null, null, 0, 0);
}
// guaranteed to be called once
void close()
{
_lastCall.detach(_fbo._useEXTFallback);
}
OpenGL _gl;
GLFBO _fbo;
GLenum _attachment;
Call _lastCall;
Call _newCall;
void updateAttachment()
{
if (_newCall != _lastCall && _fbo._isBound)
{
try
{
// trying to detach existing attachment
// would that help?
_lastCall.detach(_fbo._useEXTFallback);
}
catch(OpenGLException e)
{
// ignoring errors here
}
_newCall.attach(_fbo._useEXTFallback);
_lastCall = _newCall;
}
}
struct Call
{
public
{
enum Type
{
DISABLED,
TEXTURE_1D,
TEXTURE_2D,
TEXTURE_3D,
RENDERBUFFER
}
GLFBOAttachment _outer;
Type _type;
GLTexture _texture;
GLRenderBuffer _renderbuffer;
GLint _level;
GLint _layer;
void attach(bool useEXTFallback)
{
attachOrDetach(useEXTFallback, _texture.handle(), _renderbuffer._handle);
}
void detach(bool useEXTFallback)
{
attachOrDetach(useEXTFallback, 0, 0);
}
void attachOrDetach(bool useEXTFallback, GLuint textureHandle, GLuint renderBufferHandle)
{
final switch(_type)
{
case Type.DISABLED:
return; // do nothing
case Type.TEXTURE_1D:
if (useEXTFallback)
glFramebufferTexture1DEXT(_outer._fbo._target, _outer._attachment, _texture._target, textureHandle, _level);
else
glFramebufferTexture1D(_outer._fbo._target, _outer._attachment, _texture._target, textureHandle, _level);
break;
case Type.TEXTURE_2D:
if (useEXTFallback)
glFramebufferTexture2DEXT(_outer._fbo._target, _outer._attachment, _texture._target, textureHandle, _level);
else
glFramebufferTexture2D(_outer._fbo._target, _outer._attachment, _texture._target, textureHandle, _level);
break;
case Type.TEXTURE_3D:
if (useEXTFallback)
glFramebufferTexture3DEXT(_outer._fbo._target, _outer._attachment, _texture._target, textureHandle, _level, _layer);
else
glFramebufferTexture3D(_outer._fbo._target, _outer._attachment, _texture._target, textureHandle, _level, _layer);
break;
case Type.RENDERBUFFER:
if (useEXTFallback)
glFramebufferRenderbufferEXT(_outer._fbo._target, _outer._attachment, GL_RENDERBUFFER, renderBufferHandle);
else
glFramebufferRenderbuffer(_outer._fbo._target, _outer._attachment, GL_RENDERBUFFER, renderBufferHandle);
break;
}
_outer._gl.runtimeCheck();
}
}
}
}
}
| D |
module base.modelloader;
import thBase.format;
import thBase.chunkfile;
import thBase.policies.locking;
import thBase.enumbitfield;
import thBase.math3d.vecs;
import thBase.math3d.mats;
import thBase.math3d.box;
import thBase.allocator;
import thBase.scoped;
import thBase.types;
import thBase.casts;
import modeltypes;
version(Win32)
extern(C) int D10modeltypes12__ModuleInfoZ;
version(Win64)
extern(C) int _D10modeltypes12__ModuleInfoZ;
class ModelLoader
{
public:
enum Load
{
Materials = 0x0001,
Meshes = 0x0002,
Normals = 0x0004,
Tangents = 0x0008,
Bitangents = 0x0010,
TexCoords0 = 0x0020,
TexCoords1 = 0x0040,
TexCoords2 = 0x0080,
TexCoords3 = 0x0100,
Nodes = 0x0200,
Everything = 0xFFFF
}
static struct FaceData
{
uint[3] indices;
}
static struct MaterialData
{
TextureReference[] textures;
}
static struct MeshData
{
uint materialIndex;
AlignedBoxLocal bbox;
uint numFaces;
FaceData[] faces;
vec3[] vertices;
vec3[] normals;
vec3[] tangents;
vec3[] bitangents;
vec2[][4] texcoords;
}
static struct NodeDrawData
{
mat4 transform;
NodeDrawData*[] children;
uint[] meshes;
NodeData* data;
}
static struct NodeData
{
string name;
NodeDrawData* parent;
MeshData*[] meshData;
}
static struct TextureReference
{
TextureType semantic;
string file;
}
static struct ModelData
{
string[] textures;
MaterialData[] materials;
MeshData[] meshes;
NodeDrawData* rootNode;
bool hasData;
}
private FixedStackAllocator!(NoLockPolicy, StdAllocator) m_meshDataAllocator;
private ModelData m_modelData;
rcstring filename;
private uint allocationSize(T)(uint num)
{
uint size = cast(uint)T.sizeof * num;
if(size % m_meshDataAllocator.alignment != 0)
{
size += m_meshDataAllocator.alignment - (size & (m_meshDataAllocator.alignment * 2 - 1));
}
assert(size % m_meshDataAllocator.alignment == 0);
return size;
}
/**
* provides read only access for the loaded data
*/
@property ref const(ModelData) modelData() const
{
assert(m_modelData.hasData, "no data has been loaded yet");
return m_modelData;
}
~this()
{
if(m_meshDataAllocator !is null)
{
m_meshDataAllocator.FreeAllMemory();
Delete(m_meshDataAllocator);
}
}
/**
* Load the model from a file
* Params:
* pFilename = filename of the file to load
*/
void LoadFile(rcstring pFilename, EnumBitfield!Load loadWhat)
in {
assert(!m_modelData.hasData,"LoadFile can only be called once");
}
body {
filename = pFilename;
if(!thBase.file.exists(pFilename[]))
{
throw New!RCException(format("File '%s' does not exist", pFilename[]));
}
auto file = scopedRef!(Chunkfile)(New!Chunkfile(pFilename, Chunkfile.Operation.Read));
if(file.startReading("thModel") != thResult.SUCCESS)
{
throw New!RCException(format("File '%s' is not a thModel format", pFilename[]));
}
if(file.fileVersion != ModelFormatVersion.Version1)
{
throw New!RCException(format("Model '%s' does have old format, please reexport", pFilename[]));
}
static struct MemoryPool
{
uint size;
uint cur;
this(size_t size)
{
assert(size <= uint.max);
this.size = cast(uint)size;
}
void opOpAssign(string op, T)(T val)
{
this.cur += int_cast!uint(val);
assert(this.cur <= this.size, "Memory pool overflow");
}
}
static struct MemoryStatistics
{
MemoryPool materialData;
MemoryPool nodeNameMemory;
MemoryPool texturePathMemory;
MemoryPool texturePathReferencesMemory;
MemoryPool meshDataArray;
MemoryPool vertexData;
MemoryPool faceDataArray;
MemoryPool nodeData;
MemoryPool meshReferenceMemory;
MemoryPool nodeReferenceMemory;
MemoryPool textureReferenceMemory;
}
MemoryStatistics memstat;
uint nodeNameMemory;
Load[4] loadTexCoords;
loadTexCoords[0] = Load.TexCoords0;
loadTexCoords[1] = Load.TexCoords1;
loadTexCoords[2] = Load.TexCoords2;
loadTexCoords[3] = Load.TexCoords3;
uint texturePathMemory;
//Read the size info
{
enum size_t alignmentOverhead = m_meshDataAllocator.alignment - 1;
file.startReadChunk();
if(file.currentChunkName != "sizeinfo")
{
throw New!RCException(format("Expected sizeinfo chunk, got '%s' chunk in file '%s'", file.currentChunkName, pFilename[]));
}
size_t meshDataSize;
uint numTextures;
file.read(numTextures);
if(loadWhat.IsSet(Load.Materials))
{
meshDataSize += string.sizeof * numTextures;
memstat.texturePathReferencesMemory = MemoryPool(string.sizeof * numTextures);
}
file.read(texturePathMemory);
if(texturePathMemory % m_meshDataAllocator.alignment != 0)
texturePathMemory += m_meshDataAllocator.alignment - (texturePathMemory % m_meshDataAllocator.alignment);
if(loadWhat.IsSet(Load.Materials))
{
meshDataSize += texturePathMemory;
memstat.texturePathMemory = MemoryPool(texturePathMemory);
}
uint numMaterials;
file.read(numMaterials);
if(loadWhat.IsSet(Load.Materials))
{
memstat.materialData = MemoryPool(numMaterials * MaterialData.sizeof);
meshDataSize += memstat.materialData.size;
}
uint numMeshes;
file.read(numMeshes);
if(loadWhat.IsSet(Load.Meshes))
{
meshDataSize += MeshData.sizeof * numMeshes;
memstat.meshDataArray = MemoryPool(MeshData.sizeof * numMeshes);
}
for(uint i=0; i<numMeshes; i++)
{
uint numVertices, PerVertexFlags, numComponents, numTexcoords;
file.read(numVertices);
file.read(PerVertexFlags);
if(PerVertexFlags & PerVertexData.Position)
numComponents++;
if((PerVertexFlags & PerVertexData.Normal) && loadWhat.IsSet(Load.Normals))
numComponents++;
if((PerVertexFlags & PerVertexData.Tangent) && loadWhat.IsSet(Load.Tangents))
numComponents++;
if((PerVertexFlags & PerVertexData.Bitangent) && loadWhat.IsSet(Load.Bitangents))
numComponents++;
if(PerVertexFlags & PerVertexData.TexCoord0)
numTexcoords++;
if(PerVertexFlags & PerVertexData.TexCoord1)
numTexcoords++;
if(PerVertexFlags & PerVertexData.TexCoord2)
numTexcoords++;
if(PerVertexFlags & PerVertexData.TexCoord3)
numTexcoords++;
meshDataSize += allocationSize!float(numVertices * 3) * numComponents;
memstat.vertexData.size += allocationSize!float(numVertices * 3) * numComponents;
for(uint j=0; j<numTexcoords; j++)
{
ubyte numUVComponents;
file.read(numUVComponents);
if(loadWhat.IsSet(loadTexCoords[j]))
{
meshDataSize += allocationSize!float(numVertices * 3) * numUVComponents;
memstat.vertexData.size += allocationSize!float(numVertices * 3) * numUVComponents;
}
}
uint numFaces;
file.read(numFaces);
if(loadWhat.IsSet(Load.Meshes))
{
meshDataSize += numFaces * FaceData.sizeof;
memstat.faceDataArray.size += numFaces * FaceData.sizeof;
}
}
uint numNodes,numNodeReferences,numMeshReferences,numTextureReferences;
file.read(numNodes);
file.read(numNodeReferences);
file.read(nodeNameMemory);
file.read(numMeshReferences);
file.read(numTextureReferences);
if(nodeNameMemory % m_meshDataAllocator.alignment != 0)
nodeNameMemory += m_meshDataAllocator.alignment - (nodeNameMemory % m_meshDataAllocator.alignment);
if(loadWhat.IsSet(Load.Nodes))
{
meshDataSize += numNodes * NodeData.sizeof;
meshDataSize += numNodes * NodeDrawData.sizeof;
memstat.nodeData = MemoryPool(numNodes * NodeData.sizeof + numNodes * NodeDrawData.sizeof);
meshDataSize += allocationSize!uint(numMeshReferences);
memstat.meshReferenceMemory = MemoryPool(allocationSize!uint(numMeshReferences));
meshDataSize += numNodeReferences * (NodeData*).sizeof;
memstat.nodeReferenceMemory = MemoryPool(numNodeReferences * (NodeDrawData*).sizeof);
meshDataSize += nodeNameMemory;
memstat.nodeNameMemory = MemoryPool(nodeNameMemory);
}
if(loadWhat.IsSet(Load.Materials))
{
meshDataSize += numTextureReferences * TextureReference.sizeof;
memstat.textureReferenceMemory = MemoryPool(numTextureReferences * TextureReference.sizeof);
}
file.endReadChunk();
debug
{
meshDataSize += 512 * size_t.sizeof; //room for size tracking inside allocator in debug
}
m_meshDataAllocator = New!(typeof(m_meshDataAllocator))(meshDataSize, StdAllocator.globalInstance);
}
// Load textures
{
file.startReadChunk();
if(file.currentChunkName != "textures")
{
throw New!RCException(format("Expected 'textures' chunk but got '%s' chunk", file.currentChunkName));
}
if(loadWhat.IsSet(Load.Materials))
{
uint numTextures;
file.read(numTextures);
if(numTextures > 0)
{
memstat.texturePathReferencesMemory += allocationSize!string(numTextures);
m_modelData.textures = AllocatorNewArray!string(m_meshDataAllocator, numTextures);
memstat.texturePathMemory += allocationSize!char(texturePathMemory);
char[] textureNames = AllocatorNewArray!char(m_meshDataAllocator, texturePathMemory);
size_t curNamePos = 0;
foreach(ref texture; m_modelData.textures)
{
uint len;
file.read(len);
auto data = textureNames[curNamePos..(curNamePos+len)];
curNamePos += len;
file.read(data);
texture = cast(string)data;
}
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
}
// Read Materials
{
file.startReadChunk();
if(file.currentChunkName != "materials")
{
throw New!RCException(format("Expected 'materials' chunk but go '%s'", file.currentChunkName));
}
if(loadWhat.IsSet(Load.Materials))
{
uint numMaterials;
file.read(numMaterials);
if(numMaterials > 0)
{
memstat.materialData += allocationSize!MaterialData(numMaterials);
m_modelData.materials = AllocatorNewArray!MaterialData(m_meshDataAllocator, numMaterials);
foreach(ref material; m_modelData.materials)
{
file.startReadChunk();
if(file.currentChunkName != "mat")
{
throw New!RCException(format("Expected 'mat' chunk but go '%s'", file.currentChunkName));
}
uint numTextures;
file.read(numTextures);
memstat.textureReferenceMemory += allocationSize!TextureReference(numTextures);
material.textures = AllocatorNewArray!TextureReference(m_meshDataAllocator, numTextures);
foreach(ref texture; material.textures)
{
uint textureIndex;
file.read(textureIndex);
texture.file = m_modelData.textures[textureIndex];
file.read(texture.semantic);
}
file.endReadChunk();
}
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
}
// Read Meshes
{
file.startReadChunk();
if(file.currentChunkName != "meshes")
{
throw New!RCException(format("Expected 'meshes' chunk but got '%s'", file.currentChunkName));
}
if(loadWhat.IsSet(Load.Meshes))
{
uint numMeshes;
file.read(numMeshes);
memstat.meshDataArray += allocationSize!MeshData(numMeshes);
m_modelData.meshes = AllocatorNewArray!MeshData(m_meshDataAllocator, numMeshes);
foreach(ref mesh; m_modelData.meshes)
{
file.startReadChunk();
if(file.currentChunkName != "mesh")
{
throw New!RCException(format("Expected 'mesh' chunk but got '%s'", file.currentChunkName));
}
uint materialIndex;
file.read(mesh.materialIndex);
vec3 minBounds,maxBounds;
file.read(minBounds.f[]);
file.read(maxBounds.f[]);
mesh.bbox = AlignedBoxLocal(minBounds, maxBounds);
uint numVertices;
file.read(numVertices);
file.startReadChunk();
if(file.currentChunkName != "vertices")
{
throw New!RCException(format("Expected 'vertices' chunk but got '%s'", file.currentChunkName));
}
memstat.vertexData += allocationSize!vec3(numVertices);
mesh.vertices = AllocatorNewArray!vec3(m_meshDataAllocator, numVertices, InitializeMemoryWith.NOTHING);
file.read(mesh.vertices[0].f.ptr[0..numVertices * 3]);
file.endReadChunk();
float UncompressFloat()
{
short data;
file.read(data);
return cast(float)data / cast(float)short.max;
}
{
file.startReadChunk();
if(file.currentChunkName == "normals")
{
if(loadWhat.IsSet(Load.Normals))
{
memstat.vertexData += allocationSize!vec3(numVertices);
mesh.normals = AllocatorNewArray!vec3(m_meshDataAllocator, numVertices, InitializeMemoryWith.NOTHING);
foreach(ref normal; mesh.normals)
{
normal.x = UncompressFloat();
normal.y = UncompressFloat();
normal.z = UncompressFloat();
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
file.startReadChunk();
}
if(file.currentChunkName == "tangents")
{
if(loadWhat.IsSet(Load.Tangents))
{
memstat.vertexData += allocationSize!vec3(numVertices);
mesh.tangents = AllocatorNewArray!vec3(m_meshDataAllocator, numVertices, InitializeMemoryWith.NOTHING);
foreach(ref tangent; mesh.tangents)
{
tangent.x = UncompressFloat();
tangent.y = UncompressFloat();
tangent.z = UncompressFloat();
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
file.startReadChunk();
}
if(file.currentChunkName == "bitangents")
{
if(loadWhat.IsSet(Load.Bitangents))
{
memstat.vertexData += allocationSize!vec3(numVertices);
mesh.bitangents = AllocatorNewArray!vec3(m_meshDataAllocator, numVertices, InitializeMemoryWith.NOTHING);
foreach(ref bitangent; mesh.bitangents)
{
bitangent.x = UncompressFloat();
bitangent.y = UncompressFloat();
bitangent.z = UncompressFloat();
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
file.startReadChunk();
}
if(file.currentChunkName == "texcoords")
{
if(loadWhat.IsSet(Load.TexCoords0) || loadWhat.IsSet(Load.TexCoords1) ||
loadWhat.IsSet(Load.TexCoords2) || loadWhat.IsSet(Load.TexCoords3))
{
ubyte numTexCoords;
file.read(numTexCoords);
for(ubyte i=0; i<numTexCoords; i++)
{
ubyte numUVComponents;
file.read(numUVComponents);
if(numUVComponents != 2)
{
throw New!RCException(format("Currently only 2 component texture coordinates are supported got %d", numUVComponents));
}
if(loadWhat.IsSet(loadTexCoords[i]))
{
memstat.vertexData += allocationSize!vec2(numVertices);
mesh.texcoords[i] = AllocatorNewArray!vec2(m_meshDataAllocator, numVertices, InitializeMemoryWith.NOTHING);
file.read((cast(float*)mesh.texcoords[i].ptr)[0..numVertices*numUVComponents]);
}
else
{
//skip the texcoord data
file.skipRead(float.sizeof * numUVComponents * numVertices);
}
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
file.startReadChunk();
}
if(file.currentChunkName == "faces")
{
uint numFaces;
file.read(numFaces);
memstat.faceDataArray += allocationSize!FaceData(numFaces);
mesh.faces = AllocatorNewArray!FaceData(m_meshDataAllocator, numFaces, InitializeMemoryWith.NOTHING);
if(numVertices > ushort.max)
{
file.read((cast(uint*)mesh.faces.ptr)[0..numFaces*3]);
}
else
{
ushort data;
foreach(ref face; mesh.faces)
{
file.read(data); face.indices[0] = cast(uint)data;
file.read(data); face.indices[1] = cast(uint)data;
file.read(data); face.indices[2] = cast(uint)data;
}
}
}
else
{
throw New!RCException(format("Unexpected chunk '%s'", file.currentChunkName));
}
file.endReadChunk();
}
file.endReadChunk();
}
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
}
// Read Nodes
{
file.startReadChunk();
if(loadWhat.IsSet(Load.Nodes))
{
if(file.currentChunkName != "nodes")
{
throw New!RCException(format("Expected 'nodes' chunk but got '%s'", file.currentChunkName));
}
uint numNodes;
file.read(numNodes);
memstat.nodeNameMemory += allocationSize!char(nodeNameMemory);
auto nodeNames = AllocatorNewArray!char(m_meshDataAllocator, nodeNameMemory);
size_t curNodeNamePos = 0;
memstat.nodeData += allocationSize!NodeData(numNodes);
auto nodesData = AllocatorNewArray!NodeData(m_meshDataAllocator, numNodes);
memstat.nodeData += allocationSize!NodeDrawData(numNodes);
auto nodes = AllocatorNewArray!NodeDrawData(m_meshDataAllocator, numNodes);
foreach(size_t i, ref node; nodes)
{
node.data = &nodesData[i];
uint nameLength;
file.read(nameLength);
auto name = nodeNames[curNodeNamePos..(curNodeNamePos+nameLength)];
file.read(name);
node.data.name = cast(string)name;
file.read(node.transform.f[]);
uint nodeParentIndex;
file.read(nodeParentIndex);
if(nodeParentIndex == uint.max)
node.data.parent = null;
else
node.data.parent = &nodes[nodeParentIndex];
node.meshes = file.readAndAllocateArray!(uint, uint, typeof(m_meshDataAllocator))(m_meshDataAllocator);
memstat.meshReferenceMemory += allocationSize!uint(int_cast!uint(node.meshes.length));
uint numChildren;
file.read(numChildren);
if(numChildren > 0)
{
memstat.nodeReferenceMemory += allocationSize!(NodeDrawData*)(numChildren);
node.children = AllocatorNewArray!(NodeDrawData*)(m_meshDataAllocator, numChildren);
foreach(ref child; node.children)
{
uint childIndex;
file.read(childIndex);
child = &nodes[childIndex];
}
}
}
m_modelData.rootNode = &nodes[0];
file.endReadChunk();
}
else
{
file.skipCurrentChunk();
}
}
file.endReading();
m_modelData.hasData = true;
}
} | D |
module odyssey.math.mat4;
import odyssey.math.vec4;
import std.string : format;
const {
Mat4 MAT4_IDENTITY =
Mat4( 1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1 );
}
// TODO: Unittests
struct Mat4 {
union {
struct {
float
m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33;
};
float[16] m16;
float[4][4] m;
};
/**
* Construct the matrix
*/
this(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33) {
m[0][0]=m00; m[0][1]=m01; m[0][2]=m02; m[0][3]=m03;
m[1][0]=m10; m[1][1]=m11; m[1][2]=m12; m[1][3]=m13;
m[2][0]=m20; m[2][1]=m21; m[2][2]=m22; m[2][3]=m23;
m[3][0]=m30; m[3][1]=m31; m[3][2]=m32; m[3][3]=m33;
}
/**
* Construct the matrix using column vectors
*/
this(Vec4 col0, Vec4 col1, Vec4 col2, Vec4 col3) {
this.col!0 = col0;
this.col!1 = col1;
this.col!2 = col2;
this.col!3 = col3;
}
@property auto ptr() { return m16.ptr; }
/**
* Set row
* eg. m.row!3 = v
*/
@property void row(int i)(Vec4 v) {
m[i][0] = v.v[0];
m[i][1] = v.v[1];
m[i][2] = v.v[2];
m[i][3] = v.v[3];
}
/**
* Get row as a Vec4
* eg. m.row!1
*/
@property Vec4 row(int i)() {
return Vec4(m[i][0],
m[i][1],
m[i][2],
m[i][3]);
}
/**
* Set column
* eg. m.col!3 = v
*/
@property void col(int i)(Vec4 v) {
m[0][i] = v.v[0];
m[1][i] = v.v[1];
m[2][i] = v.v[2];
m[3][i] = v.v[3];
}
/**
* Get cloumn as a Vec4
* eg. m.col!1
*/
@property Vec4 col(int i)() {
return Vec4(m[0][i],
m[1][i],
m[2][i],
m[3][i]);
}
/**
* Transpose the matrix
*/
Mat4 transpose() {
return Mat4(
m00, m10, m20, m30,
m01, m11, m21, m31,
m02, m12, m22, m32,
m03, m13, m23, m33);
}
/**
* The sum of the matrix and another matrix
*/
Mat4 opBinary(string op : "+")(Mat4 m) {
return Mat4(
this.col!0 + m.col!0,
this.col!1 + m.col!1,
this.col!2 + m.col!2,
this.col!3 + m.col!3);
}
/**
* Subtract the matrix by another matrix
*/
Mat4 opBinary(string op : "-")(Mat4 m) {
return Mat4(
this.col!0 - m.col!0,
this.col!1 - m.col!1,
this.col!2 - m.col!2,
this.col!3 - m.col!3);
}
/**
* Multiply the matrix by a float
*/
Mat4 opBinary(string op : "*")(float f) {
return Mat4(
this.col!0 * f,
this.col!1 * f,
this.col!2 * f,
this.col!3 * f);
}
/**
* Multiply the matrix by a 4-component vector
*/
Vec4 opBinary(string op : "*")(Vec4 v) {
return Vec4 (
this.row!0 * v,
this.row!1 * v,
this.row!2 * v,
this.row!3 * v);
}
/**
* Multiply the matrix by another 4x4 matrix
*/
Mat4 opBinary(string op : "*")(Mat4 m) {
return Mat4(
(this.row!0 * m.col!0), (this.row!0 * m.col!1), (this.row!0 * m.col!2), (this.row!0 * m.col!3),
(this.row!1 * m.col!0), (this.row!1 * m.col!1), (this.row!1 * m.col!2), (this.row!1 * m.col!3),
(this.row!2 * m.col!0), (this.row!2 * m.col!1), (this.row!2 * m.col!2), (this.row!2 * m.col!3),
(this.row!3 * m.col!0), (this.row!3 * m.col!1), (this.row!3 * m.col!2), (this.row!3 * m.col!3));
}
// TODO: Matrix Inversion
string toString() {
return
format("Mat4(%f.2\t%f.2\t%f.2\t%f.2\n", m00, m01, m02, m03)~
format(" %f.2\t%f.2\t%f.2\t%f.2\n", m10, m11, m12, m13)~
format(" %f.2\t%f.2\t%f.2\t%f.2\n", m20, m21, m22, m23)~
format(" %f.2\t%f.2\t%f.2\t%f.2)", m30, m31, m32, m33);
}
}
Mat4 perspective(float fov, float aspect, float near, float far) {
// TODO!
//float range = tan
throw new Exception("Not yet implemented");
}
Mat4 translate(Mat4 m, Vec4 v) {
Mat4 result = m;
result.col!3 = (m.col!0 * v.v[0]) +
(m.col!1 * v.v[1]) +
(m.col!2 * v.v[2]) + m.col!3;
return result;
}
Mat4 scale(Mat4 m, Vec4 v) {
Mat4 result;
result.col!0 = m.col!0 * v.v[0];
result.col!1 = m.col!1 * v.v[1];
result.col!2 = m.col!2 * v.v[2];
result.col!3 = m.col!3;
return result;
} | D |
/*******************************************************************************
DHT Node Server Daemon
copyright:
Copyright (c) 2011-2017 sociomantic labs GmbH. All rights reserved
License:
Boost Software License Version 1.0. See LICENSE.txt for details.
*******************************************************************************/
module dhtnode.main;
/*******************************************************************************
Imports
*******************************************************************************/
import ocean.transition;
import ocean.util.app.DaemonApp;
import ocean.util.log.Logger;
import core.memory;
/*******************************************************************************
D2-only stomping prevention counter
*******************************************************************************/
version ( D_Version2 )
{
mixin(`
extern(C) extern shared long stomping_prevention_counter;
`);
}
/*******************************************************************************
Static module logger
*******************************************************************************/
private Logger logger;
static this ( )
{
logger = Log.lookup("dhtnode.main");
}
/*******************************************************************************
Main function. Parses command line arguments and either displays help or
starts dht node.
Params:
cl_args = array with raw command line arguments
*******************************************************************************/
version (UnitTest) {} else
private int main ( istring[] cl_args )
{
auto app = new DhtNodeServer;
return app.main(cl_args);
}
/*******************************************************************************
DHT node application base class
*******************************************************************************/
public class DhtNodeServer : DaemonApp
{
import Version;
import dhtnode.config.ServerConfig;
import dhtnode.config.PerformanceConfig;
import dhtnode.config.HashRangeConfig;
import dhtnode.node.DhtHashRange;
import dhtnode.node.RedistributionProcess;
import dhtnode.node.DhtNode;
import dhtnode.connection.DhtConnectionHandler;
import dhtnode.storage.StorageChannels;
import ocean.core.MessageFiber;
import ocean.core.Enforce;
import ocean.io.select.protocol.generic.ErrnoIOException : IOWarning;
import ocean.io.select.selector.EpollException;
import ocean.util.config.ConfigParser;
import ConfigReader = ocean.util.config.ConfigFiller;
import ocean.io.select.EpollSelectDispatcher;
import ocean.io.select.client.model.ISelectClient;
import Hash = ocean.text.convert.Hash;
import dhtproto.client.legacy.DhtConst;
import swarm.util.node.log.Stats;
import ocean.core.ExceptionDefinitions : IOException, OutOfMemoryException;
import core.sys.posix.signal: SIGINT, SIGTERM, SIGQUIT;
import core.sys.posix.sys.mman : mlockall, MCL_CURRENT, MCL_FUTURE;
import core.stdc.errno : errno, EPERM, ENOMEM;
import core.stdc.string : strerror;
import ocean.text.util.StringC;
/***************************************************************************
Memory node config values
***************************************************************************/
private static class MemoryConfig
{
/// Maximum number of bytes allowed in the node. 0 = no size limit.
ulong size_limit = 0;
/// Determines if the node will mlockall() the memory so it doesn't get
/// swapped out by the kernel under heavy memory pressure (default is
/// true). This option is mostly intended for testing environments, in
/// live systems it should normally always be true.
bool lock_memory = true;
/// Behaviour upon encountering an out-of-range record.
ConfigReader.LimitInit!(istring, "load", "load", "fatal", "ignore")
allow_out_of_range;
/// If this many records have been loaded from a channel file and all
/// were out-of-range, then abort. If 0, this behaviour is disabled.
/// (This is to safeguard against the case where all records are
/// out-of-range.)
uint abort_after_all_out_of_range = 10_000;
/// Determines if regular buffered I/O (true) or direct I/O is used
/// (false, the default). This should be only set to true for testing
/// purposes; using direct I/O imposes some restrictions over the type
/// of filesystem that complicates testing quite a bit, making it
/// impossible to load/dump files to overlayfs, tmpfs or encrypted
/// filesystems. This option SHOULD NEVER be set to true in live systems.
bool disable_direct_io = false;
/// Number of buckets to allocate in each channel; passed into
/// tokyocabinet. 0 = use tokyocabinet's default number of buckets.
uint bnum = 0;
/***********************************************************************
Returns:
OutOfRangeHandling settings struct corresponding to the values
of allow_out_of_range and abort_after_all_out_of_range, read
from the config file
***********************************************************************/
public StorageChannels.OutOfRangeHandling out_of_range_handling ( )
{
StorageChannels.OutOfRangeHandling out_of_range_handling;
out_of_range_handling.abort_after_all_out_of_range =
this.abort_after_all_out_of_range;
with ( StorageChannels.OutOfRangeHandling.Mode )
switch ( this.allow_out_of_range() )
{
case "load":
out_of_range_handling.mode = Load;
break;
case "fatal":
out_of_range_handling.mode = Fatal;
break;
case "ignore":
out_of_range_handling.mode = Ignore;
break;
default:
assert(false);
}
return out_of_range_handling;
}
}
private MemoryConfig memory_config;
/***************************************************************************
Config classes for server and performance
***************************************************************************/
private ServerConfig server_config;
private PerformanceConfig performance_config;
/***************************************************************************
Epoll selector instance
***************************************************************************/
private EpollSelectDispatcher epoll;
/***************************************************************************
DHT node instance. Constructed after the config file has been
parsed -- currently the type of node is setin the config file.
***************************************************************************/
private DhtNode node;
/***************************************************************************
Storage channels owned by the node (created by sub-class).
***************************************************************************/
private StorageChannels storage_channels;
/***************************************************************************
Hash range for which node is responsible. Set from config file at
startup.
***************************************************************************/
private DhtHashRange hash_range;
/***************************************************************************
Node stats logger
***************************************************************************/
private ChannelsNodeStats dht_stats;
/***************************************************************************
Reusable buffer for formatting error messages.
***************************************************************************/
private mstring conn_error_buf;
/***************************************************************************
Constructor
***************************************************************************/
public this ( )
{
version ( D_Version2 ) { }
else
{
// GC collect hooks only available in D1
GC.monitor(&this.gcCollectStart, &this.gcCollectEnd);
}
const app_name = "dhtnode";
const app_desc = "dhtnode: DHT server node.";
DaemonApp.OptionalSettings optional;
optional.signals = [SIGINT, SIGTERM, SIGQUIT];
this.epoll = new EpollSelectDispatcher;
super(app_name, app_desc, version_info, optional);
}
/***************************************************************************
Override default DaemonApp arguments parsing, specifying that --config
is required.
Params:
app = application instance
args = arguments parser instance
***************************************************************************/
override public void setupArgs ( IApplication app, Arguments args )
{
super.setupArgs(app, args);
args("config").deefalts = null;
args("config").required;
}
/***************************************************************************
Signal handler, called from epoll (via the SignalExt) when one of the
registered signals is received by the process.
Params:
signum = code of signal which fired
***************************************************************************/
public override void onSignal ( int signum )
{
switch ( signum )
{
case SIGINT:
case SIGTERM:
case SIGQUIT:
this.sigintHandler();
break;
default:
break;
}
}
/***************************************************************************
Get values from the configuration file.
Params:
app = application instance
config = config parser instance
***************************************************************************/
public override void processConfig ( IApplication app, ConfigParser config )
{
ConfigReader.fill("Server", this.server_config, config);
ConfigReader.fill("Performance", this.performance_config, config);
ConfigReader.fill("Options_Memory", this.memory_config, config);
hash_t min, max;
enforce(Hash.hashDigestToHashT(this.server_config.minval(), min, true),
"Minimum hash specified in config file is invalid -- "
"a full-length hash is expected");
enforce(Hash.hashDigestToHashT(this.server_config.maxval(), max, true),
"Maximum hash specified in config file is invalid -- "
"a full-length hash is expected");
this.hash_range = new DhtHashRange(min, max,
new HashRangeConfig(this.config_ext.default_configs));
}
/***************************************************************************
Do the actual application work. Called by the super class.
Params:
args = command line arguments
config = parser instance with the parsed configuration
Returns:
status code to return to the OS
***************************************************************************/
override protected int run ( Arguments args, ConfigParser config )
{
if ( this.memory_config.lock_memory )
{
if ( !this.lockMemory() )
{
return 1;
}
}
auto storage = this.newStorageChannels();
redistribution_process = new RedistributionProcess(
storage, this.performance_config.redist_memory_limit_mulitplier);
this.node = new DhtNode(this.node_item,
storage, this.hash_range, this.epoll,
server_config.backlog, this.per_request_stats);
this.dht_stats =
new ChannelsNodeStats(this.node, this.stats_ext.stats_log);
this.node.error_callback = &this.nodeError;
this.node.connection_limit = server_config.connection_limit;
logger.info("Starting DHT node --------------------------------");
this.startEventHandling(this.epoll);
this.timer_ext.register(&this.onWriterFlush,
cast(double)this.performance_config.write_flush_ms / 1000.0);
this.node.register(this.epoll);
logger.info("Starting event loop");
this.epoll.eventLoop();
logger.info("Event loop exited");
return 0;
}
/***************************************************************************
Periodic stats update callback.
***************************************************************************/
override protected void onStatsTimer ( )
{
this.reportSystemStats();
this.dht_stats.log();
this.stats_ext.stats_log.add(.Log.stats());
struct StompingPreventionStats
{
long stomping_prevention_counter;
}
StompingPreventionStats stomping_stats;
version ( D_Version2 )
{
mixin(`
import core.atomic : atomicLoad, atomicStore;
stomping_stats.stomping_prevention_counter =
atomicLoad(.stomping_prevention_counter);
atomicStore(.stomping_prevention_counter, 0UL);
`);
}
this.stats_ext.stats_log.add(stomping_stats);
this.stats_ext.stats_log.flush();
}
/***************************************************************************
Periodic writer flush callback.
Returns:
true to re-register timer
***************************************************************************/
private bool onWriterFlush ( )
{
try
{
this.node.flush();
}
catch ( Exception exception )
{
logger.error("Exception caught in writer flush timer handler: {} @ {}:{}",
getMsg(exception), exception.file, exception.line);
}
return true;
}
/***************************************************************************
Creates a new instance of the storage channels. Calls the abstract
newStorageChannels_() method, which does the actual construction of the
storage channels instance.
Returns:
StorageChannels instance
***************************************************************************/
private StorageChannels newStorageChannels ( )
{
this.storage_channels = new StorageChannels(this.server_config.data_dir,
this.memory_config.size_limit, this.hash_range,
this.memory_config.bnum, this.memory_config.out_of_range_handling,
this.memory_config.disable_direct_io);
return this.storage_channels;
}
/***************************************************************************
Locks the process memory (including all future allocations) into RAM,
preventing swapping to disk.
Returns:
true if the memory lock succeeded
***************************************************************************/
private bool lockMemory ( )
{
if ( mlockall(MCL_CURRENT | MCL_FUTURE) )
{
const default_error = "Unknown";
istring msg = default_error;
// Provide custom error messages for expected errors
switch ( errno )
{
case EPERM:
msg = "Executable does not have permissions to lock "
"memory";
break;
case ENOMEM:
msg = "Attempted to lock more memory than allowed by "
"soft resource limit (RLIMIT_MEMLOCK)";
break;
default:
// Leave default error message
}
auto error = strerror(errno);
auto errno_desc = StringC.toDString(error);
logger.fatal("Error when attempting to lock memory: {} "
"(errno={}, '{}')", msg, errno, errno_desc);
return false;
}
return true;
}
/***************************************************************************
Returns:
list of names of requests to be stats tracked
***************************************************************************/
private istring[] per_request_stats ( )
out ( rqs )
{
foreach ( rq; rqs )
{
assert(rq in DhtConst.Command(),
"Cannot track stats for unknown request " ~ rq);
}
}
body
{
return ["Put", "Get", "Exists", "Remove", "Listen", "GetAll", "GetAllKeys",
"GetAllFilter", "PutBatch"];
}
/***************************************************************************
Returns:
node item (address/port) for this node
***************************************************************************/
private DhtConst.NodeItem node_item ( )
{
return DhtConst.NodeItem(this.server_config.address(), this.server_config.port());
}
/***************************************************************************
Callback for exceptions inside the node's event loop. Writes errors to
the log file.
Params:
exception = exception which occurred
event_info = info about epoll event during which exception occurred
conn = info about the connection handler where the exception
occurred
***************************************************************************/
private void nodeError ( Exception exception,
IAdvancedSelectClient.Event event_info,
DhtConnectionHandler.IConnectionHandlerInfo conn )
{
if ( cast(MessageFiber.KilledException)exception ||
cast(IOWarning)exception ||
cast(IOException)exception ||
cast(EpollException)exception )
{
// Don't log these exception types, which only occur on the normal
// disconnection of a client.
}
else if ( cast(OutOfMemoryException)exception )
{
logger.error("OutOfMemoryException caught in eventLoop");
}
else
{
this.conn_error_buf.length = 0;
enableStomping(this.conn_error_buf);
conn.formatInfo(this.conn_error_buf);
logger.error("Exception caught in eventLoop: '{}' @ {}:{} on {}",
getMsg(exception), exception.file, exception.line,
this.conn_error_buf);
}
}
/***************************************************************************
SIGINT, TERM and QUIT handler. (Called from onSignal().)
Firstly unregisters all periodics.
Secondly stops the node's select listener (stopping any more requests
from being processed) and cancels any active requests.
Thirdly calls the node's shutdown() method, shutting down the storage
channels.
Finally shuts down epoll. This will result in the run() method, above,
returning.
***************************************************************************/
private void sigintHandler ( )
{
logger.info("SIGINT handler. Shutting down.");
logger.trace("SIGINT handler: shutting down periodics");
this.timer_ext.clear();
logger.trace("SIGINT handler: shutting down periodics finished");
logger.trace("SIGINT handler: stopping node listener");
this.node.stopListener(this.epoll);
logger.trace("SIGINT handler: stopping node listener finished");
logger.trace("SIGINT handler: shutting down node");
this.node.shutdown();
logger.trace("SIGINT handler: shutting down node finished");
logger.trace("SIGINT handler: shutting down epoll");
this.epoll.shutdown();
logger.trace("SIGINT handler: shutting down epoll finished");
logger.trace("Finished SIGINT handler");
this.node.state = DhtNode.State.ShutDown;
}
version ( D_Version2 ) { }
else
{
/***********************************************************************
Called (in D1 builds) when a GC collection starts.
***********************************************************************/
private void gcCollectStart ( )
{
logger.trace("Starting GC collection");
}
/***********************************************************************
Called (in D1 builds) when a GC collection finishes.
Params:
freed = the number of bytes freed overall
pagebytes = the number of bytes freed within full pages
***********************************************************************/
private void gcCollectEnd ( int freed, int pagebytes )
{
logger.trace("Finished GC collection: {} bytes freed, {} bytes freed within full pages",
freed, pagebytes);
}
}
}
| D |
/**
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2017 by Digital Mars, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(DMDSRC _hdrgen.d)
*/
module ddmd.hdrgen;
import core.stdc.ctype;
import core.stdc.stdio;
import core.stdc.string;
import ddmd.aggregate;
import ddmd.aliasthis;
import ddmd.arraytypes;
import ddmd.attrib;
import ddmd.complex;
import ddmd.cond;
import ddmd.ctfeexpr;
import ddmd.dclass;
import ddmd.declaration;
import ddmd.denum;
import ddmd.dimport;
import ddmd.dmodule;
import ddmd.doc;
import ddmd.dstruct;
import ddmd.dsymbol;
import ddmd.dtemplate;
import ddmd.dversion;
import ddmd.expression;
import ddmd.func;
import ddmd.globals;
import ddmd.id;
import ddmd.identifier;
import ddmd.init;
import ddmd.mtype;
import ddmd.nspace;
import ddmd.parse;
import ddmd.root.ctfloat;
import ddmd.root.outbuffer;
import ddmd.root.rootobject;
import ddmd.statement;
import ddmd.staticassert;
import ddmd.target;
import ddmd.tokens;
import ddmd.utils;
import ddmd.visitor;
struct HdrGenState
{
bool hdrgen; // true if generating header file
bool ddoc; // true if generating Ddoc file
bool fullQual; // fully qualify types when printing
int tpltMember;
int autoMember;
int forStmtInit;
}
enum TEST_EMIT_ALL = 0;
extern (C++) void genhdrfile(Module m)
{
OutBuffer buf;
buf.doindent = 1;
buf.printf("// D import file generated from '%s'", m.srcfile.toChars());
buf.writenl();
HdrGenState hgs;
hgs.hdrgen = true;
toCBuffer(m, &buf, &hgs);
// Transfer image to file
m.hdrfile.setbuffer(buf.data, buf.offset);
buf.extractData();
ensurePathToNameExists(Loc(), m.hdrfile.toChars());
writeFile(m.loc, m.hdrfile);
}
extern (C++) final class PrettyPrintVisitor : Visitor
{
alias visit = super.visit;
public:
OutBuffer* buf;
HdrGenState* hgs;
bool declstring; // set while declaring alias for string,wstring or dstring
extern (D) this(OutBuffer* buf, HdrGenState* hgs)
{
this.buf = buf;
this.hgs = hgs;
}
override void visit(Statement s)
{
buf.printf("Statement::toCBuffer()");
buf.writenl();
assert(0);
}
override void visit(ErrorStatement s)
{
buf.printf("__error__");
buf.writenl();
}
override void visit(ExpStatement s)
{
if (s.exp && s.exp.op == TOKdeclaration)
{
// bypass visit(DeclarationExp)
(cast(DeclarationExp)s.exp).declaration.accept(this);
return;
}
if (s.exp)
s.exp.accept(this);
buf.writeByte(';');
if (!hgs.forStmtInit)
buf.writenl();
}
override void visit(CompileStatement s)
{
buf.writestring("mixin(");
s.exp.accept(this);
buf.writestring(");");
if (!hgs.forStmtInit)
buf.writenl();
}
override void visit(CompoundStatement s)
{
foreach (sx; *s.statements)
{
if (sx)
sx.accept(this);
}
}
override void visit(CompoundDeclarationStatement s)
{
bool anywritten = false;
foreach (sx; *s.statements)
{
auto ds = sx ? sx.isExpStatement() : null;
if (ds && ds.exp.op == TOKdeclaration)
{
auto d = (cast(DeclarationExp)ds.exp).declaration;
assert(d.isDeclaration());
if (auto v = d.isVarDeclaration())
visitVarDecl(v, anywritten);
else
d.accept(this);
anywritten = true;
}
}
buf.writeByte(';');
if (!hgs.forStmtInit)
buf.writenl();
}
override void visit(UnrolledLoopStatement s)
{
buf.writestring("unrolled {");
buf.writenl();
buf.level++;
foreach (sx; *s.statements)
{
if (sx)
sx.accept(this);
}
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(ScopeStatement s)
{
buf.writeByte('{');
buf.writenl();
buf.level++;
if (s.statement)
s.statement.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(WhileStatement s)
{
buf.writestring("while (");
s.condition.accept(this);
buf.writeByte(')');
buf.writenl();
if (s._body)
s._body.accept(this);
}
override void visit(DoStatement s)
{
buf.writestring("do");
buf.writenl();
if (s._body)
s._body.accept(this);
buf.writestring("while (");
s.condition.accept(this);
buf.writestring(");");
buf.writenl();
}
override void visit(ForStatement s)
{
buf.writestring("for (");
if (s._init)
{
hgs.forStmtInit++;
s._init.accept(this);
hgs.forStmtInit--;
}
else
buf.writeByte(';');
if (s.condition)
{
buf.writeByte(' ');
s.condition.accept(this);
}
buf.writeByte(';');
if (s.increment)
{
buf.writeByte(' ');
s.increment.accept(this);
}
buf.writeByte(')');
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
if (s._body)
s._body.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(ForeachStatement s)
{
buf.writestring(Token.toString(s.op));
buf.writestring(" (");
foreach (i, p; *s.parameters)
{
if (i)
buf.writestring(", ");
if (stcToBuffer(buf, p.storageClass))
buf.writeByte(' ');
if (p.type)
typeToBuffer(p.type, p.ident);
else
buf.writestring(p.ident.toChars());
}
buf.writestring("; ");
s.aggr.accept(this);
buf.writeByte(')');
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
if (s._body)
s._body.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(ForeachRangeStatement s)
{
buf.writestring(Token.toString(s.op));
buf.writestring(" (");
if (s.prm.type)
typeToBuffer(s.prm.type, s.prm.ident);
else
buf.writestring(s.prm.ident.toChars());
buf.writestring("; ");
s.lwr.accept(this);
buf.writestring(" .. ");
s.upr.accept(this);
buf.writeByte(')');
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
if (s._body)
s._body.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(IfStatement s)
{
buf.writestring("if (");
if (Parameter p = s.prm)
{
StorageClass stc = p.storageClass;
if (!p.type && !stc)
stc = STCauto;
if (stcToBuffer(buf, stc))
buf.writeByte(' ');
if (p.type)
typeToBuffer(p.type, p.ident);
else
buf.writestring(p.ident.toChars());
buf.writestring(" = ");
}
s.condition.accept(this);
buf.writeByte(')');
buf.writenl();
if (!s.ifbody.isScopeStatement())
buf.level++;
s.ifbody.accept(this);
if (!s.ifbody.isScopeStatement())
buf.level--;
if (s.elsebody)
{
buf.writestring("else");
buf.writenl();
if (!s.elsebody.isScopeStatement())
buf.level++;
s.elsebody.accept(this);
if (!s.elsebody.isScopeStatement())
buf.level--;
}
}
override void visit(ConditionalStatement s)
{
s.condition.accept(this);
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
if (s.ifbody)
s.ifbody.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
if (s.elsebody)
{
buf.writestring("else");
buf.writenl();
buf.writeByte('{');
buf.level++;
buf.writenl();
s.elsebody.accept(this);
buf.level--;
buf.writeByte('}');
}
buf.writenl();
}
override void visit(PragmaStatement s)
{
buf.writestring("pragma (");
buf.writestring(s.ident.toChars());
if (s.args && s.args.dim)
{
buf.writestring(", ");
argsToBuffer(s.args);
}
buf.writeByte(')');
if (s._body)
{
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
s._body.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
else
{
buf.writeByte(';');
buf.writenl();
}
}
override void visit(StaticAssertStatement s)
{
s.sa.accept(this);
}
override void visit(SwitchStatement s)
{
buf.writestring(s.isFinal ? "final switch (" : "switch (");
s.condition.accept(this);
buf.writeByte(')');
buf.writenl();
if (s._body)
{
if (!s._body.isScopeStatement())
{
buf.writeByte('{');
buf.writenl();
buf.level++;
s._body.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
else
{
s._body.accept(this);
}
}
}
override void visit(CaseStatement s)
{
buf.writestring("case ");
s.exp.accept(this);
buf.writeByte(':');
buf.writenl();
s.statement.accept(this);
}
override void visit(CaseRangeStatement s)
{
buf.writestring("case ");
s.first.accept(this);
buf.writestring(": .. case ");
s.last.accept(this);
buf.writeByte(':');
buf.writenl();
s.statement.accept(this);
}
override void visit(DefaultStatement s)
{
buf.writestring("default:");
buf.writenl();
s.statement.accept(this);
}
override void visit(GotoDefaultStatement s)
{
buf.writestring("goto default;");
buf.writenl();
}
override void visit(GotoCaseStatement s)
{
buf.writestring("goto case");
if (s.exp)
{
buf.writeByte(' ');
s.exp.accept(this);
}
buf.writeByte(';');
buf.writenl();
}
override void visit(SwitchErrorStatement s)
{
buf.writestring("SwitchErrorStatement::toCBuffer()");
buf.writenl();
}
override void visit(ReturnStatement s)
{
buf.printf("return ");
if (s.exp)
s.exp.accept(this);
buf.writeByte(';');
buf.writenl();
}
override void visit(BreakStatement s)
{
buf.writestring("break");
if (s.ident)
{
buf.writeByte(' ');
buf.writestring(s.ident.toChars());
}
buf.writeByte(';');
buf.writenl();
}
override void visit(ContinueStatement s)
{
buf.writestring("continue");
if (s.ident)
{
buf.writeByte(' ');
buf.writestring(s.ident.toChars());
}
buf.writeByte(';');
buf.writenl();
}
override void visit(SynchronizedStatement s)
{
buf.writestring("synchronized");
if (s.exp)
{
buf.writeByte('(');
s.exp.accept(this);
buf.writeByte(')');
}
if (s._body)
{
buf.writeByte(' ');
s._body.accept(this);
}
}
override void visit(WithStatement s)
{
buf.writestring("with (");
s.exp.accept(this);
buf.writestring(")");
buf.writenl();
if (s._body)
s._body.accept(this);
}
override void visit(TryCatchStatement s)
{
buf.writestring("try");
buf.writenl();
if (s._body)
s._body.accept(this);
foreach (c; *s.catches)
{
visit(c);
}
}
override void visit(TryFinallyStatement s)
{
buf.writestring("try");
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
s._body.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
buf.writestring("finally");
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
s.finalbody.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(OnScopeStatement s)
{
buf.writestring(Token.toString(s.tok));
buf.writeByte(' ');
s.statement.accept(this);
}
override void visit(ThrowStatement s)
{
buf.printf("throw ");
s.exp.accept(this);
buf.writeByte(';');
buf.writenl();
}
override void visit(DebugStatement s)
{
if (s.statement)
{
s.statement.accept(this);
}
}
override void visit(GotoStatement s)
{
buf.writestring("goto ");
buf.writestring(s.ident.toChars());
buf.writeByte(';');
buf.writenl();
}
override void visit(LabelStatement s)
{
buf.writestring(s.ident.toChars());
buf.writeByte(':');
buf.writenl();
if (s.statement)
s.statement.accept(this);
}
override void visit(AsmStatement s)
{
buf.writestring("asm { ");
Token* t = s.tokens;
buf.level++;
while (t)
{
buf.writestring(t.toChars());
if (t.next &&
t.value != TOKmin &&
t.value != TOKcomma && t.next.value != TOKcomma &&
t.value != TOKlbracket && t.next.value != TOKlbracket &&
t.next.value != TOKrbracket &&
t.value != TOKlparen && t.next.value != TOKlparen &&
t.next.value != TOKrparen &&
t.value != TOKdot && t.next.value != TOKdot)
{
buf.writeByte(' ');
}
t = t.next;
}
buf.level--;
buf.writestring("; }");
buf.writenl();
}
override void visit(ImportStatement s)
{
foreach (imp; *s.imports)
{
imp.accept(this);
}
}
void visit(Catch c)
{
buf.writestring("catch");
if (c.type)
{
buf.writeByte('(');
typeToBuffer(c.type, c.ident);
buf.writeByte(')');
}
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
if (c.handler)
c.handler.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
////////////////////////////////////////////////////////////////////////////
/**************************************************
* An entry point to pretty-print type.
*/
void typeToBuffer(Type t, Identifier ident)
{
if (t.ty == Tfunction)
{
visitFuncIdentWithPrefix(cast(TypeFunction)t, ident, null, true);
return;
}
visitWithMask(t, 0);
if (ident)
{
buf.writeByte(' ');
buf.writestring(ident.toChars());
}
}
void visitWithMask(Type t, ubyte modMask)
{
// Tuples and functions don't use the type constructor syntax
if (modMask == t.mod || t.ty == Tfunction || t.ty == Ttuple)
{
t.accept(this);
}
else
{
ubyte m = t.mod & ~(t.mod & modMask);
if (m & MODshared)
{
MODtoBuffer(buf, MODshared);
buf.writeByte('(');
}
if (m & MODwild)
{
MODtoBuffer(buf, MODwild);
buf.writeByte('(');
}
if (m & (MODconst | MODimmutable))
{
MODtoBuffer(buf, m & (MODconst | MODimmutable));
buf.writeByte('(');
}
t.accept(this);
if (m & (MODconst | MODimmutable))
buf.writeByte(')');
if (m & MODwild)
buf.writeByte(')');
if (m & MODshared)
buf.writeByte(')');
}
}
override void visit(Type t)
{
printf("t = %p, ty = %d\n", t, t.ty);
assert(0);
}
override void visit(TypeError t)
{
buf.writestring("_error_");
}
override void visit(TypeBasic t)
{
//printf("TypeBasic::toCBuffer2(t.mod = %d)\n", t.mod);
buf.writestring(t.dstring);
}
override void visit(TypeVector t)
{
//printf("TypeVector::toCBuffer2(t.mod = %d)\n", t.mod);
buf.writestring("__vector(");
visitWithMask(t.basetype, t.mod);
buf.writestring(")");
}
override void visit(TypeSArray t)
{
visitWithMask(t.next, t.mod);
buf.writeByte('[');
sizeToBuffer(t.dim);
buf.writeByte(']');
}
override void visit(TypeDArray t)
{
Type ut = t.castMod(0);
if (declstring)
goto L1;
if (ut.equals(Type.tstring))
buf.writestring("string");
else if (ut.equals(Type.twstring))
buf.writestring("wstring");
else if (ut.equals(Type.tdstring))
buf.writestring("dstring");
else
{
L1:
visitWithMask(t.next, t.mod);
buf.writestring("[]");
}
}
override void visit(TypeAArray t)
{
visitWithMask(t.next, t.mod);
buf.writeByte('[');
visitWithMask(t.index, 0);
buf.writeByte(']');
}
override void visit(TypePointer t)
{
//printf("TypePointer::toCBuffer2() next = %d\n", t.next.ty);
if (t.next.ty == Tfunction)
visitFuncIdentWithPostfix(cast(TypeFunction)t.next, "function");
else
{
visitWithMask(t.next, t.mod);
buf.writeByte('*');
}
}
override void visit(TypeReference t)
{
visitWithMask(t.next, t.mod);
buf.writeByte('&');
}
override void visit(TypeFunction t)
{
//printf("TypeFunction::toCBuffer2() t = %p, ref = %d\n", t, t.isref);
visitFuncIdentWithPostfix(t, null);
}
// callback for TypeFunction::attributesApply
struct PrePostAppendStrings
{
OutBuffer* buf;
bool isPostfixStyle;
bool isCtor;
extern (C++) static int fp(void* param, const(char)* str)
{
PrePostAppendStrings* p = cast(PrePostAppendStrings*)param;
// don't write 'ref' for ctors
if (p.isCtor && strcmp(str, "ref") == 0)
return 0;
if (p.isPostfixStyle)
p.buf.writeByte(' ');
p.buf.writestring(str);
if (!p.isPostfixStyle)
p.buf.writeByte(' ');
return 0;
}
}
void visitFuncIdentWithPostfix(TypeFunction t, const(char)* ident)
{
if (t.inuse)
{
t.inuse = 2; // flag error to caller
return;
}
t.inuse++;
PrePostAppendStrings pas;
pas.buf = buf;
pas.isCtor = false;
pas.isPostfixStyle = true;
if (t.linkage > LINKd && hgs.ddoc != 1 && !hgs.hdrgen)
{
linkageToBuffer(buf, t.linkage);
buf.writeByte(' ');
}
if (t.next)
{
typeToBuffer(t.next, null);
if (ident)
buf.writeByte(' ');
}
else if (hgs.ddoc)
buf.writestring("auto ");
if (ident)
buf.writestring(ident);
parametersToBuffer(t.parameters, t.varargs);
/* Use postfix style for attributes
*/
if (t.mod)
{
buf.writeByte(' ');
MODtoBuffer(buf, t.mod);
}
t.attributesApply(&pas, &PrePostAppendStrings.fp);
t.inuse--;
}
void visitFuncIdentWithPrefix(TypeFunction t, Identifier ident, TemplateDeclaration td, bool isPostfixStyle)
{
if (t.inuse)
{
t.inuse = 2; // flag error to caller
return;
}
t.inuse++;
PrePostAppendStrings pas;
pas.buf = buf;
pas.isCtor = (ident == Id.ctor);
pas.isPostfixStyle = false;
/* Use 'storage class' (prefix) style for attributes
*/
if (t.mod)
{
MODtoBuffer(buf, t.mod);
buf.writeByte(' ');
}
t.attributesApply(&pas, &PrePostAppendStrings.fp);
if (t.linkage > LINKd && hgs.ddoc != 1 && !hgs.hdrgen)
{
linkageToBuffer(buf, t.linkage);
buf.writeByte(' ');
}
if (ident && ident.toHChars2() != ident.toChars())
{
// Don't print return type for ctor, dtor, unittest, etc
}
else if (t.next)
{
typeToBuffer(t.next, null);
if (ident)
buf.writeByte(' ');
}
else if (hgs.ddoc)
buf.writestring("auto ");
if (ident)
buf.writestring(ident.toHChars2());
if (td)
{
buf.writeByte('(');
foreach (i, p; *td.origParameters)
{
if (i)
buf.writestring(", ");
p.accept(this);
}
buf.writeByte(')');
}
parametersToBuffer(t.parameters, t.varargs);
t.inuse--;
}
override void visit(TypeDelegate t)
{
visitFuncIdentWithPostfix(cast(TypeFunction)t.next, "delegate");
}
void visitTypeQualifiedHelper(TypeQualified t)
{
foreach (id; t.idents)
{
if (id.dyncast() == DYNCAST.dsymbol)
{
buf.writeByte('.');
TemplateInstance ti = cast(TemplateInstance)id;
ti.accept(this);
}
else if (id.dyncast() == DYNCAST.expression)
{
buf.writeByte('[');
(cast(Expression)id).accept(this);
buf.writeByte(']');
}
else if (id.dyncast() == DYNCAST.type)
{
buf.writeByte('[');
(cast(Type)id).accept(this);
buf.writeByte(']');
}
else
{
buf.writeByte('.');
buf.writestring(id.toChars());
}
}
}
override void visit(TypeIdentifier t)
{
buf.writestring(t.ident.toChars());
visitTypeQualifiedHelper(t);
}
override void visit(TypeInstance t)
{
t.tempinst.accept(this);
visitTypeQualifiedHelper(t);
}
override void visit(TypeTypeof t)
{
buf.writestring("typeof(");
t.exp.accept(this);
buf.writeByte(')');
visitTypeQualifiedHelper(t);
}
override void visit(TypeReturn t)
{
buf.writestring("typeof(return)");
visitTypeQualifiedHelper(t);
}
override void visit(TypeEnum t)
{
buf.writestring(t.sym.toChars());
}
override void visit(TypeStruct t)
{
// Bugzilla 13776: Don't use ti.toAlias() to avoid forward reference error
// while printing messages.
TemplateInstance ti = t.sym.parent ? t.sym.parent.isTemplateInstance() : null;
if (ti && ti.aliasdecl == t.sym)
buf.writestring(hgs.fullQual ? ti.toPrettyChars() : ti.toChars());
else
buf.writestring(hgs.fullQual ? t.sym.toPrettyChars() : t.sym.toChars());
}
override void visit(TypeClass t)
{
// Bugzilla 13776: Don't use ti.toAlias() to avoid forward reference error
// while printing messages.
TemplateInstance ti = t.sym.parent.isTemplateInstance();
if (ti && ti.aliasdecl == t.sym)
buf.writestring(hgs.fullQual ? ti.toPrettyChars() : ti.toChars());
else
buf.writestring(hgs.fullQual ? t.sym.toPrettyChars() : t.sym.toChars());
}
override void visit(TypeTuple t)
{
parametersToBuffer(t.arguments, 0);
}
override void visit(TypeSlice t)
{
visitWithMask(t.next, t.mod);
buf.writeByte('[');
sizeToBuffer(t.lwr);
buf.writestring(" .. ");
sizeToBuffer(t.upr);
buf.writeByte(']');
}
override void visit(TypeNull t)
{
buf.writestring("typeof(null)");
}
////////////////////////////////////////////////////////////////////////////
override void visit(Dsymbol s)
{
buf.writestring(s.toChars());
}
override void visit(StaticAssert s)
{
buf.writestring(s.kind());
buf.writeByte('(');
s.exp.accept(this);
if (s.msg)
{
buf.writestring(", ");
s.msg.accept(this);
}
buf.writestring(");");
buf.writenl();
}
override void visit(DebugSymbol s)
{
buf.writestring("debug = ");
if (s.ident)
buf.writestring(s.ident.toChars());
else
buf.printf("%u", s.level);
buf.writestring(";");
buf.writenl();
}
override void visit(VersionSymbol s)
{
buf.writestring("version = ");
if (s.ident)
buf.writestring(s.ident.toChars());
else
buf.printf("%u", s.level);
buf.writestring(";");
buf.writenl();
}
override void visit(EnumMember em)
{
if (em.type)
typeToBuffer(em.type, em.ident);
else
buf.writestring(em.ident.toChars());
if (em.value)
{
buf.writestring(" = ");
em.value.accept(this);
}
}
override void visit(Import imp)
{
if (hgs.hdrgen && imp.id == Id.object)
return; // object is imported by default
if (imp.isstatic)
buf.writestring("static ");
buf.writestring("import ");
if (imp.aliasId)
{
buf.printf("%s = ", imp.aliasId.toChars());
}
if (imp.packages && imp.packages.dim)
{
foreach (const pid; *imp.packages)
{
buf.printf("%s.", pid.toChars());
}
}
buf.printf("%s", imp.id.toChars());
if (imp.names.dim)
{
buf.writestring(" : ");
foreach (const i, const name; imp.names)
{
if (i)
buf.writestring(", ");
const _alias = imp.aliases[i];
if (_alias)
buf.printf("%s = %s", _alias.toChars(), name.toChars());
else
buf.printf("%s", name.toChars());
}
}
buf.printf(";");
buf.writenl();
}
override void visit(AliasThis d)
{
buf.writestring("alias ");
buf.writestring(d.ident.toChars());
buf.writestring(" this;\n");
}
override void visit(AttribDeclaration d)
{
if (!d.decl)
{
buf.writeByte(';');
buf.writenl();
return;
}
if (d.decl.dim == 0)
buf.writestring("{}");
else if (hgs.hdrgen && d.decl.dim == 1 && (*d.decl)[0].isUnitTestDeclaration())
{
// hack for bugzilla 8081
buf.writestring("{}");
}
else if (d.decl.dim == 1)
{
(*d.decl)[0].accept(this);
return;
}
else
{
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (de; *d.decl)
de.accept(this);
buf.level--;
buf.writeByte('}');
}
buf.writenl();
}
override void visit(StorageClassDeclaration d)
{
if (stcToBuffer(buf, d.stc))
buf.writeByte(' ');
visit(cast(AttribDeclaration)d);
}
override void visit(DeprecatedDeclaration d)
{
buf.writestring("deprecated(");
d.msg.accept(this);
buf.writestring(") ");
visit(cast(AttribDeclaration)d);
}
override void visit(LinkDeclaration d)
{
const(char)* p;
switch (d.linkage)
{
case LINKd:
p = "D";
break;
case LINKc:
p = "C";
break;
case LINKcpp:
p = "C++";
break;
case LINKwindows:
p = "Windows";
break;
case LINKpascal:
p = "Pascal";
break;
case LINKobjc:
p = "Objective-C";
break;
default:
assert(0);
}
buf.writestring("extern (");
buf.writestring(p);
buf.writestring(") ");
visit(cast(AttribDeclaration)d);
}
override void visit(CPPMangleDeclaration d)
{
const(char)* p;
switch (d.cppmangle)
{
case CPPMANGLE.asClass:
p = "class";
break;
case CPPMANGLE.asStruct:
p = "struct";
break;
default:
assert(0);
}
buf.writestring("extern (C++, ");
buf.writestring(p);
buf.writestring(") ");
visit(cast(AttribDeclaration)d);
}
override void visit(ProtDeclaration d)
{
protectionToBuffer(buf, d.protection);
buf.writeByte(' ');
visit(cast(AttribDeclaration)d);
}
override void visit(AlignDeclaration d)
{
if (!d.ealign)
buf.printf("align ");
else
buf.printf("align (%s) ", d.ealign.toChars());
visit(cast(AttribDeclaration)d);
}
override void visit(AnonDeclaration d)
{
buf.printf(d.isunion ? "union" : "struct");
buf.writenl();
buf.writestring("{");
buf.writenl();
buf.level++;
if (d.decl)
{
foreach (de; *d.decl)
de.accept(this);
}
buf.level--;
buf.writestring("}");
buf.writenl();
}
override void visit(PragmaDeclaration d)
{
buf.printf("pragma (%s", d.ident.toChars());
if (d.args && d.args.dim)
{
buf.writestring(", ");
argsToBuffer(d.args);
}
buf.writeByte(')');
visit(cast(AttribDeclaration)d);
}
override void visit(ConditionalDeclaration d)
{
d.condition.accept(this);
if (d.decl || d.elsedecl)
{
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
if (d.decl)
{
foreach (de; *d.decl)
de.accept(this);
}
buf.level--;
buf.writeByte('}');
if (d.elsedecl)
{
buf.writenl();
buf.writestring("else");
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (de; *d.elsedecl)
de.accept(this);
buf.level--;
buf.writeByte('}');
}
}
else
buf.writeByte(':');
buf.writenl();
}
override void visit(CompileDeclaration d)
{
buf.writestring("mixin(");
d.exp.accept(this);
buf.writestring(");");
buf.writenl();
}
override void visit(UserAttributeDeclaration d)
{
buf.writestring("@(");
argsToBuffer(d.atts);
buf.writeByte(')');
visit(cast(AttribDeclaration)d);
}
override void visit(TemplateDeclaration d)
{
version (none)
{
// Should handle template functions for doc generation
if (onemember && onemember.isFuncDeclaration())
buf.writestring("foo ");
}
if (hgs.hdrgen && visitEponymousMember(d))
return;
if (hgs.ddoc)
buf.writestring(d.kind());
else
buf.writestring("template");
buf.writeByte(' ');
buf.writestring(d.ident.toChars());
buf.writeByte('(');
visitTemplateParameters(hgs.ddoc ? d.origParameters : d.parameters);
buf.writeByte(')');
visitTemplateConstraint(d.constraint);
if (hgs.hdrgen)
{
hgs.tpltMember++;
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (s; *d.members)
s.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
hgs.tpltMember--;
}
}
bool visitEponymousMember(TemplateDeclaration d)
{
if (!d.members || d.members.dim != 1)
return false;
Dsymbol onemember = (*d.members)[0];
if (onemember.ident != d.ident)
return false;
if (FuncDeclaration fd = onemember.isFuncDeclaration())
{
assert(fd.type);
if (stcToBuffer(buf, fd.storage_class))
buf.writeByte(' ');
functionToBufferFull(cast(TypeFunction)fd.type, buf, d.ident, hgs, d);
visitTemplateConstraint(d.constraint);
hgs.tpltMember++;
bodyToBuffer(fd);
hgs.tpltMember--;
return true;
}
if (AggregateDeclaration ad = onemember.isAggregateDeclaration())
{
buf.writestring(ad.kind());
buf.writeByte(' ');
buf.writestring(ad.ident.toChars());
buf.writeByte('(');
visitTemplateParameters(hgs.ddoc ? d.origParameters : d.parameters);
buf.writeByte(')');
visitTemplateConstraint(d.constraint);
visitBaseClasses(ad.isClassDeclaration());
hgs.tpltMember++;
if (ad.members)
{
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (s; *ad.members)
s.accept(this);
buf.level--;
buf.writeByte('}');
}
else
buf.writeByte(';');
buf.writenl();
hgs.tpltMember--;
return true;
}
if (VarDeclaration vd = onemember.isVarDeclaration())
{
if (d.constraint)
return false;
if (stcToBuffer(buf, vd.storage_class))
buf.writeByte(' ');
if (vd.type)
typeToBuffer(vd.type, vd.ident);
else
buf.writestring(vd.ident.toChars());
buf.writeByte('(');
visitTemplateParameters(hgs.ddoc ? d.origParameters : d.parameters);
buf.writeByte(')');
if (vd._init)
{
buf.writestring(" = ");
ExpInitializer ie = vd._init.isExpInitializer();
if (ie && (ie.exp.op == TOKconstruct || ie.exp.op == TOKblit))
(cast(AssignExp)ie.exp).e2.accept(this);
else
vd._init.accept(this);
}
buf.writeByte(';');
buf.writenl();
return true;
}
return false;
}
void visitTemplateParameters(TemplateParameters* parameters)
{
if (!parameters || !parameters.dim)
return;
foreach (i, p; *parameters)
{
if (i)
buf.writestring(", ");
p.accept(this);
}
}
void visitTemplateConstraint(Expression constraint)
{
if (!constraint)
return;
buf.writestring(" if (");
constraint.accept(this);
buf.writeByte(')');
}
override void visit(TemplateInstance ti)
{
buf.writestring(ti.name.toChars());
tiargsToBuffer(ti);
}
override void visit(TemplateMixin tm)
{
buf.writestring("mixin ");
typeToBuffer(tm.tqual, null);
tiargsToBuffer(tm);
if (tm.ident && memcmp(tm.ident.toChars(), cast(const(char)*)"__mixin", 7) != 0)
{
buf.writeByte(' ');
buf.writestring(tm.ident.toChars());
}
buf.writeByte(';');
buf.writenl();
}
void tiargsToBuffer(TemplateInstance ti)
{
buf.writeByte('!');
if (ti.nest)
{
buf.writestring("(...)");
return;
}
if (!ti.tiargs)
{
buf.writestring("()");
return;
}
if (ti.tiargs.dim == 1)
{
RootObject oarg = (*ti.tiargs)[0];
if (Type t = isType(oarg))
{
if (t.equals(Type.tstring) || t.equals(Type.twstring) || t.equals(Type.tdstring) || t.mod == 0 && (t.isTypeBasic() || t.ty == Tident && (cast(TypeIdentifier)t).idents.dim == 0))
{
buf.writestring(t.toChars());
return;
}
}
else if (Expression e = isExpression(oarg))
{
if (e.op == TOKint64 || e.op == TOKfloat64 || e.op == TOKnull || e.op == TOKstring || e.op == TOKthis)
{
buf.writestring(e.toChars());
return;
}
}
}
buf.writeByte('(');
ti.nest++;
foreach (i, arg; *ti.tiargs)
{
if (i)
buf.writestring(", ");
objectToBuffer(arg);
}
ti.nest--;
buf.writeByte(')');
}
/****************************************
* This makes a 'pretty' version of the template arguments.
* It's analogous to genIdent() which makes a mangled version.
*/
void objectToBuffer(RootObject oarg)
{
//printf("objectToBuffer()\n");
/* The logic of this should match what genIdent() does. The _dynamic_cast()
* function relies on all the pretty strings to be unique for different classes
* (see Bugzilla 7375).
* Perhaps it would be better to demangle what genIdent() does.
*/
if (auto t = isType(oarg))
{
//printf("\tt: %s ty = %d\n", t.toChars(), t.ty);
typeToBuffer(t, null);
}
else if (auto e = isExpression(oarg))
{
if (e.op == TOKvar)
e = e.optimize(WANTvalue); // added to fix Bugzilla 7375
e.accept(this);
}
else if (Dsymbol s = isDsymbol(oarg))
{
const p = s.ident ? s.ident.toChars() : s.toChars();
buf.writestring(p);
}
else if (auto v = isTuple(oarg))
{
auto args = &v.objects;
foreach (i, arg; *args)
{
if (i)
buf.writestring(", ");
objectToBuffer(arg);
}
}
else if (!oarg)
{
buf.writestring("NULL");
}
else
{
debug
{
printf("bad Object = %p\n", oarg);
}
assert(0);
}
}
override void visit(EnumDeclaration d)
{
buf.writestring("enum ");
if (d.ident)
{
buf.writestring(d.ident.toChars());
buf.writeByte(' ');
}
if (d.memtype)
{
buf.writestring(": ");
typeToBuffer(d.memtype, null);
}
if (!d.members)
{
buf.writeByte(';');
buf.writenl();
return;
}
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (em; *d.members)
{
if (!em)
continue;
em.accept(this);
buf.writeByte(',');
buf.writenl();
}
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(Nspace d)
{
buf.writestring("extern (C++, ");
buf.writestring(d.ident.toChars());
buf.writeByte(')');
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (s; *d.members)
s.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(StructDeclaration d)
{
buf.printf("%s ", d.kind());
if (!d.isAnonymous())
buf.writestring(d.toChars());
if (!d.members)
{
buf.writeByte(';');
buf.writenl();
return;
}
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (s; *d.members)
s.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
}
override void visit(ClassDeclaration d)
{
if (!d.isAnonymous())
{
buf.writestring(d.kind());
buf.writeByte(' ');
buf.writestring(d.ident.toChars());
}
visitBaseClasses(d);
if (d.members)
{
buf.writenl();
buf.writeByte('{');
buf.writenl();
buf.level++;
foreach (s; *d.members)
s.accept(this);
buf.level--;
buf.writeByte('}');
}
else
buf.writeByte(';');
buf.writenl();
}
void visitBaseClasses(ClassDeclaration d)
{
if (!d || !d.baseclasses.dim)
return;
buf.writestring(" : ");
foreach (i, b; *d.baseclasses)
{
if (i)
buf.writestring(", ");
typeToBuffer(b.type, null);
}
}
override void visit(AliasDeclaration d)
{
buf.writestring("alias ");
if (d.aliassym)
{
buf.writestring(d.ident.toChars());
buf.writestring(" = ");
if (stcToBuffer(buf, d.storage_class))
buf.writeByte(' ');
d.aliassym.accept(this);
}
else if (d.type.ty == Tfunction)
{
if (stcToBuffer(buf, d.storage_class))
buf.writeByte(' ');
typeToBuffer(d.type, d.ident);
}
else
{
declstring = (d.ident == Id.string || d.ident == Id.wstring || d.ident == Id.dstring);
buf.writestring(d.ident.toChars());
buf.writestring(" = ");
if (stcToBuffer(buf, d.storage_class))
buf.writeByte(' ');
typeToBuffer(d.type, null);
declstring = false;
}
buf.writeByte(';');
buf.writenl();
}
override void visit(VarDeclaration d)
{
visitVarDecl(d, false);
buf.writeByte(';');
buf.writenl();
}
void visitVarDecl(VarDeclaration v, bool anywritten)
{
if (anywritten)
{
buf.writestring(", ");
buf.writestring(v.ident.toChars());
}
else
{
if (stcToBuffer(buf, v.storage_class))
buf.writeByte(' ');
if (v.type)
typeToBuffer(v.type, v.ident);
else
buf.writestring(v.ident.toChars());
}
if (v._init)
{
buf.writestring(" = ");
auto ie = v._init.isExpInitializer();
if (ie && (ie.exp.op == TOKconstruct || ie.exp.op == TOKblit))
(cast(AssignExp)ie.exp).e2.accept(this);
else
v._init.accept(this);
}
}
override void visit(FuncDeclaration f)
{
//printf("FuncDeclaration::toCBuffer() '%s'\n", f.toChars());
if (stcToBuffer(buf, f.storage_class))
buf.writeByte(' ');
auto tf = cast(TypeFunction)f.type;
typeToBuffer(tf, f.ident);
if (hgs.hdrgen == 1)
{
// if the return type is missing (e.g. ref functions or auto)
if (!tf.next || f.storage_class & STCauto)
{
hgs.autoMember++;
bodyToBuffer(f);
hgs.autoMember--;
}
else if (hgs.tpltMember == 0 && global.params.hdrStripPlainFunctions)
{
buf.writeByte(';');
buf.writenl();
}
else
bodyToBuffer(f);
}
else
bodyToBuffer(f);
}
void bodyToBuffer(FuncDeclaration f)
{
if (!f.fbody || (hgs.hdrgen && global.params.hdrStripPlainFunctions && !hgs.autoMember && !hgs.tpltMember))
{
buf.writeByte(';');
buf.writenl();
return;
}
int savetlpt = hgs.tpltMember;
int saveauto = hgs.autoMember;
hgs.tpltMember = 0;
hgs.autoMember = 0;
buf.writenl();
// in{}
if (f.frequire)
{
buf.writestring("in");
buf.writenl();
f.frequire.accept(this);
}
// out{}
if (f.fensure)
{
buf.writestring("out");
if (f.outId)
{
buf.writeByte('(');
buf.writestring(f.outId.toChars());
buf.writeByte(')');
}
buf.writenl();
f.fensure.accept(this);
}
if (f.frequire || f.fensure)
{
buf.writestring("body");
buf.writenl();
}
buf.writeByte('{');
buf.writenl();
buf.level++;
f.fbody.accept(this);
buf.level--;
buf.writeByte('}');
buf.writenl();
hgs.tpltMember = savetlpt;
hgs.autoMember = saveauto;
}
override void visit(FuncLiteralDeclaration f)
{
if (f.type.ty == Terror)
{
buf.writestring("__error");
return;
}
if (f.tok != TOKreserved)
{
buf.writestring(f.kind());
buf.writeByte(' ');
}
TypeFunction tf = cast(TypeFunction)f.type;
// Don't print tf.mod, tf.trust, and tf.linkage
if (!f.inferRetType && tf.next)
typeToBuffer(tf.next, null);
parametersToBuffer(tf.parameters, tf.varargs);
CompoundStatement cs = f.fbody.isCompoundStatement();
Statement s1;
if (f.semanticRun >= PASSsemantic3done && cs)
{
s1 = (*cs.statements)[cs.statements.dim - 1];
}
else
s1 = !cs ? f.fbody : null;
ReturnStatement rs = s1 ? s1.isReturnStatement() : null;
if (rs && rs.exp)
{
buf.writestring(" => ");
rs.exp.accept(this);
}
else
{
hgs.tpltMember++;
bodyToBuffer(f);
hgs.tpltMember--;
}
}
override void visit(PostBlitDeclaration d)
{
if (stcToBuffer(buf, d.storage_class))
buf.writeByte(' ');
buf.writestring("this(this)");
bodyToBuffer(d);
}
override void visit(DtorDeclaration d)
{
if (d.storage_class & STCtrusted)
buf.writestring("@trusted ");
if (d.storage_class & STCsafe)
buf.writestring("@safe ");
if (d.storage_class & STCnogc)
buf.writestring("@nogc ");
if (d.storage_class & STCdisable)
buf.writestring("@disable ");
buf.writestring("~this()");
bodyToBuffer(d);
}
override void visit(StaticCtorDeclaration d)
{
if (stcToBuffer(buf, d.storage_class & ~STCstatic))
buf.writeByte(' ');
if (d.isSharedStaticCtorDeclaration())
buf.writestring("shared ");
buf.writestring("static this()");
if (hgs.hdrgen && !hgs.tpltMember)
{
buf.writeByte(';');
buf.writenl();
}
else
bodyToBuffer(d);
}
override void visit(StaticDtorDeclaration d)
{
if (hgs.hdrgen)
return;
if (stcToBuffer(buf, d.storage_class & ~STCstatic))
buf.writeByte(' ');
if (d.isSharedStaticDtorDeclaration())
buf.writestring("shared ");
buf.writestring("static ~this()");
bodyToBuffer(d);
}
override void visit(InvariantDeclaration d)
{
if (hgs.hdrgen)
return;
if (stcToBuffer(buf, d.storage_class))
buf.writeByte(' ');
buf.writestring("invariant");
bodyToBuffer(d);
}
override void visit(UnitTestDeclaration d)
{
if (hgs.hdrgen)
return;
if (stcToBuffer(buf, d.storage_class))
buf.writeByte(' ');
buf.writestring("unittest");
bodyToBuffer(d);
}
override void visit(NewDeclaration d)
{
if (stcToBuffer(buf, d.storage_class & ~STCstatic))
buf.writeByte(' ');
buf.writestring("new");
parametersToBuffer(d.parameters, d.varargs);
bodyToBuffer(d);
}
override void visit(DeleteDeclaration d)
{
if (stcToBuffer(buf, d.storage_class & ~STCstatic))
buf.writeByte(' ');
buf.writestring("delete");
parametersToBuffer(d.parameters, 0);
bodyToBuffer(d);
}
////////////////////////////////////////////////////////////////////////////
override void visit(ErrorInitializer iz)
{
buf.writestring("__error__");
}
override void visit(VoidInitializer iz)
{
buf.writestring("void");
}
override void visit(StructInitializer si)
{
//printf("StructInitializer::toCBuffer()\n");
buf.writeByte('{');
foreach (i, const id; si.field)
{
if (i)
buf.writestring(", ");
if (id)
{
buf.writestring(id.toChars());
buf.writeByte(':');
}
if (auto iz = si.value[i])
iz.accept(this);
}
buf.writeByte('}');
}
override void visit(ArrayInitializer ai)
{
buf.writeByte('[');
foreach (i, ex; ai.index)
{
if (i)
buf.writestring(", ");
if (ex)
{
ex.accept(this);
buf.writeByte(':');
}
if (auto iz = ai.value[i])
iz.accept(this);
}
buf.writeByte(']');
}
override void visit(ExpInitializer ei)
{
ei.exp.accept(this);
}
////////////////////////////////////////////////////////////////////////////
/**************************************************
* Write out argument list to buf.
*/
void argsToBuffer(Expressions* expressions, Expression basis = null)
{
if (!expressions || !expressions.dim)
return;
version (all)
{
foreach (i, el; *expressions)
{
if (i)
buf.writestring(", ");
if (!el)
el = basis;
if (el)
expToBuffer(el, PREC.assign);
}
}
else
{
// Sparse style formatting, for debug use only
// [0..dim: basis, 1: e1, 5: e5]
if (basis)
{
buf.printf("0..%llu: ", cast(ulong)expressions.dim);
expToBuffer(basis, PREC.assign);
}
foreach (i, el; *expressions)
{
if (el)
{
if (basis)
buf.printf(", %llu: ", cast(ulong)i);
else if (i)
buf.writestring(", ");
expToBuffer(el, PREC.assign);
}
}
}
}
void sizeToBuffer(Expression e)
{
if (e.type == Type.tsize_t)
{
Expression ex = (e.op == TOKcast ? (cast(CastExp)e).e1 : e);
ex = ex.optimize(WANTvalue);
dinteger_t uval = ex.op == TOKint64 ? ex.toInteger() : cast(dinteger_t)-1;
if (cast(sinteger_t)uval >= 0)
{
dinteger_t sizemax;
if (Target.ptrsize == 4)
sizemax = 0xFFFFFFFFU;
else if (Target.ptrsize == 8)
sizemax = 0xFFFFFFFFFFFFFFFFUL;
else
assert(0);
if (uval <= sizemax && uval <= 0x7FFFFFFFFFFFFFFFUL)
{
buf.printf("%llu", uval);
return;
}
}
}
expToBuffer(e, PREC.assign);
}
/**************************************************
* Write expression out to buf, but wrap it
* in ( ) if its precedence is less than pr.
*/
void expToBuffer(Expression e, PREC pr)
{
debug
{
if (precedence[e.op] == PREC.zero)
printf("precedence not defined for token '%s'\n", Token.toChars(e.op));
}
assert(precedence[e.op] != PREC.zero);
assert(pr != PREC.zero);
//if (precedence[e.op] == 0) e.print();
/* Despite precedence, we don't allow a<b<c expressions.
* They must be parenthesized.
*/
if (precedence[e.op] < pr || (pr == PREC.rel && precedence[e.op] == pr))
{
buf.writeByte('(');
e.accept(this);
buf.writeByte(')');
}
else
e.accept(this);
}
override void visit(Expression e)
{
buf.writestring(Token.toString(e.op));
}
override void visit(IntegerExp e)
{
dinteger_t v = e.toInteger();
if (e.type)
{
Type t = e.type;
L1:
switch (t.ty)
{
case Tenum:
{
TypeEnum te = cast(TypeEnum)t;
buf.printf("cast(%s)", te.sym.toChars());
t = te.sym.memtype;
goto L1;
}
case Twchar:
// BUG: need to cast(wchar)
case Tdchar:
// BUG: need to cast(dchar)
if (cast(uinteger_t)v > 0xFF)
{
buf.printf("'\\U%08x'", v);
break;
}
goto case;
case Tchar:
{
size_t o = buf.offset;
if (v == '\'')
buf.writestring("'\\''");
else if (isprint(cast(int)v) && v != '\\')
buf.printf("'%c'", cast(int)v);
else
buf.printf("'\\x%02x'", cast(int)v);
if (hgs.ddoc)
escapeDdocString(buf, o);
break;
}
case Tint8:
buf.writestring("cast(byte)");
goto L2;
case Tint16:
buf.writestring("cast(short)");
goto L2;
case Tint32:
L2:
buf.printf("%d", cast(int)v);
break;
case Tuns8:
buf.writestring("cast(ubyte)");
goto L3;
case Tuns16:
buf.writestring("cast(ushort)");
goto L3;
case Tuns32:
L3:
buf.printf("%uu", cast(uint)v);
break;
case Tint64:
buf.printf("%lldL", v);
break;
case Tuns64:
L4:
buf.printf("%lluLU", v);
break;
case Tbool:
buf.writestring(v ? "true" : "false");
break;
case Tpointer:
buf.writestring("cast(");
buf.writestring(t.toChars());
buf.writeByte(')');
if (Target.ptrsize == 4)
goto L3;
else if (Target.ptrsize == 8)
goto L4;
else
assert(0);
default:
/* This can happen if errors, such as
* the type is painted on like in fromConstInitializer().
*/
if (!global.errors)
{
debug
{
t.print();
}
assert(0);
}
break;
}
}
else if (v & 0x8000000000000000L)
buf.printf("0x%llx", v);
else
buf.printf("%lld", v);
}
override void visit(ErrorExp e)
{
buf.writestring("__error");
}
void floatToBuffer(Type type, real_t value)
{
/** sizeof(value)*3 is because each byte of mantissa is max
of 256 (3 characters). The string will be "-M.MMMMe-4932".
(ie, 8 chars more than mantissa). Plus one for trailing \0.
Plus one for rounding. */
const(size_t) BUFFER_LEN = value.sizeof * 3 + 8 + 1 + 1;
char[BUFFER_LEN] buffer;
CTFloat.sprint(buffer.ptr, 'g', value);
assert(strlen(buffer.ptr) < BUFFER_LEN);
if (hgs.hdrgen)
{
real_t r = CTFloat.parse(buffer.ptr);
if (r != value) // if exact duplication
CTFloat.sprint(buffer.ptr, 'a', value);
}
buf.writestring(buffer.ptr);
if (type)
{
Type t = type.toBasetype();
switch (t.ty)
{
case Tfloat32:
case Timaginary32:
case Tcomplex32:
buf.writeByte('F');
break;
case Tfloat80:
case Timaginary80:
case Tcomplex80:
buf.writeByte('L');
break;
default:
break;
}
if (t.isimaginary())
buf.writeByte('i');
}
}
override void visit(RealExp e)
{
floatToBuffer(e.type, e.value);
}
override void visit(ComplexExp e)
{
/* Print as:
* (re+imi)
*/
buf.writeByte('(');
floatToBuffer(e.type, creall(e.value));
buf.writeByte('+');
floatToBuffer(e.type, cimagl(e.value));
buf.writestring("i)");
}
override void visit(IdentifierExp e)
{
if (hgs.hdrgen || hgs.ddoc)
buf.writestring(e.ident.toHChars2());
else
buf.writestring(e.ident.toChars());
}
override void visit(DsymbolExp e)
{
buf.writestring(e.s.toChars());
}
override void visit(ThisExp e)
{
buf.writestring("this");
}
override void visit(SuperExp e)
{
buf.writestring("super");
}
override void visit(NullExp e)
{
buf.writestring("null");
}
override void visit(StringExp e)
{
buf.writeByte('"');
size_t o = buf.offset;
for (size_t i = 0; i < e.len; i++)
{
uint c = e.charAt(i);
switch (c)
{
case '"':
case '\\':
buf.writeByte('\\');
goto default;
default:
if (c <= 0xFF)
{
if (c <= 0x7F && isprint(c))
buf.writeByte(c);
else
buf.printf("\\x%02x", c);
}
else if (c <= 0xFFFF)
buf.printf("\\x%02x\\x%02x", c & 0xFF, c >> 8);
else
buf.printf("\\x%02x\\x%02x\\x%02x\\x%02x", c & 0xFF, (c >> 8) & 0xFF, (c >> 16) & 0xFF, c >> 24);
break;
}
}
if (hgs.ddoc)
escapeDdocString(buf, o);
buf.writeByte('"');
if (e.postfix)
buf.writeByte(e.postfix);
}
override void visit(ArrayLiteralExp e)
{
buf.writeByte('[');
argsToBuffer(e.elements, e.basis);
buf.writeByte(']');
}
override void visit(AssocArrayLiteralExp e)
{
buf.writeByte('[');
foreach (i, key; *e.keys)
{
if (i)
buf.writestring(", ");
expToBuffer(key, PREC.assign);
buf.writeByte(':');
auto value = (*e.values)[i];
expToBuffer(value, PREC.assign);
}
buf.writeByte(']');
}
override void visit(StructLiteralExp e)
{
buf.writestring(e.sd.toChars());
buf.writeByte('(');
// CTFE can generate struct literals that contain an AddrExp pointing
// to themselves, need to avoid infinite recursion:
// struct S { this(int){ this.s = &this; } S* s; }
// const foo = new S(0);
if (e.stageflags & stageToCBuffer)
buf.writestring("<recursion>");
else
{
int old = e.stageflags;
e.stageflags |= stageToCBuffer;
argsToBuffer(e.elements);
e.stageflags = old;
}
buf.writeByte(')');
}
override void visit(TypeExp e)
{
typeToBuffer(e.type, null);
}
override void visit(ScopeExp e)
{
if (e.sds.isTemplateInstance())
{
e.sds.accept(this);
}
else if (hgs !is null && hgs.ddoc)
{
// fixes bug 6491
Module m = e.sds.isModule();
if (m)
buf.writestring(m.md.toChars());
else
buf.writestring(e.sds.toChars());
}
else
{
buf.writestring(e.sds.kind());
buf.writeByte(' ');
buf.writestring(e.sds.toChars());
}
}
override void visit(TemplateExp e)
{
buf.writestring(e.td.toChars());
}
override void visit(NewExp e)
{
if (e.thisexp)
{
expToBuffer(e.thisexp, PREC.primary);
buf.writeByte('.');
}
buf.writestring("new ");
if (e.newargs && e.newargs.dim)
{
buf.writeByte('(');
argsToBuffer(e.newargs);
buf.writeByte(')');
}
typeToBuffer(e.newtype, null);
if (e.arguments && e.arguments.dim)
{
buf.writeByte('(');
argsToBuffer(e.arguments);
buf.writeByte(')');
}
}
override void visit(NewAnonClassExp e)
{
if (e.thisexp)
{
expToBuffer(e.thisexp, PREC.primary);
buf.writeByte('.');
}
buf.writestring("new");
if (e.newargs && e.newargs.dim)
{
buf.writeByte('(');
argsToBuffer(e.newargs);
buf.writeByte(')');
}
buf.writestring(" class ");
if (e.arguments && e.arguments.dim)
{
buf.writeByte('(');
argsToBuffer(e.arguments);
buf.writeByte(')');
}
if (e.cd)
e.cd.accept(this);
}
override void visit(SymOffExp e)
{
if (e.offset)
buf.printf("(& %s+%u)", e.var.toChars(), e.offset);
else if (e.var.isTypeInfoDeclaration())
buf.printf("%s", e.var.toChars());
else
buf.printf("& %s", e.var.toChars());
}
override void visit(VarExp e)
{
buf.writestring(e.var.toChars());
}
override void visit(OverExp e)
{
buf.writestring(e.vars.ident.toChars());
}
override void visit(TupleExp e)
{
if (e.e0)
{
buf.writeByte('(');
e.e0.accept(this);
buf.writestring(", tuple(");
argsToBuffer(e.exps);
buf.writestring("))");
}
else
{
buf.writestring("tuple(");
argsToBuffer(e.exps);
buf.writeByte(')');
}
}
override void visit(FuncExp e)
{
e.fd.accept(this);
//buf.writestring(e.fd.toChars());
}
override void visit(DeclarationExp e)
{
/* Normal dmd execution won't reach here - regular variable declarations
* are handled in visit(ExpStatement), so here would be used only when
* we'll directly call Expression.toChars() for debugging.
*/
if (auto v = e.declaration.isVarDeclaration())
{
// For debugging use:
// - Avoid printing newline.
// - Intentionally use the format (Type var;)
// which isn't correct as regular D code.
buf.writeByte('(');
visitVarDecl(v, false);
buf.writeByte(';');
buf.writeByte(')');
}
else
e.declaration.accept(this);
}
override void visit(TypeidExp e)
{
buf.writestring("typeid(");
objectToBuffer(e.obj);
buf.writeByte(')');
}
override void visit(TraitsExp e)
{
buf.writestring("__traits(");
buf.writestring(e.ident.toChars());
if (e.args)
{
foreach (arg; *e.args)
{
buf.writestring(", ");
objectToBuffer(arg);
}
}
buf.writeByte(')');
}
override void visit(HaltExp e)
{
buf.writestring("halt");
}
override void visit(IsExp e)
{
buf.writestring("is(");
typeToBuffer(e.targ, e.id);
if (e.tok2 != TOKreserved)
{
buf.printf(" %s %s", Token.toChars(e.tok), Token.toChars(e.tok2));
}
else if (e.tspec)
{
if (e.tok == TOKcolon)
buf.writestring(" : ");
else
buf.writestring(" == ");
typeToBuffer(e.tspec, null);
}
if (e.parameters && e.parameters.dim)
{
buf.writestring(", ");
visitTemplateParameters(e.parameters);
}
buf.writeByte(')');
}
override void visit(UnaExp e)
{
buf.writestring(Token.toString(e.op));
expToBuffer(e.e1, precedence[e.op]);
}
override void visit(BinExp e)
{
expToBuffer(e.e1, precedence[e.op]);
buf.writeByte(' ');
buf.writestring(Token.toString(e.op));
buf.writeByte(' ');
expToBuffer(e.e2, cast(PREC)(precedence[e.op] + 1));
}
override void visit(CompileExp e)
{
buf.writestring("mixin(");
expToBuffer(e.e1, PREC.assign);
buf.writeByte(')');
}
override void visit(ImportExp e)
{
buf.writestring("import(");
expToBuffer(e.e1, PREC.assign);
buf.writeByte(')');
}
override void visit(AssertExp e)
{
buf.writestring("assert(");
expToBuffer(e.e1, PREC.assign);
if (e.msg)
{
buf.writestring(", ");
expToBuffer(e.msg, PREC.assign);
}
buf.writeByte(')');
}
override void visit(DotIdExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
buf.writestring(e.ident.toChars());
}
override void visit(DotTemplateExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
buf.writestring(e.td.toChars());
}
override void visit(DotVarExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
buf.writestring(e.var.toChars());
}
override void visit(DotTemplateInstanceExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
e.ti.accept(this);
}
override void visit(DelegateExp e)
{
buf.writeByte('&');
if (!e.func.isNested())
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
}
buf.writestring(e.func.toChars());
}
override void visit(DotTypeExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
buf.writestring(e.sym.toChars());
}
override void visit(CallExp e)
{
if (e.e1.op == TOKtype)
{
/* Avoid parens around type to prevent forbidden cast syntax:
* (sometype)(arg1)
* This is ok since types in constructor calls
* can never depend on parens anyway
*/
e.e1.accept(this);
}
else
expToBuffer(e.e1, precedence[e.op]);
buf.writeByte('(');
argsToBuffer(e.arguments);
buf.writeByte(')');
}
override void visit(PtrExp e)
{
buf.writeByte('*');
expToBuffer(e.e1, precedence[e.op]);
}
override void visit(DeleteExp e)
{
buf.writestring("delete ");
expToBuffer(e.e1, precedence[e.op]);
}
override void visit(CastExp e)
{
buf.writestring("cast(");
if (e.to)
typeToBuffer(e.to, null);
else
{
MODtoBuffer(buf, e.mod);
}
buf.writeByte(')');
expToBuffer(e.e1, precedence[e.op]);
}
override void visit(VectorExp e)
{
buf.writestring("cast(");
typeToBuffer(e.to, null);
buf.writeByte(')');
expToBuffer(e.e1, precedence[e.op]);
}
override void visit(SliceExp e)
{
expToBuffer(e.e1, precedence[e.op]);
buf.writeByte('[');
if (e.upr || e.lwr)
{
if (e.lwr)
sizeToBuffer(e.lwr);
else
buf.writeByte('0');
buf.writestring("..");
if (e.upr)
sizeToBuffer(e.upr);
else
buf.writeByte('$');
}
buf.writeByte(']');
}
override void visit(ArrayLengthExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writestring(".length");
}
override void visit(IntervalExp e)
{
expToBuffer(e.lwr, PREC.assign);
buf.writestring("..");
expToBuffer(e.upr, PREC.assign);
}
override void visit(DelegatePtrExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writestring(".ptr");
}
override void visit(DelegateFuncptrExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writestring(".funcptr");
}
override void visit(ArrayExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('[');
argsToBuffer(e.arguments);
buf.writeByte(']');
}
override void visit(DotExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('.');
expToBuffer(e.e2, PREC.primary);
}
override void visit(IndexExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writeByte('[');
sizeToBuffer(e.e2);
buf.writeByte(']');
}
override void visit(PostExp e)
{
expToBuffer(e.e1, precedence[e.op]);
buf.writestring(Token.toString(e.op));
}
override void visit(PreExp e)
{
buf.writestring(Token.toString(e.op));
expToBuffer(e.e1, precedence[e.op]);
}
override void visit(RemoveExp e)
{
expToBuffer(e.e1, PREC.primary);
buf.writestring(".remove(");
expToBuffer(e.e2, PREC.assign);
buf.writeByte(')');
}
override void visit(CondExp e)
{
expToBuffer(e.econd, PREC.oror);
buf.writestring(" ? ");
expToBuffer(e.e1, PREC.expr);
buf.writestring(" : ");
expToBuffer(e.e2, PREC.cond);
}
override void visit(DefaultInitExp e)
{
buf.writestring(Token.toString(e.subop));
}
override void visit(ClassReferenceExp e)
{
buf.writestring(e.value.toChars());
}
////////////////////////////////////////////////////////////////////////////
override void visit(TemplateTypeParameter tp)
{
buf.writestring(tp.ident.toChars());
if (tp.specType)
{
buf.writestring(" : ");
typeToBuffer(tp.specType, null);
}
if (tp.defaultType)
{
buf.writestring(" = ");
typeToBuffer(tp.defaultType, null);
}
}
override void visit(TemplateThisParameter tp)
{
buf.writestring("this ");
visit(cast(TemplateTypeParameter)tp);
}
override void visit(TemplateAliasParameter tp)
{
buf.writestring("alias ");
if (tp.specType)
typeToBuffer(tp.specType, tp.ident);
else
buf.writestring(tp.ident.toChars());
if (tp.specAlias)
{
buf.writestring(" : ");
objectToBuffer(tp.specAlias);
}
if (tp.defaultAlias)
{
buf.writestring(" = ");
objectToBuffer(tp.defaultAlias);
}
}
override void visit(TemplateValueParameter tp)
{
typeToBuffer(tp.valType, tp.ident);
if (tp.specValue)
{
buf.writestring(" : ");
tp.specValue.accept(this);
}
if (tp.defaultValue)
{
buf.writestring(" = ");
tp.defaultValue.accept(this);
}
}
override void visit(TemplateTupleParameter tp)
{
buf.writestring(tp.ident.toChars());
buf.writestring("...");
}
////////////////////////////////////////////////////////////////////////////
override void visit(DebugCondition c)
{
if (c.ident)
buf.printf("debug (%s)", c.ident.toChars());
else
buf.printf("debug (%u)", c.level);
}
override void visit(VersionCondition c)
{
if (c.ident)
buf.printf("version (%s)", c.ident.toChars());
else
buf.printf("version (%u)", c.level);
}
override void visit(StaticIfCondition c)
{
buf.writestring("static if (");
c.exp.accept(this);
buf.writeByte(')');
}
////////////////////////////////////////////////////////////////////////////
override void visit(Parameter p)
{
if (p.storageClass & STCauto)
buf.writestring("auto ");
if (p.storageClass & STCreturn)
buf.writestring("return ");
if (p.storageClass & STCout)
buf.writestring("out ");
else if (p.storageClass & STCref)
buf.writestring("ref ");
else if (p.storageClass & STCin)
buf.writestring("in ");
else if (p.storageClass & STClazy)
buf.writestring("lazy ");
else if (p.storageClass & STCalias)
buf.writestring("alias ");
StorageClass stc = p.storageClass;
if (p.type && p.type.mod & MODshared)
stc &= ~STCshared;
if (stcToBuffer(buf, stc & (STCconst | STCimmutable | STCwild | STCshared | STCscope)))
buf.writeByte(' ');
if (p.storageClass & STCalias)
{
if (p.ident)
buf.writestring(p.ident.toChars());
}
else if (p.type.ty == Tident &&
(cast(TypeIdentifier)p.type).ident.toString().length > 3 &&
strncmp((cast(TypeIdentifier)p.type).ident.toChars(), "__T", 3) == 0)
{
// print parameter name, instead of undetermined type parameter
buf.writestring(p.ident.toChars());
}
else
typeToBuffer(p.type, p.ident);
if (p.defaultArg)
{
buf.writestring(" = ");
p.defaultArg.accept(this);
}
}
void parametersToBuffer(Parameters* parameters, int varargs)
{
buf.writeByte('(');
if (parameters)
{
size_t dim = Parameter.dim(parameters);
foreach (i; 0 .. dim)
{
if (i)
buf.writestring(", ");
Parameter fparam = Parameter.getNth(parameters, i);
fparam.accept(this);
}
if (varargs)
{
if (parameters.dim && varargs == 1)
buf.writestring(", ");
buf.writestring("...");
}
}
buf.writeByte(')');
}
override void visit(Module m)
{
if (m.md)
{
if (m.userAttribDecl)
{
buf.writestring("@(");
argsToBuffer(m.userAttribDecl.atts);
buf.writeByte(')');
buf.writenl();
}
if (m.md.isdeprecated)
{
if (m.md.msg)
{
buf.writestring("deprecated(");
m.md.msg.accept(this);
buf.writestring(") ");
}
else
buf.writestring("deprecated ");
}
buf.writestring("module ");
buf.writestring(m.md.toChars());
buf.writeByte(';');
buf.writenl();
}
foreach (s; *m.members)
{
s.accept(this);
}
}
}
extern (C++) void toCBuffer(Statement s, OutBuffer* buf, HdrGenState* hgs)
{
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
s.accept(v);
}
extern (C++) void toCBuffer(Type t, OutBuffer* buf, Identifier ident, HdrGenState* hgs)
{
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
v.typeToBuffer(t, ident);
}
extern (C++) void toCBuffer(Dsymbol s, OutBuffer* buf, HdrGenState* hgs)
{
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
s.accept(v);
}
// used from TemplateInstance::toChars() and TemplateMixin::toChars()
extern (C++) void toCBufferInstance(TemplateInstance ti, OutBuffer* buf, bool qualifyTypes = false)
{
HdrGenState hgs;
hgs.fullQual = qualifyTypes;
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs);
v.visit(ti);
}
extern (C++) void toCBuffer(Initializer iz, OutBuffer* buf, HdrGenState* hgs)
{
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
iz.accept(v);
}
extern (C++) bool stcToBuffer(OutBuffer* buf, StorageClass stc)
{
bool result = false;
if ((stc & (STCreturn | STCscope)) == (STCreturn | STCscope))
stc &= ~STCscope;
while (stc)
{
const(char)* p = stcToChars(stc);
if (!p) // there's no visible storage classes
break;
if (!result)
result = true;
else
buf.writeByte(' ');
buf.writestring(p);
}
return result;
}
/*************************************************
* Pick off one of the storage classes from stc,
* and return a pointer to a string representation of it.
* stc is reduced by the one picked.
*/
extern (C++) const(char)* stcToChars(ref StorageClass stc)
{
struct SCstring
{
StorageClass stc;
TOK tok;
const(char)* id;
}
static __gshared SCstring* table =
[
SCstring(STCauto, TOKauto),
SCstring(STCscope, TOKscope),
SCstring(STCstatic, TOKstatic),
SCstring(STCextern, TOKextern),
SCstring(STCconst, TOKconst),
SCstring(STCfinal, TOKfinal),
SCstring(STCabstract, TOKabstract),
SCstring(STCsynchronized, TOKsynchronized),
SCstring(STCdeprecated, TOKdeprecated),
SCstring(STCoverride, TOKoverride),
SCstring(STClazy, TOKlazy),
SCstring(STCalias, TOKalias),
SCstring(STCout, TOKout),
SCstring(STCin, TOKin),
SCstring(STCmanifest, TOKenum),
SCstring(STCimmutable, TOKimmutable),
SCstring(STCshared, TOKshared),
SCstring(STCnothrow, TOKnothrow),
SCstring(STCwild, TOKwild),
SCstring(STCpure, TOKpure),
SCstring(STCref, TOKref),
SCstring(STCtls),
SCstring(STCgshared, TOKgshared),
SCstring(STCnogc, TOKat, "@nogc"),
SCstring(STCproperty, TOKat, "@property"),
SCstring(STCsafe, TOKat, "@safe"),
SCstring(STCtrusted, TOKat, "@trusted"),
SCstring(STCsystem, TOKat, "@system"),
SCstring(STCdisable, TOKat, "@disable"),
SCstring(0, TOKreserved)
];
for (int i = 0; table[i].stc; i++)
{
StorageClass tbl = table[i].stc;
assert(tbl & STCStorageClass);
if (stc & tbl)
{
stc &= ~tbl;
if (tbl == STCtls) // TOKtls was removed
return "__thread";
TOK tok = table[i].tok;
if (tok == TOKat)
return table[i].id;
else
return Token.toChars(tok);
}
}
//printf("stc = %llx\n", stc);
return null;
}
extern (C++) void trustToBuffer(OutBuffer* buf, TRUST trust)
{
const(char)* p = trustToChars(trust);
if (p)
buf.writestring(p);
}
extern (C++) const(char)* trustToChars(TRUST trust)
{
switch (trust)
{
case TRUSTdefault:
return null;
case TRUSTsystem:
return "@system";
case TRUSTtrusted:
return "@trusted";
case TRUSTsafe:
return "@safe";
default:
assert(0);
}
}
extern (C++) void linkageToBuffer(OutBuffer* buf, LINK linkage)
{
const(char)* p = linkageToChars(linkage);
if (p)
{
buf.writestring("extern (");
buf.writestring(p);
buf.writeByte(')');
}
}
extern (C++) const(char)* linkageToChars(LINK linkage)
{
switch (linkage)
{
case LINKdefault:
return null;
case LINKd:
return "D";
case LINKc:
return "C";
case LINKcpp:
return "C++";
case LINKwindows:
return "Windows";
case LINKpascal:
return "Pascal";
case LINKobjc:
return "Objective-C";
default:
assert(0);
}
}
extern (C++) void protectionToBuffer(OutBuffer* buf, Prot prot)
{
const(char)* p = protectionToChars(prot.kind);
if (p)
buf.writestring(p);
if (prot.kind == PROTpackage && prot.pkg)
{
buf.writeByte('(');
buf.writestring(prot.pkg.toPrettyChars(true));
buf.writeByte(')');
}
}
extern (C++) const(char)* protectionToChars(PROTKIND kind)
{
switch (kind)
{
case PROTundefined:
return null;
case PROTnone:
return "none";
case PROTprivate:
return "private";
case PROTpackage:
return "package";
case PROTprotected:
return "protected";
case PROTpublic:
return "public";
case PROTexport:
return "export";
default:
assert(0);
}
}
// Print the full function signature with correct ident, attributes and template args
extern (C++) void functionToBufferFull(TypeFunction tf, OutBuffer* buf, Identifier ident, HdrGenState* hgs, TemplateDeclaration td)
{
//printf("TypeFunction::toCBuffer() this = %p\n", this);
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
v.visitFuncIdentWithPrefix(tf, ident, td, true);
}
// ident is inserted before the argument list and will be "function" or "delegate" for a type
extern (C++) void functionToBufferWithIdent(TypeFunction tf, OutBuffer* buf, const(char)* ident)
{
HdrGenState hgs;
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs);
v.visitFuncIdentWithPostfix(tf, ident);
}
extern (C++) void toCBuffer(Expression e, OutBuffer* buf, HdrGenState* hgs)
{
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
e.accept(v);
}
/**************************************************
* Write out argument types to buf.
*/
extern (C++) void argExpTypesToCBuffer(OutBuffer* buf, Expressions* arguments)
{
if (!arguments || !arguments.dim)
return;
HdrGenState hgs;
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs);
foreach (i, arg; *arguments)
{
if (i)
buf.writestring(", ");
v.typeToBuffer(arg.type, null);
}
}
extern (C++) void toCBuffer(TemplateParameter tp, OutBuffer* buf, HdrGenState* hgs)
{
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs);
tp.accept(v);
}
extern (C++) void arrayObjectsToBuffer(OutBuffer* buf, Objects* objects)
{
if (!objects || !objects.dim)
return;
HdrGenState hgs;
scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs);
foreach (i, o; *objects)
{
if (i)
buf.writestring(", ");
v.objectToBuffer(o);
}
}
extern (C++) const(char)* parametersTypeToChars(Parameters* parameters, int varargs)
{
OutBuffer buf;
HdrGenState hgs;
scope PrettyPrintVisitor v = new PrettyPrintVisitor(&buf, &hgs);
v.parametersToBuffer(parameters, varargs);
return buf.extractString();
}
| D |
module veda.vmodule.vmodule;
private
{
import core.stdc.stdlib, core.sys.posix.signal, core.sys.posix.unistd, core.runtime, core.thread, core.memory;
import std.stdio, std.conv, std.utf, std.string, std.file, std.datetime, std.json, core.thread, std.uuid, std.algorithm : remove;
import kaleidic.nanomsg.nano;
import veda.common.type, veda.core.common.define, veda.onto.resource, veda.onto.lang, veda.onto.individual, veda.util.queue, veda.util.container;
import veda.common.logger, veda.core.storage.lmdb_storage, veda.core.impl.thread_context;
import veda.core.common.context, veda.util.tools, veda.onto.onto, veda.util.module_info, veda.common.logger;
}
bool f_listen_exit = false;
Logger _log;
extern (C) void handleTermination(int _signal)
{
writefln("!SYS: %s: caught signal: %s", process_name, text(_signal));
if (_log !is null)
_log.trace("!SYS: %s: caught signal: %s", process_name, text(_signal));
//_log.close();
writeln("!SYS: ", process_name, ": preparation for the exit.");
f_listen_exit = true;
thread_term();
Runtime.terminate();
}
shared static this()
{
bsd_signal(SIGINT, &handleTermination);
}
class VedaModule
{
long last_committed_op_id;
long last_check_time;
int sock;
string notify_channel_url = "tcp://127.0.0.1:9111\0";
bool already_notify_channel = false;
Cache!(string, string) cache_of_indv;
ModuleInfoFile module_info;
long op_id = 0;
long committed_op_id = 0;
long count_signal = 0;
long count_readed = 0;
long count_success_prepared = 0;
string main_queue_name = "individuals-flow";
Queue main_queue;
Consumer[] main_cs;
Consumer main_cs_prefetch;
Queue prepare_batch_queue;
Consumer prepare_batch_cs;
Context context;
Onto onto;
Individual node;
string main_module_url = "tcp://127.0.0.1:9112\0";
Ticket sticket;
string message_header;
string module_uid;
int delegate(string) priority;
bool[ string ] subsrc;
long module_id;
long subsystem_id;
Logger log;
int basic_priority(string user_uri)
{
return 0;
}
this(SUBSYSTEM _subsystem_id, MODULE _module_id, Logger in_log)
{
priority = &basic_priority;
module_uid = text(_module_id).replace("-", "_");
process_name = module_uid;
message_header = "MSG:" ~ module_uid ~ ":";
_log = in_log;
log = _log;
main_cs.length = 1;
module_id = _module_id;
subsystem_id = _subsystem_id;
}
~this()
{
delete module_info;
}
private void open_perapare_batch_queue(bool is_open_exists_batch)
{
// exists(R)(R name)
// attempt open [prepareall] queue
prepare_batch_queue = new Queue(uris_db_path, "uris-db", Mode.R, log);
prepare_batch_queue.open();
if (prepare_batch_queue.isReady)
{
prepare_batch_cs = new Consumer(prepare_batch_queue, tmp_path, process_name, Mode.RW, log);
if (!prepare_batch_cs.open(is_open_exists_batch))
{
log.trace("not found uncompleted batch");
prepare_batch_queue.close();
prepare_batch_queue = null;
prepare_batch_cs = null;
}
else
log.trace("found uncompleted batch");
}
}
void run()
{
if (module_id == 0)
{
log.trace("%s terminated, module_id not setting", process_name);
return;
}
module_info = new ModuleInfoFile(process_name, _log, OPEN_MODE.WRITER);
if (!module_info.is_ready)
{
log.trace("%s terminated", process_name);
return;
}
context = create_context();
if (context is null)
context = PThreadContext.create_new("cfg:standart_node", process_name, individuals_db_path, log, main_module_url, null, null, null);
if (node == Individual.init)
node = context.get_configuration();
cache_of_indv = new Cache!(string, string)(1000, "individuals");
open();
if (configure() == false)
{
log.trace("[%s] configure is fail, terminate", process_name);
return;
}
ubyte[] buffer = new ubyte[ 1024 ];
main_queue = new Queue(queue_db_path, main_queue_name, Mode.R, log);
main_queue.open();
while (!main_queue.isReady)
{
log.trace("queue [%s] not ready, sleep and repeate...", main_queue_name);
Thread.sleep(dur!("seconds")(10));
main_queue.open();
}
for (int i = 0; i < main_cs.length; i++)
{
main_cs[ i ] = new Consumer(main_queue, queue_db_path, process_name ~ text(i), Mode.RW, log);
main_cs[ i ].open();
}
main_cs_prefetch = new Consumer(main_queue, queue_db_path, process_name ~ "_prefetch", Mode.RW, log);
main_cs_prefetch.open();
// attempt open [prepareall] queue
open_perapare_batch_queue(true);
load_systicket();
sock = nn_socket(AF_SP, NN_SUB);
if (sock >= 0)
{
int to = 1000;
if (nn_setsockopt(sock, NN_SOL_SOCKET, NN.RCVTIMEO, &to, to.sizeof) < 0)
log.trace("ERR! cannot set scoket options NN_RCVTIMEO");
if (nn_setsockopt(sock, NN_SUB, NN_SUB_SUBSCRIBE, "".toStringz, 0) < 0)
log.trace("ERR! cannot set scoket options NN_SUB_SUBSCRIBE");
if (nn_connect(sock, cast(char *)notify_channel_url) >= 0)
{
already_notify_channel = true;
log.trace("success connect %s", notify_channel_url);
}
else
log.trace("ERR! cannot connect socket to %s", notify_channel_url);
if (already_notify_channel)
{
while (f_listen_exit != true)
{
ev_CALLBACK_GET_THREAD_ID();
thread_id();
}
}
}
if (_log !is null)
_log.close();
module_info.close();
}
///////////////////////////////////////////////////
// if return [false] then, no commit prepared message, and repeate
abstract ResultCode prepare(INDV_OP cmd, string user_uri, string prev_bin, ref Individual prev_indv, string new_bin, ref Individual new_indv,
string event_id, long transaction_id, long op_id);
abstract bool configure();
abstract bool close();
abstract bool open();
abstract Context create_context();
abstract void thread_id();
abstract void receive_msg(string msg);
public void subscribe_on_prefetch(string uri)
{
subsrc[ uri.idup ] = true;
}
public void unsubscribe_on_prefetch(string uri)
{
subsrc.remove(uri.dup);
}
abstract void event_of_change(string uri);
public void prepare_batch()
{
open_perapare_batch_queue(false);
}
private void configuration_found_in_queue()
{
string data;
while (true)
{
data = main_cs_prefetch.pop();
if (data is null)
{
//log.trace("PREFETCH: pop return null");
break;
}
Individual imm;
if (data !is null && imm.deserialize(data) < 0)
{
log.trace("ERR! invalid individual:[%s]", data);
continue;
}
string uri = imm.getFirstLiteral("uri");
//log.trace("PREFETCH %s", uri);
if (context.get_config_uri() == uri)
{
log.trace("prefetch: found change in config [%s]", uri);
string new_bin = imm.getFirstLiteral("new_state");
if (new_bin !is null && node.deserialize(new_bin) < 0)
{
log.trace("ERR! invalid individual:[%s]", new_bin);
}
else
{
log.trace("prefetch: reconfigure, use [%s]", node);
close();
open();
context.get_onto();
configure();
}
}
else if ((uri in subsrc) !is null)
{
event_of_change(uri);
}
//Thread.sleep(dur!("seconds")(1));
main_cs_prefetch.commit_and_next(false);
}
main_cs_prefetch.sync();
}
/+private int priority(string user_uri)
{
stderr.writefln("basic user uri %s", user_uri);
return 0;
}+/
private void prepare_queue(string msg)
{
main_queue.close();
main_queue.open();
int i = 0;
while (true)
{
if (f_listen_exit == true)
break;
configuration_found_in_queue();
string data = main_cs[ i ].pop();
if (data is null && (i + 1 < main_cs.length))
{
i++;
continue;
}
if (data is null)
{
if (prepare_batch_cs !is null)
{
// prepare_batch_cs, обход по очереди всех индивидов
data = prepare_batch_cs.pop();
if (data is null)
{
log.trace("batch queue is empty, remove it.");
prepare_batch_cs.remove();
//prepare_batch_queue.remove();
prepare_batch_cs = null;
break;
}
Individual indv = context.get_individual(&sticket, data);
ResultCode rc = ResultCode.Internal_Server_Error;
if (indv !is Individual.init)
{
Individual prev_indv;
try
{
rc = prepare(INDV_OP.PUT, sticket.user_uri, null, prev_indv, data, indv, "", -1, -1);
}
catch (Throwable tr)
{
log.trace("ERR! indv.uri=%s, err=%s", indv.uri, tr.msg);
}
}
if (rc != ResultCode.Connect_Error)
prepare_batch_cs.commit_and_next(true);
main_queue.close();
main_queue.open();
i = 0;
continue;
}
else
{
break;
}
}
count_readed++;
Individual imm;
if (data !is null && imm.deserialize(data) < 0)
{
i = 0;
log.trace("ERR! invalid individual:[%s]", data);
continue;
}
string new_bin = imm.getFirstLiteral("new_state");
string prev_bin = imm.getFirstLiteral("prev_state");
string user_uri = imm.getFirstLiteral("user_uri");
string event_id = imm.getFirstLiteral("event_id");
long transaction_id = imm.getFirstInteger("tnx_id");
long assigned_subsystems = imm.getFirstInteger("assigned_subsystems");
if (assigned_subsystems > 0)
{
if ((assigned_subsystems & subsystem_id) != subsystem_id)
{
log.trace("INFO! skip, assigned_subsystems[%d], subsystem_id[%d] ", assigned_subsystems, subsystem_id);
continue;
}
}
if (assigned_subsystems < 0)
{
if (((assigned_subsystems * -1) & subsystem_id) == subsystem_id)
{
log.trace("INFO! skip, assigned_subsystems[%d], subsystem_id[%d] ", assigned_subsystems, subsystem_id);
continue;
}
}
if (priority(user_uri) != i)
{
main_cs[ i ].commit_and_next(true);
i = 0;
continue;
}
INDV_OP cmd = cast(INDV_OP)imm.getFirstInteger("cmd");
op_id = imm.getFirstInteger("op_id");
Individual prev_indv, new_indv;
if (new_bin !is null && new_indv.deserialize(new_bin) < 0)
{
log.trace("ERR! invalid individual:[%s]", new_bin);
}
else
{
// log.trace("@read from queue new_indv.uri=%s, op_id=%s", new_indv.uri, op_id);
if (prev_bin !is null && prev_indv.deserialize(prev_bin) < 0)
{
log.trace("ERR! invalid individual:[%s]", prev_bin);
}
}
count_success_prepared++;
//writeln ("%1 prev_bin=[", prev_bin, "], \nnew_bin=[", new_bin, "]");
if (onto is null)
onto = context.get_onto();
onto.update_onto_hierarchy(new_indv, true);
if (new_indv.uri is null)
log.trace("WARN! individual not contain uri: %s", new_indv);
cache_of_indv.put(new_indv.uri, new_bin);
try
{
ResultCode res = prepare(cmd, user_uri, prev_bin, prev_indv, new_bin, new_indv, event_id, transaction_id, op_id);
if (res == ResultCode.OK)
{
main_cs[ i ].commit_and_next(true);
module_info.put_info(op_id, committed_op_id);
}
else if (res == ResultCode.Connect_Error || res == ResultCode.Internal_Server_Error || res == ResultCode.Not_Ready ||
res == ResultCode.Service_Unavailable || res == ResultCode.Too_Many_Requests)
{
log.trace("WARN: message fail prepared, sleep and repeate...");
Thread.sleep(dur!("seconds")(10));
}
else
{
main_cs[ i ].commit_and_next(true);
module_info.put_info(op_id, committed_op_id);
log.trace("ERR! message fail prepared (res=%s), skip. count=%d", text(res), count_success_prepared);
}
i = 0;
}
catch (Throwable ex)
{
log.trace("ERR! ex=%s", ex.msg);
}
//if (count_success_prepared % 1000 == 0)
//{
// log.trace("reopen db's and gc collect");
// context.reopen_ro_subject_storage_db();
// context.reopen_ro_acl_storage_db();
// context.reopen_ro_ticket_manager_db();
// GC.collect();
//}
}
//if (count_readed != count_success_prepared)
// log.trace("WARN! : readed=%d, success_prepared=%d", count_readed, count_success_prepared);
}
void load_systicket()
{
sticket = *context.get_systicket_from_storage();
if (sticket is Ticket.init || sticket.result != ResultCode.OK)
{
log.trace("load_systicket: fail systicket=%s", text(sticket));
bool is_superadmin = false;
void trace_acl(string resource_group, string subject_group, string right)
{
if (subject_group == "cfg:SuperUser")
is_superadmin = true;
}
while (is_superadmin == false)
{
context.get_rights_origin_from_acl(&sticket, "cfg:SuperUser", &trace_acl, null);
log.trace("child_process is_superadmin=%s", text(is_superadmin));
Thread.sleep(dur!("seconds")(1));
}
}
set_global_systicket(sticket);
log.trace("load_systicket: systicket=%s", text(sticket));
}
void ev_CALLBACK_GET_THREAD_ID()
{
//g_child_process.thread_id();
if (last_committed_op_id < committed_op_id)
{
last_committed_op_id = committed_op_id;
module_info.put_info(op_id, committed_op_id);
}
long now = Clock.currTime().stdTime();
if (now - last_check_time > 1_000_000)
{
last_check_time = now;
prepare_queue(null);
}
if (already_notify_channel)
{
char *buf = cast(char *)0;
int bytes = nn_recv(sock, &buf, NN_MSG, 0, /*NN_DONTWAIT*/);
if (bytes > 0)
{
string msg = buf[ 0..bytes - 1 ].dup;
nn_freemsg(buf);
//log.trace("CLIENT (%s): RECEIVED %s", process_name, msg);
if (msg.length > message_header.length + 1 && msg.indexOf(message_header) >= 0)
receive_msg(msg[ (message_header.length)..$ ]);
else
prepare_queue(msg[ 1..$ ]);
}
}
}
}
| D |
module d_imgui;
public import d_imgui.imconfig;
public import d_imgui.imgui_h;
public import d_imgui.imgui;
public import d_imgui.imgui_widgets;
public import d_imgui.imgui_internal;
public import d_imgui.imgui_draw;
public import d_imgui.imgui_demo;
public import d_imgui.imgui_tables;
| D |
# FIXED
Startup/ccfg_appBLE.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/AirWrite/CC26xx/IAR/Config/ccfg_appBLE.c
Startup/ccfg_appBLE.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/startup_files/ccfg.c
Startup/ccfg_appBLE.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include/stdint.h
Startup/ccfg_appBLE.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_types.h
Startup/ccfg_appBLE.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include/stdbool.h
Startup/ccfg_appBLE.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_chip_def.h
Startup/ccfg_appBLE.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ccfg.h
Startup/ccfg_appBLE.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ccfg_simple_struct.h
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/AirWrite/CC26xx/IAR/Config/ccfg_appBLE.c:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/startup_files/ccfg.c:
C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include/stdint.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_types.h:
C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include/stdbool.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_chip_def.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ccfg.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ccfg_simple_struct.h:
| D |
/++
This module contains summation algorithms.
License: $(LINK2 http://boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Ilya Yaroshenko
Copyright: Copyright © 2015-, Ilya Yaroshenko
+/
module mir.math.sum;
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
import mir.ndslice.topology: map;
auto ar = [1, 1e100, 1, -1e100].sliced.map!"a * 10_000";
const r = 20_000;
assert(r == ar.sum!"kbn");
assert(r == ar.sum!"kb2");
assert(r == ar.sum!"precise");
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced, slicedField;
import mir.ndslice.topology: map, iota, retro;
import mir.ndslice.concatenation: concatenation;
import mir.math.common;
auto ar = 1000
.iota
.map!(n => 1.7L.pow(n+1) - 1.7L.pow(n))
;
real d = 1.7L.pow(1000);
assert(sum!"precise"(concatenation(ar, [-d].sliced).slicedField) == -1);
assert(sum!"precise"(ar.retro, -d) == -1);
}
/++
`Naive`, `Pairwise` and `Kahan` algorithms can be used for user defined types.
+/
version(mir_test)
unittest
{
import std.traits : isFloatingPoint;
static struct Quaternion(F)
if (isFloatingPoint!F)
{
F[4] rijk;
/// + and - operator overloading
Quaternion opBinary(string op)(auto ref const Quaternion rhs) const
if (op == "+" || op == "-")
{
Quaternion ret ;
foreach (i, ref e; ret.rijk)
mixin("e = rijk[i] "~op~" rhs.rijk[i];");
return ret;
}
/// += and -= operator overloading
Quaternion opOpAssign(string op)(auto ref const Quaternion rhs)
if (op == "+" || op == "-")
{
foreach (i, ref e; rijk)
mixin("e "~op~"= rhs.rijk[i];");
return this;
}
///constructor with single FP argument
this(F f)
{
rijk[] = f;
}
///assigment with single FP argument
void opAssign(F f)
{
rijk[] = f;
}
}
Quaternion!double q, p, r;
q.rijk = [0, 1, 2, 4];
p.rijk = [3, 4, 5, 9];
r.rijk = [3, 5, 7, 13];
assert(r == [p, q].sum!"naive");
assert(r == [p, q].sum!"pairwise");
assert(r == [p, q].sum!"kahan");
}
/++
All summation algorithms available for complex numbers.
+/
version(mir_test)
unittest
{
cdouble[] ar = [1.0 + 2i, 2 + 3i, 3 + 4i, 4 + 5i];
cdouble r = 10 + 14i;
assert(r == ar.sum!"fast");
assert(r == ar.sum!"naive");
assert(r == ar.sum!"pairwise");
assert(r == ar.sum!"kahan");
version(LDC) // DMD Internal error: backend/cgxmm.c 628
{
assert(r == ar.sum!"kbn");
assert(r == ar.sum!"kb2");
}
assert(r == ar.sum!"precise");
}
///
version(mir_test)
@safe pure nothrow unittest
{
import mir.ndslice.topology: repeat, iota;
//simple integral summation
assert(sum([ 1, 2, 3, 4]) == 10);
//with initial value
assert(sum([ 1, 2, 3, 4], 5) == 15);
//with integral promotion
assert(sum([false, true, true, false, true]) == 3);
assert(sum(ubyte.max.repeat(100)) == 25_500);
//The result may overflow
assert(uint.max.repeat(3).sum() == 4_294_967_293U );
//But a seed can be used to change the summation primitive
assert(uint.max.repeat(3).sum(ulong.init) == 12_884_901_885UL);
//Floating point summation
assert(sum([1.0, 2.0, 3.0, 4.0]) == 10);
//Type overriding
static assert(is(typeof(sum!double([1F, 2F, 3F, 4F])) == double));
static assert(is(typeof(sum!double([1F, 2F, 3F, 4F], 5F)) == double));
assert(sum([1F, 2, 3, 4]) == 10);
assert(sum([1F, 2, 3, 4], 5F) == 15);
//Force pair-wise floating point summation on large integers
import std.math : approxEqual;
assert(iota!long([4096], uint.max / 2).sum(0.0)
.approxEqual((uint.max / 2) * 4096.0 + 4096.0 * 4096.0 / 2));
}
/// Precise summation
version(mir_test)
nothrow @nogc unittest
{
import mir.ndslice.topology: iota, map;
import core.stdc.tgmath: pow;
assert(iota(1000).map!(n => 1.7L.pow(real(n)+1) - 1.7L.pow(real(n)))
.sum!"precise" == -1 + 1.7L.pow(1000.0L));
}
/// Precise summation with output range
version(mir_test)
nothrow @nogc unittest
{
import mir.ndslice.topology: iota, map;
import mir.math.common;
auto r = iota(1000).map!(n => 1.7L.pow(n+1) - 1.7L.pow(n));
Summator!(real, Summation.precise) s = 0.0;
s.put(r);
s -= 1.7L.pow(1000);
assert(s.sum() == -1);
}
/// Precise summation with output range
version(mir_test)
nothrow @nogc unittest
{
import std.math: isFinite;
import mir.math.common;
float M = 2.0f ^^ (float.max_exp-1);
double N = 2.0 ^^ (float.max_exp-1);
auto s = Summator!(float, Summation.precise)(0);
s += M;
s += M;
assert(float.infinity == s.sum()); //infinity
auto e = cast(Summator!(double, Summation.precise)) s;
assert(isFinite(e.sum()));
assert(N+N == e.sum()); //finite number
}
/// Moving mean
version(mir_test)
unittest
{
import mir.ndslice.topology: linspace;
import mir.math.sum;
import mir.array.allocation: array;
class MovingAverage
{
Summator!(double, Summation.precise) summator;
double[] circularBuffer;
size_t frontIndex;
double avg() @property const
{
return summator.sum() / circularBuffer.length;
}
this(double[] buffer)
{
assert(buffer.length);
circularBuffer = buffer;
summator = 0;
summator.put(buffer);
}
///operation without rounding
void put(double x)
{
import mir.utility: swap;
summator += x;
swap(circularBuffer[frontIndex++], x);
summator -= x;
frontIndex %= circularBuffer.length;
}
}
/// ma always keeps precise average of last 1000 elements
auto ma = new MovingAverage(linspace!double([1000], [0.0, 999]).array);
assert(ma.avg == (1000 * 999 / 2) / 1000.0);
/// move by 10 elements
foreach(x; linspace!double([10], [1000.0, 1009.0]))
ma.put(x);
assert(ma.avg == (1010 * 1009 / 2 - 10 * 9 / 2) / 1000.0);
}
version(X86)
version = X86_Any;
version(X86_64)
version = X86_Any;
/++
SIMD Vectors
Bugs: ICE 1662 (dmd only)
+/
version(LDC)
version(X86_Any)
version(mir_test)
unittest
{
import core.simd;
import std.meta : AliasSeq;
double2 a = 1, b = 2, c = 3, d = 6;
with(Summation)
{
foreach (algo; AliasSeq!(naive, fast, pairwise, kahan))
{
assert([a, b, c].sum!algo.array == d.array);
assert([a, b].sum!algo(c).array == d.array);
}
}
}
import std.traits;
private alias AliasSeq(T...) = T;
import mir.internal.utility: Iota, isComplex;
private template chainSeq(size_t n)
{
static if (n)
alias chainSeq = AliasSeq!(n, chainSeq!(n / 2));
else
alias chainSeq = AliasSeq!();
}
/++
Summation algorithms.
+/
enum Summation
{
/++
Performs `pairwise` summation for floating point based types and `fast` summation for integral based types.
+/
appropriate,
/++
$(WEB en.wikipedia.org/wiki/Pairwise_summation, Pairwise summation) algorithm.
+/
pairwise,
/++
Precise summation algorithm.
The value of the sum is rounded to the nearest representable
floating-point number using the $(LUCKY round-half-to-even rule).
The result can differ from the exact value on `X86`, `nextDown(proir) <= result && result <= nextUp(proir)`.
The current implementation re-establish special value semantics across iterations (i.e. handling ±inf).
References: $(LINK2 http://www.cs.cmu.edu/afs/cs/project/quake/public/papers/robust-arithmetic.ps,
"Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates", Jonathan Richard Shewchuk),
$(LINK2 http://bugs.python.org/file10357/msum4.py, Mark Dickinson's post at bugs.python.org).
+/
/+
Precise summation function as msum() by Raymond Hettinger in
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/393090>,
enhanced with the exact partials sum and roundoff from Mark
Dickinson's post at <http://bugs.python.org/file10357/msum4.py>.
See those links for more details, proofs and other references.
IEEE 754R floating point semantics are assumed.
+/
precise,
/++
$(WEB en.wikipedia.org/wiki/Kahan_summation, Kahan summation) algorithm.
+/
/+
---------------------
s := x[1]
c := 0
FOR k := 2 TO n DO
y := x[k] - c
t := s + y
c := (t - s) - y
s := t
END DO
---------------------
+/
kahan,
/++
$(LUCKY Kahan-Babuška-Neumaier summation algorithm). `KBN` gives more accurate results then `Kahan`.
+/
/+
---------------------
s := x[1]
c := 0
FOR i := 2 TO n DO
t := s + x[i]
IF ABS(s) >= ABS(x[i]) THEN
c := c + ((s-t)+x[i])
ELSE
c := c + ((x[i]-t)+s)
END IF
s := t
END DO
s := s + c
---------------------
+/
kbn,
/++
$(LUCKY Generalized Kahan-Babuška summation algorithm), order 2. `KB2` gives more accurate results then `Kahan` and `KBN`.
+/
/+
---------------------
s := 0 ; cs := 0 ; ccs := 0
FOR j := 1 TO n DO
t := s + x[i]
IF ABS(s) >= ABS(x[i]) THEN
c := (s-t) + x[i]
ELSE
c := (x[i]-t) + s
END IF
s := t
t := cs + c
IF ABS(cs) >= ABS(c) THEN
cc := (cs-t) + c
ELSE
cc := (c-t) + cs
END IF
cs := t
ccs := ccs + cc
END FOR
RETURN s+cs+ccs
---------------------
+/
kb2,
/++
Naive algorithm (one by one).
+/
naive,
/++
SIMD optimized summation algorithm.
+/
fast,
}
/++
Output range for summation.
+/
struct Summator(T, Summation summation)
if (isMutable!T)
{
import mir.math.common: fabs;
static if (is(T == class) || is(T == interface) || hasElaborateAssign!T)
static assert (summation == Summation.naive,
"Classes, interfaces, and structures with "
~ "elaborate constructor support only naive summation.");
static if (summation == Summation.fast)
{
version (LDC)
{
import ldc.attributes: fastmath;
alias attr = fastmath;
}
else
{
alias attr = AliasSeq!();
}
}
else
{
alias attr = AliasSeq!();
}
@attr:
static if (summation != Summation.pairwise)
@disable this();
static if (summation == Summation.pairwise)
private enum bool fastPairwise =
is(F == float) ||
is(F == double) ||
is(F == cfloat) ||
is(F == cdouble) ||
is(F : __vector(W[N]), W, size_t N);
//false;
alias F = T;
static if (summation == Summation.precise)
{
import std.internal.scopebuffer;
static import std.math;
private:
enum F M = (cast(F)(2)) ^^ (T.max_exp - 1);
F[16] scopeBufferArray = 0;
ScopeBuffer!F partials;
//sum for NaN and infinity.
F s;
//Overflow Degree. Count of 2^^F.max_exp minus count of -(2^^F.max_exp)
sizediff_t o;
/++
Compute the sum of a list of nonoverlapping floats.
On input, partials is a list of nonzero, nonspecial,
nonoverlapping floats, strictly increasing in magnitude, but
possibly not all having the same sign.
On output, the sum of partials gives the error in the returned
result, which is correctly rounded (using the round-half-to-even
rule).
Two floating point values x and y are non-overlapping if the least significant nonzero
bit of x is more significant than the most significant nonzero bit of y, or vice-versa.
+/
static F partialsReduce(F s, in F[] partials)
in
{
debug(numeric) assert(!partials.length || std.math.isFinite(s));
}
body
{
bool _break;
foreach_reverse (i, y; partials)
{
s = partialsReducePred(s, y, i ? partials[i-1] : 0, _break);
if (_break)
break;
debug(numeric) assert(std.math.isFinite(s));
}
return s;
}
static F partialsReducePred(F s, F y, F z, out bool _break)
out(result)
{
debug(numeric) assert(std.math.isFinite(result));
}
body
{
F x = s;
s = x + y;
F d = s - x;
F l = y - d;
debug(numeric)
{
assert(std.math.isFinite(x));
assert(std.math.isFinite(y));
assert(std.math.isFinite(s));
assert(fabs(y) < fabs(x));
}
if (l)
{
//Make half-even rounding work across multiple partials.
//Needed so that sum([1e-16, 1, 1e16]) will round-up the last
//digit to two instead of down to zero (the 1e-16 makes the 1
//slightly closer to two). Can guarantee commutativity.
if (z && !std.math.signbit(l * z))
{
l *= 2;
x = s + l;
F t = x - s;
if (l == t)
s = x;
}
_break = true;
}
return s;
}
//Returns corresponding infinity if is overflow and 0 otherwise.
F overflow()() const
{
if (o == 0)
return 0;
if (partials.length && (o == -1 || o == 1) && std.math.signbit(o * partials[$-1]))
{
// problem case: decide whether result is representable
F x = o * M;
F y = partials[$-1] / 2;
F h = x + y;
F d = h - x;
F l = (y - d) * 2;
y = h * 2;
d = h + l;
F t = d - h;
version(X86)
{
if (!std.math.isInfinity(cast(T)y) || !std.math.isInfinity(sum()))
return 0;
}
else
{
if (!std.math.isInfinity(cast(T)y) ||
((partials.length > 1 && !std.math.signbit(l * partials[$-2])) && t == l))
return 0;
}
}
return F.infinity * o;
}
}
else
static if (summation == Summation.kb2)
{
F s;
F cs;
F ccs;
}
else
static if (summation == Summation.kbn)
{
F s;
F c;
}
else
static if (summation == Summation.kahan)
{
F s;
F c;
F y; // do not declare in the loop/put (algo can be used for matrixes and etc)
F t; // ditto
}
else
static if (summation == Summation.pairwise)
{
package size_t counter;
size_t index;
static if (fastPairwise)
{
enum registersCount= 16;
F[size_t.sizeof * 8] partials;
}
else
{
F[size_t.sizeof * 8] partials;
}
}
else
static if (summation == Summation.naive)
{
F s;
}
else
static if (summation == Summation.fast)
{
F s;
}
else
static assert(0, "Unsupported summation type for std.numeric.Summator.");
public:
///
this()(T n)
{
static if (summation == Summation.precise)
{
partials = scopeBuffer(scopeBufferArray);
s = 0.0;
o = 0;
if (n) put(n);
}
else
static if (summation == Summation.kb2)
{
s = n;
static if (isComplex!T)
{
cs = 0 + 0fi;
ccs = 0 + 0fi;
}
else
{
cs = 0.0;
ccs = 0.0;
}
}
else
static if (summation == Summation.kbn)
{
s = n;
static if (isComplex!T)
c = 0 + 0fi;
else
c = 0.0;
}
else
static if (summation == Summation.kahan)
{
s = n;
static if (isComplex!T)
c = 0 + 0fi;
else
c = 0.0;
}
else
static if (summation == Summation.pairwise)
{
counter = index = 1;
partials[0] = n;
}
else
static if (summation == Summation.naive)
{
s = n;
}
else
static if (summation == Summation.fast)
{
s = n;
}
else
static assert(0);
}
// free ScopeBuffer
static if (summation == Summation.precise)
~this()
{
version(LDC) pragma(inline, true);
partials.free;
}
// copy ScopeBuffer if necessary
static if (summation == Summation.precise)
this(this)
{
auto a = partials[];
if (scopeBufferArray.ptr !is a.ptr)
{
partials = scopeBuffer(scopeBufferArray);
partials.put(a);
}
}
///Adds `n` to the internal partial sums.
void put(N)(N n)
if (__traits(compiles, {T a = n; a = n; a += n;}))
{
static if (isCompesatorAlgorithm!summation)
F x = n;
static if (summation == Summation.precise)
{
if (std.math.isFinite(x))
{
size_t i;
foreach (y; partials[])
{
F h = x + y;
if (std.math.isInfinity(cast(T)h))
{
if (fabs(x) < fabs(y))
{
F t = x; x = y; y = t;
}
//h == -F.infinity
if (std.math.signbit(h))
{
x += M;
x += M;
o--;
}
//h == +F.infinity
else
{
x -= M;
x -= M;
o++;
}
debug(numeric) assert(x.isFinite);
h = x + y;
}
debug(numeric) assert(h.isFinite);
F l;
if (fabs(x) < fabs(y))
{
F t = h - y;
l = x - t;
}
else
{
F t = h - x;
l = y - t;
}
debug(numeric) assert(l.isFinite);
if (l)
{
partials[i++] = l;
}
x = h;
}
partials.length = i;
if (x)
{
partials.put(x);
}
}
else
{
s += x;
}
}
else
static if (summation == Summation.kb2)
{
static if (isFloatingPoint!F)
{
F t = s + x;
F c = 0;
if (fabs(s) >= fabs(x))
{
F d = s - t;
c = d + x;
}
else
{
F d = x - t;
c = d + s;
}
s = t;
t = cs + c;
if (fabs(cs) >= fabs(c))
{
F d = cs - t;
d += c;
ccs += d;
}
else
{
F d = c - t;
d += cs;
ccs += d;
}
cs = t;
}
else
{
F t = s + x;
if (fabs(s.re) < fabs(x.re))
{
auto s_re = s.re;
auto x_re = x.re;
s = x_re + s.im * 1fi;
x = s_re + x.im * 1fi;
}
if (fabs(s.im) < fabs(x.im))
{
auto s_im = s.im;
auto x_im = x.im;
s = s.re + x_im * 1fi;
x = x.re + s_im * 1fi;
}
F c = (s-t)+x;
s = t;
if (fabs(cs.re) < fabs(c.re))
{
auto c_re = c.re;
auto cs_re = cs.re;
c = cs_re + c.im * 1fi;
cs = c_re + cs.im * 1fi;
}
if (fabs(cs.im) < fabs(c.im))
{
auto c_im = c.im;
auto cs_im = cs.im;
c = c.re + cs_im * 1fi;
cs = cs.re + c_im * 1fi;
}
F d = cs - t;
d += c;
ccs += d;
cs = t;
}
}
else
static if (summation == Summation.kbn)
{
static if (isFloatingPoint!F)
{
F t = s + x;
if (fabs(s) >= fabs(x))
{
F d = s - t;
d += x;
c += d;
}
else
{
F d = x - t;
d += s;
c += d;
}
s = t;
}
else
{
F t = s + x;
if (fabs(s.re) < fabs(x.re))
{
auto s_re = s.re;
auto x_re = x.re;
s = x_re + s.im * 1fi;
x = s_re + x.im * 1fi;
}
if (fabs(s.im) < fabs(x.im))
{
auto s_im = s.im;
auto x_im = x.im;
s = s.re + x_im * 1fi;
x = x.re + s_im * 1fi;
}
F d = s - t;
d += x;
c += d;
s = t;
}
}
else
static if (summation == Summation.kahan)
{
y = x - c;
t = s + y;
c = t - s;
c -= y;
s = t;
}
else
static if (summation == Summation.pairwise)
{
import mir.bitop: cttz;
++counter;
partials[index] = n;
foreach (_; 0 .. cttz(counter))
{
immutable newIndex = index - 1;
partials[newIndex] += partials[index];
index = newIndex;
}
++index;
}
else
static if (summation == Summation.naive)
{
s += n;
}
else
static if (summation == Summation.fast)
{
s += n;
}
else
static assert(0);
}
///ditto
void put(Range)(Range r)
if (isIterable!Range)
{
static if (summation == Summation.pairwise && fastPairwise && isDynamicArray!Range)
{
F[registersCount] v;
foreach (i, n; chainSeq!registersCount)
{
if (r.length >= n * 2) do
{
foreach (j; Iota!n)
v[j] = cast(F) r[j];
foreach (j; Iota!n)
v[j] += cast(F) r[n + j];
foreach (m; chainSeq!(n / 2))
foreach (j; Iota!m)
v[j] += v[m + j];
put(v[0]);
r = r[n * 2 .. $];
}
while (!i && r.length >= n * 2);
}
if (r.length)
{
put(cast(F) r[0]);
r = r[1 .. $];
}
assert(r.length == 0);
}
else
static if (summation == Summation.fast)
{
static if (isComplex!T)
F s0 = 0 + 0fi;
else
F s0 = 0;
foreach (ref elem; r)
s0 += elem;
s += s0;
}
else
{
foreach (ref elem; r)
put(elem);
}
}
import mir.ndslice.slice;
/// ditto
void put(Range: Slice!(Iterator, N, kind), Iterator, size_t N, SliceKind kind)(Range r)
{
static if (N > 1 && kind == Contiguous)
{
import mir.ndslice.topology: flattened;
this.put(r.flattened);
}
else
static if (isPointer!Iterator && kind == Contiguous)
{
this.put(r.iterator[0 .. r.length]);
}
else
static if (summation == Summation.fast && N == 1)
{
static if (isComplex!T)
F s0 = 0 + 0fi;
else
F s0 = 0;
import mir.algorithm.iteration: reduce;
s0 = s0.reduce!"a + b"(r);
s += s0;
}
else
{
foreach(elem; r)
this.put(elem);
}
}
/+
Adds `x` to the internal partial sums.
This operation doesn't re-establish special
value semantics across iterations (i.e. handling ±inf).
Preconditions: `isFinite(x)`.
+/
version(none)
static if (summation == Summation.precise)
package void unsafePut()(F x)
in {
assert(std.math.isFinite(x));
}
body {
size_t i;
foreach (y; partials[])
{
F h = x + y;
debug(numeric) assert(std.math.isFinite(h));
F l;
if (fabs(x) < fabs(y))
{
F t = h - y;
l = x - t;
}
else
{
F t = h - x;
l = y - t;
}
debug(numeric) assert(std.math.isFinite(l));
if (l)
{
partials[i++] = l;
}
x = h;
}
partials.length = i;
if (x)
{
partials.put(x);
}
}
///Returns the value of the sum.
T sum()() scope const
{
/++
Returns the value of the sum, rounded to the nearest representable
floating-point number using the round-half-to-even rule.
The result can differ from the exact value on `X86`, `nextDown`proir) <= result && result <= nextUp(proir)).
+/
static if (summation == Summation.precise)
{
debug(mir_sum)
{
foreach (y; partials[])
{
assert(y);
assert(y.isFinite);
}
//TODO: Add Non-Overlapping check to std.math
import mir.ndslice.slice: sliced;
import mir.ndslice.sorting: isSorted;
import mir.ndslice.topology: map;
assert(partials[].sliced.map!fabs.isSorted);
}
if (s)
return s;
auto parts = partials[];
F y = 0.0;
//pick last
if (parts.length)
{
y = parts[$-1];
parts = parts[0..$-1];
}
if (o)
{
immutable F of = o;
if (y && (o == -1 || o == 1) && std.math.signbit(of * y))
{
// problem case: decide whether result is representable
y /= 2;
F x = of * M;
immutable F h = x + y;
F t = h - x;
F l = (y - t) * 2;
y = h * 2;
if (std.math.isInfinity(cast(T)y))
{
// overflow, except in edge case...
x = h + l;
t = x - h;
y = parts.length && t == l && !std.math.signbit(l*parts[$-1]) ?
x * 2 :
F.infinity * of;
parts = null;
}
else if (l)
{
bool _break;
y = partialsReducePred(y, l, parts.length ? parts[$-1] : 0, _break);
if (_break)
parts = null;
}
}
else
{
y = F.infinity * of;
parts = null;
}
}
return partialsReduce(y, parts);
}
else
static if (summation == Summation.kb2)
{
return s + (cs + ccs);
}
else
static if (summation == Summation.kbn)
{
return s + c;
}
else
static if (summation == Summation.kahan)
{
return s;
}
else
static if (summation == Summation.pairwise)
{
F s = summationInitValue!T;
assert((counter == 0) == (index == 0));
foreach_reverse (ref e; partials[0 .. index])
{
static if (is(F : __vector(W[N]), W, size_t N))
s += cast(Unqual!F) e; //DMD bug workaround
else
s += e;
}
return s;
}
else
static if (summation == Summation.naive)
{
return s;
}
else
static if (summation == Summation.fast)
{
return s;
}
else
static assert(0);
}
version(none)
static if (summation == Summation.precise)
F partialsSum()() const
{
debug(numeric) partialsDebug;
auto parts = partials[];
F y = 0.0;
//pick last
if (parts.length)
{
y = parts[$-1];
parts = parts[0..$-1];
}
return partialsReduce(y, parts);
}
///Returns `Summator` with extended internal partial sums.
C opCast(C : Summator!(P, _summation), P, Summation _summation)() const
if (
_summation == summation &&
isMutable!C &&
P.max_exp >= T.max_exp &&
P.mant_dig >= T.mant_dig
)
{
static if (is(P == T))
return this;
else
static if (summation == Summation.precise)
{
auto ret = typeof(return).init;
ret.s = s;
ret.o = o;
ret.partials = scopeBuffer(ret.scopeBufferArray);
foreach (p; partials[])
{
ret.partials.put(p);
}
enum exp_diff = P.max_exp / T.max_exp;
static if (exp_diff)
{
if (ret.o)
{
immutable f = ret.o / exp_diff;
immutable t = cast(int)(ret.o % exp_diff);
ret.o = f;
ret.put((P(2) ^^ T.max_exp) * t);
}
}
return ret;
}
else
static if (summation == Summation.kb2)
{
auto ret = typeof(return).init;
ret.s = s;
ret.cs = cs;
ret.ccs = ccs;
return ret;
}
else
static if (summation == Summation.kbn)
{
auto ret = typeof(return).init;
ret.s = s;
ret.c = c;
return ret;
}
else
static if (summation == Summation.kahan)
{
auto ret = typeof(return).init;
ret.s = s;
ret.c = c;
return ret;
}
else
static if (summation == Summation.pairwise)
{
auto ret = typeof(return).init;
ret.counter = counter;
ret.index = index;
foreach (i; 0 .. index)
ret.partials[i] = partials[i];
return ret;
}
else
static if (summation == Summation.naive)
{
auto ret = typeof(return).init;
ret.s = s;
return ret;
}
else
static if (summation == Summation.fast)
{
auto ret = typeof(return).init;
ret.s = s;
return ret;
}
else
static assert(0);
}
/++
`cast(C)` operator overloading. Returns `cast(C)sum()`.
See also: `cast`
+/
C opCast(C)() const if (is(Unqual!C == T))
{
return cast(C)sum();
}
///Operator overloading.
// opAssign should initialize partials.
void opAssign(T rhs)
{
static if (summation == Summation.precise)
{
partials.free;
partials = scopeBuffer(scopeBufferArray);
s = 0.0;
o = 0;
if (rhs) put(rhs);
}
else
static if (summation == Summation.kb2)
{
s = rhs;
static if (isComplex!T)
{
cs = 0 + 0fi;
ccs = 0 + 0fi;
}
else
{
cs = 0.0;
ccs = 0.0;
}
}
else
static if (summation == Summation.kbn)
{
s = rhs;
static if (isComplex!T)
c = 0 + 0fi;
else
c = 0.0;
}
else
static if (summation == Summation.kahan)
{
s = rhs;
static if (isComplex!T)
c = 0 + 0fi;
else
c = 0.0;
}
else
static if (summation == Summation.pairwise)
{
counter = 1;
index = 1;
partials[0] = rhs;
}
else
static if (summation == Summation.naive)
{
s = rhs;
}
else
static if (summation == Summation.fast)
{
s = rhs;
}
else
static assert(0);
}
///ditto
void opOpAssign(string op : "+")(T rhs)
{
put(rhs);
}
///ditto
void opOpAssign(string op : "+")(ref const Summator rhs)
{
static if (summation == Summation.precise)
{
s += rhs.s;
o += rhs.o;
foreach (f; rhs.partials[])
put(f);
}
else
static if (summation == Summation.kb2)
{
put(rhs.ccs);
put(rhs.cs);
put(rhs.s);
}
else
static if (summation == Summation.kbn)
{
put(rhs.c);
put(rhs.s);
}
else
static if (summation == Summation.kahan)
{
put(rhs.s);
}
else
static if (summation == Summation.pairwise)
{
foreach_reverse (e; rhs.partials[0 .. rhs.index])
put(e);
counter -= rhs.index;
counter += rhs.counter;
}
else
static if (summation == Summation.naive)
{
put(rhs.s);
}
else
static if (summation == Summation.fast)
{
put(rhs.s);
}
else
static assert(0);
}
///ditto
void opOpAssign(string op : "-")(T rhs)
{
static if (summation == Summation.precise)
{
put(-rhs);
}
else
static if (summation == Summation.kb2)
{
put(-rhs);
}
else
static if (summation == Summation.kbn)
{
put(-rhs);
}
else
static if (summation == Summation.kahan)
{
y = 0.0;
y -= rhs;
y -= c;
t = s + y;
c = t - s;
c -= y;
s = t;
}
else
static if (summation == Summation.pairwise)
{
put(-rhs);
}
else
static if (summation == Summation.naive)
{
s -= rhs;
}
else
static if (summation == Summation.fast)
{
s -= rhs;
}
else
static assert(0);
}
///ditto
void opOpAssign(string op : "-")(ref const Summator rhs)
{
static if (summation == Summation.precise)
{
s -= rhs.s;
o -= rhs.o;
foreach (f; rhs.partials[])
put(-f);
}
else
static if (summation == Summation.kb2)
{
put(-rhs.ccs);
put(-rhs.cs);
put(-rhs.s);
}
else
static if (summation == Summation.kbn)
{
put(-rhs.c);
put(-rhs.s);
}
else
static if (summation == Summation.kahan)
{
this -= rhs.s;
}
else
static if (summation == Summation.pairwise)
{
foreach_reverse (e; rhs.partials[0 .. rhs.index])
put(-e);
counter -= rhs.index;
counter += rhs.counter;
}
else
static if (summation == Summation.naive)
{
s -= rhs.s;
}
else
static if (summation == Summation.fast)
{
s -= rhs.s;
}
else
static assert(0);
}
///
version(mir_test)
@nogc nothrow unittest
{
import mir.math.common;
import mir.ndslice.topology: iota, map;
auto r1 = iota(500).map!(a => 1.7L.pow(a+1) - 1.7L.pow(a));
auto r2 = iota([500], 500).map!(a => 1.7L.pow(a+1) - 1.7L.pow(a));
Summator!(real, Summation.precise) s1 = 0, s2 = 0.0;
foreach (e; r1) s1 += e;
foreach (e; r2) s2 -= e;
s1 -= s2;
s1 -= 1.7L.pow(1000);
assert(s1.sum() == -1);
}
version(mir_test)
@nogc nothrow unittest
{
with(Summation)
foreach (summation; AliasSeq!(kahan, kbn, kb2, precise, pairwise))
foreach (T; AliasSeq!(float, double, real))
{
Summator!(T, summation) sum = 1;
sum += 3;
assert(sum.sum == 4);
sum -= 10;
assert(sum.sum == -6);
Summator!(T, summation) sum2 = 3;
sum -= sum2;
assert(sum.sum == -9);
sum2 = 100;
sum += 100;
assert(sum.sum == 91);
auto sum3 = cast(Summator!(real, summation))sum;
assert(sum3.sum == 91);
sum = sum2;
}
}
version(mir_test)
@nogc nothrow unittest
{
import std.math: approxEqual;
with(Summation)
foreach (summation; AliasSeq!(naive, fast))
foreach (T; AliasSeq!(float, double, real))
{
Summator!(T, summation) sum = 1;
sum += 3.5;
assert(sum.sum.approxEqual(4.5));
sum = 2;
assert(sum.sum == 2);
sum -= 4;
assert(sum.sum.approxEqual(-2));
}
}
static if (summation == Summation.precise)
{
///Returns `true` if current sum is a NaN.
bool isNaN()() const
{
return std.math.isNaN(s);
}
///Returns `true` if current sum is finite (not infinite or NaN).
bool isFinite()() const
{
if (s)
return false;
return !overflow;
}
///Returns `true` if current sum is ±∞.
bool isInfinity()() const
{
return std.math.isInfinity(s) || overflow();
}
}
else static if (isFloatingPoint!F)
{
///Returns `true` if current sum is a NaN.
bool isNaN()() const
{
static import std.math;
return std.math.isNaN(sum());
}
///Returns `true` if current sum is finite (not infinite or NaN).
bool isFinite()() const
{
static import std.math;
return std.math.isFinite(sum());
}
///Returns `true` if current sum is ±∞.
bool isInfinity()() const
{
static import std.math;
return std.math.isInfinity(sum());
}
}
else
{
//User defined types
}
}
version(mir_test)
unittest
{
import mir.functional: RefTuple, refTuple;
import mir.ndslice.topology: map, iota, retro;
import mir.array.allocation: array;
import std.math: isInfinity, isFinite, isNaN;
Summator!(double, Summation.precise) summator = 0.0;
enum double M = (cast(double)2) ^^ (double.max_exp - 1);
RefTuple!(double[], double)[] tests = [
refTuple(new double[0], 0.0),
refTuple([0.0], 0.0),
refTuple([1e100, 1.0, -1e100, 1e-100, 1e50, -1, -1e50], 1e-100),
refTuple([1e308, 1e308, -1e308], 1e308),
refTuple([-1e308, 1e308, 1e308], 1e308),
refTuple([1e308, -1e308, 1e308], 1e308),
refTuple([M, M, -2.0^^1000], 1.7976930277114552e+308),
refTuple([M, M, M, M, -M, -M, -M], 8.9884656743115795e+307),
refTuple([2.0^^53, -0.5, -2.0^^-54], 2.0^^53-1.0),
refTuple([2.0^^53, 1.0, 2.0^^-100], 2.0^^53+2.0),
refTuple([2.0^^53+10.0, 1.0, 2.0^^-100], 2.0^^53+12.0),
refTuple([2.0^^53-4.0, 0.5, 2.0^^-54], 2.0^^53-3.0),
refTuple([M-2.0^^970, -1, M], 1.7976931348623157e+308),
refTuple([double.max, double.max*2.^^-54], double.max),
refTuple([double.max, double.max*2.^^-53], double.infinity),
refTuple(iota([1000], 1).map!(a => 1.0/a).array , 7.4854708605503451),
refTuple(iota([1000], 1).map!(a => (-1.0)^^a/a).array, -0.69264743055982025), //0.693147180559945309417232121458176568075500134360255254120680...
refTuple(iota([1000], 1).map!(a => 1.0/a).retro.array , 7.4854708605503451),
refTuple(iota([1000], 1).map!(a => (-1.0)^^a/a).retro.array, -0.69264743055982025),
refTuple([double.infinity, -double.infinity, double.nan], double.nan),
refTuple([double.nan, double.infinity, -double.infinity], double.nan),
refTuple([double.infinity, double.nan, double.infinity], double.nan),
refTuple([double.infinity, double.infinity], double.infinity),
refTuple([double.infinity, -double.infinity], double.nan),
refTuple([-double.infinity, 1e308, 1e308, -double.infinity], -double.infinity),
refTuple([M-2.0^^970, 0.0, M], double.infinity),
refTuple([M-2.0^^970, 1.0, M], double.infinity),
refTuple([M, M], double.infinity),
refTuple([M, M, -1], double.infinity),
refTuple([M, M, M, M, -M, -M], double.infinity),
refTuple([M, M, M, M, -M, M], double.infinity),
refTuple([-M, -M, -M, -M], -double.infinity),
refTuple([M, M, -2.^^971], double.max),
refTuple([M, M, -2.^^970], double.infinity),
refTuple([-2.^^970, M, M, -0X0.0000000000001P-0 * 2.^^-1022], double.max),
refTuple([M, M, -2.^^970, 0X0.0000000000001P-0 * 2.^^-1022], double.infinity),
refTuple([-M, 2.^^971, -M], -double.max),
refTuple([-M, -M, 2.^^970], -double.infinity),
refTuple([-M, -M, 2.^^970, 0X0.0000000000001P-0 * 2.^^-1022], -double.max),
refTuple([-0X0.0000000000001P-0 * 2.^^-1022, -M, -M, 2.^^970], -double.infinity),
refTuple([2.^^930, -2.^^980, M, M, M, -M], 1.7976931348622137e+308),
refTuple([M, M, -1e307], 1.6976931348623159e+308),
refTuple([1e16, 1., 1e-16], 10_000_000_000_000_002.0),
];
foreach (i, test; tests)
{
summator = 0.0;
foreach (t; test.a) summator.put(t);
auto r = test.b;
auto s = summator.sum;
assert(summator.isNaN() == r.isNaN());
assert(summator.isFinite() == r.isFinite());
assert(summator.isInfinity() == r.isInfinity());
assert(s == r || s.isNaN && r.isNaN);
}
}
/**
Sums elements of `r`, which must be a finite
iterable.
A seed may be passed to `sum`. Not only will this seed be used as an initial
value, but its type will be used if it is not specified.
Note that these specialized summing algorithms execute more primitive operations
than vanilla summation. Therefore, if in certain cases maximum speed is required
at expense of precision, one can use $(XREF, numeric_summation, Summation.fast).
Returns:
The sum of all the elements in the range r.
See_Also: $(XREFMODULE, numeric_summation) contains detailed documentation and examples about available summation algorithms.
*/
template sum(F, Summation summation = Summation.appropriate)
if (isFloatingPoint!F && isMutable!F)
{
template sum(Range)
{
F sum(Range r)
{
return SummationAlgo!(summation, Range, F)(r);
}
F sum(Range r, F seed)
{
return SummationAlgo!(summation, Range, F)(r, seed);
}
}
}
///ditto
template sum(Summation summation = Summation.appropriate)
{
auto sum(Range)(Range r)
{
return SummationAlgo!(summation, Range, sumType!Range)(r);
}
F sum(Range, F)(Range r, F seed)
{
return SummationAlgo!(summation, Range, F)(r, seed);
}
}
///ditto
template sum(F, string summation)
if (isFloatingPoint!F && isMutable!F)
{
mixin("alias sum = .sum!(F, Summation." ~ summation ~ ");");
}
///ditto
template sum(string summation)
{
mixin("alias sum = .sum!(Summation." ~ summation ~ ");");
}
version(mir_test)
@safe pure nothrow unittest
{
static assert(is(typeof(sum([cast( byte)1])) == int));
static assert(is(typeof(sum([cast(ubyte)1])) == int));
static assert(is(typeof(sum([ 1, 2, 3, 4])) == int));
static assert(is(typeof(sum([ 1U, 2U, 3U, 4U])) == uint));
static assert(is(typeof(sum([ 1L, 2L, 3L, 4L])) == long));
static assert(is(typeof(sum([1UL, 2UL, 3UL, 4UL])) == ulong));
int[] empty;
assert(sum(empty) == 0);
assert(sum([42]) == 42);
assert(sum([42, 43]) == 42 + 43);
assert(sum([42, 43, 44]) == 42 + 43 + 44);
assert(sum([42, 43, 44, 45]) == 42 + 43 + 44 + 45);
}
version(mir_test)
@safe pure nothrow unittest
{
static assert(is(typeof(sum([1.0, 2.0, 3.0, 4.0])) == double));
static assert(is(typeof(sum!double([ 1F, 2F, 3F, 4F])) == double));
const(float[]) a = [1F, 2F, 3F, 4F];
static assert(is(typeof(sum!double(a)) == double));
const(float)[] b = [1F, 2F, 3F, 4F];
static assert(is(typeof(sum!double(a)) == double));
double[] empty;
assert(sum(empty) == 0);
assert(sum([42.]) == 42);
assert(sum([42., 43.]) == 42 + 43);
assert(sum([42., 43., 44.]) == 42 + 43 + 44);
assert(sum([42., 43., 44., 45.5]) == 42 + 43 + 44 + 45.5);
}
version(mir_test)
@safe pure nothrow unittest
{
import mir.ndslice.topology: iota;
assert(iota(2, 3).sum == 15);
}
version(mir_test)
@safe pure nothrow unittest
{
import std.container;
static assert(is(typeof(sum!double(SList!float()[])) == double));
static assert(is(typeof(sum(SList!double()[])) == double));
static assert(is(typeof(sum(SList!real()[])) == real));
assert(sum(SList!double()[]) == 0);
assert(sum(SList!double(1)[]) == 1);
assert(sum(SList!double(1, 2)[]) == 1 + 2);
assert(sum(SList!double(1, 2, 3)[]) == 1 + 2 + 3);
assert(sum(SList!double(1, 2, 3, 4)[]) == 10);
}
version(mir_test)
pure nothrow unittest // 12434
{
import mir.ndslice.slice: sliced;
import mir.ndslice.topology: map;
immutable a = [10, 20];
auto s = a.sliced;
auto s1 = sum(a); // Error
auto s2 = s.map!(x => x).sum; // Error
}
version(mir_test)
unittest
{
import std.bigint;
import mir.ndslice.topology: repeat;
auto a = BigInt("1_000_000_000_000_000_000").repeat(10);
auto b = (ulong.max/2).repeat(10);
auto sa = a.sum();
auto sb = b.sum(BigInt(0)); //reduce ulongs into bigint
assert(sa == BigInt("10_000_000_000_000_000_000"));
assert(sb == (BigInt(ulong.max/2) * 10));
}
version(mir_test)
unittest
{
with(Summation)
foreach (F; AliasSeq!(float, double, real))
{
F[] ar = [1, 2, 3, 4];
F r = 10;
assert(r == ar.sum!fast());
assert(r == ar.sum!pairwise());
assert(r == ar.sum!kahan());
assert(r == ar.sum!kbn());
assert(r == ar.sum!kb2());
}
}
version(LDC)
version(X86_Any)
version(mir_test)
unittest
{
import core.simd;
static if (__traits(compiles, double2.init + double2.init))
{
alias S = Summation;
alias sums = AliasSeq!(S.kahan, S.pairwise, S.naive, S.fast);
double2[] ar = [double2([1.0, 2]), double2([2, 3]), double2([3, 4]), double2([4, 6])];
double2 c = double2([10, 15]);
foreach (sumType; sums)
{
double2 s = ar.sum!(sumType);
assert(s.array == c.array);
}
}
}
version(LDC)
version(X86_Any)
version(mir_test)
unittest
{
import core.simd;
import mir.ndslice.topology: iota, as;
alias S = Summation;
alias sums = AliasSeq!(S.kahan, S.pairwise, S.naive, S.fast, S.precise,
S.kbn, S.kb2);
int[2] ns = [9, 101];
foreach (n; ns)
{
foreach (sumType; sums)
{
auto ar = iota(n).as!double;
double c = n * (n - 1) / 2; // gauss for n=100
double s = ar.sum!(sumType);
assert(s == c);
}
}
}
/++
Precise summation.
+/
private F sumPrecise(Range, F)(Range r, F seed = summationInitValue!F)
if (isFloatingPoint!F || isComplex!F)
{
static if (isFloatingPoint!F)
{
auto sum = Summator!(F, Summation.precise)(seed);
sum.put(r);
return sum.sum;
}
else
{
alias T = typeof(F.init.re);
auto sumRe = Summator!(T, Summation.precise)(seed.re);
auto sumIm = Summator!(T, Summation.precise)(seed.im);
import mir.ndslice.slice: isSlice;
static if (isSlice!Range)
{
import mir.algorithm.iteration: each;
r.each!((auto ref elem)
{
sumRe.put(elem.re);
sumIm.put(elem.im);
});
}
else
{
foreach (ref elem; r)
{
sumRe.put(elem.re);
sumIm.put(elem.im);
}
}
return sumRe.sum + sumIm.sum * 1fi;
}
}
private template SummationAlgo(Summation summation, Range, F)
{
static if (summation == Summation.precise)
alias SummationAlgo = sumPrecise!(Range, F);
else
static if (summation == Summation.appropriate)
{
static if (isSummable!(Range, F))
alias SummationAlgo = SummationAlgo!(Summation.pairwise, Range, F);
else
static if (is(F == class) || is(F == struct) || is(F == interface))
alias SummationAlgo = SummationAlgo!(Summation.naive, Range, F);
else
alias SummationAlgo = SummationAlgo!(Summation.fast, Range, F);
}
else
{
F SummationAlgo(Range r)
{
static if (__traits(compiles, {Summator!(F, summation) sum;}))
Summator!(F, summation) sum;
else
auto sum = Summator!(F, summation)(summationInitValue!F);
sum.put(r);
return sum.sum;
}
F SummationAlgo(Range r, F s)
{
auto sum = Summator!(F, summation)(s);
sum.put(r);
return sum.sum;
}
}
}
private T summationInitValue(T)()
{
static if (__traits(compiles, {T a = 0.0;}))
{
T a = 0.0;
return a;
}
else
static if (__traits(compiles, {T a = 0;}))
{
T a = 0;
return a;
}
else
static if (__traits(compiles, {T a = 0 + 0fi;}))
{
T a = 0 + 0fi;
return a;
}
else
{
return T.init;
}
}
private template sumType(Range)
{
import mir.ndslice.slice: isSlice, DeepElementType;
static if (isSlice!Range)
alias T = Unqual!(DeepElementType!(Range.This));
else
alias T = Unqual!(ForeachType!Range);
alias sumType = typeof(T.init + T.init);
}
package:
template isSummable(F)
{
enum bool isSummable =
__traits(compiles,
{
F a = 0.1, b, c;
b = 2.3;
c = a + b;
c = a - b;
a += b;
a -= b;
});
}
template isSummable(Range, F)
{
enum bool isSummable =
isIterable!Range &&
isImplicitlyConvertible!(sumType!Range, F) &&
isSummable!F;
}
version(mir_test)
unittest
{
import mir.ndslice.topology: iota;
static assert(isSummable!(typeof(iota([size_t.init])), double));
}
private enum bool isCompesatorAlgorithm(Summation summation) =
summation == Summation.precise
|| summation == Summation.kb2
|| summation == Summation.kbn
|| summation == Summation.kahan;
version(mir_test)
unittest
{
import mir.ndslice;
auto p = iota([2, 3, 4, 5]);
auto a = p.as!double;
auto b = a.flattened;
auto c = a.slice;
auto d = c.flattened;
auto s = p.flattened.sum;
assert(a.sum == s);
assert(b.sum == s);
assert(c.sum == s);
assert(d.sum == s);
assert(a.canonical.sum == s);
assert(b.canonical.sum == s);
assert(c.canonical.sum == s);
assert(d.canonical.sum == s);
assert(a.universal.transposed!3.sum == s);
assert(b.universal.sum == s);
assert(c.universal.transposed!3.sum == s);
assert(d.universal.sum == s);
assert(a.sum!"fast" == s);
assert(b.sum!"fast" == s);
assert(c.sum!(float, "fast") == s);
assert(d.sum!"fast" == s);
assert(a.canonical.sum!"fast" == s);
assert(b.canonical.sum!"fast" == s);
assert(c.canonical.sum!"fast" == s);
assert(d.canonical.sum!"fast" == s);
assert(a.universal.transposed!3.sum!"fast" == s);
assert(b.universal.sum!"fast" == s);
assert(c.universal.transposed!3.sum!"fast" == s);
assert(d.universal.sum!"fast" == s);
}
| D |
instance KDF_503_Karras(Npc_Default)
{
name[0] = "Каррас";
guild = GIL_KDF;
id = 503;
voice = 10;
flags = 0;
npcType = npctype_main;
B_SetAttributesToChapter(self,6);
fight_tactic = FAI_HUMAN_MASTER;
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_Pony",Face_L_NormalBart02,BodyTex_L,ITAR_KDF_M_NPC);
Mdl_SetModelFatness(self,0);
Mdl_ApplyOverlayMds(self,"Humans_Mage.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,30);
bodyStateInterruptableOverride = TRUE;
EquipItem(self,ItMW_Addon_Stab01_NPC);
aivar[AIV_MagicUser] = MAGIC_ALWAYS;
daily_routine = Rtn_Start_503;
};
func void Rtn_Start_503()
{
TA_Read_Bookstand(8,0,23,0,"NW_MONASTERY_RUNEMAKER_02");
TA_Read_Bookstand(8,0,23,0,"NW_MONASTERY_RUNEMAKER_02");
};
func void rtn_meetkiller_503()
{
TA_Stand_Guarding(8,0,23,0,"NW_CITY_SMFOREST_09");
TA_Stand_Guarding(8,0,23,0,"NW_CITY_SMFOREST_09");
};
func void rtn_inbattle_503()
{
ta_bigfight(8,0,22,0,"NW_BIGFIGHT_KDF_04");
ta_bigfight(22,0,8,0,"NW_BIGFIGHT_KDF_04");
};
func void rtn_campon_503()
{
TA_Stand_ArmsCrossed(9,0,23,0,"NW_BIGFARM_CAMPON_KDF_03");
TA_Stand_ArmsCrossed(23,0,9,0,"NW_BIGFARM_CAMPON_KDF_03");
};
| D |
/**
Adler-32 implementation. This module conforms to the APIs defined in std.digest.
*/
module nxt.digestx.adler;
public import std.digest;
/// Template API Adler32 implementation.
struct Adler32
{
/// Initializes the digest calculation.
void start() @safe pure nothrow @nogc
{
_a = 1;
_b = 0;
_tlen = moduloInterval;
}
/// Feeds the digest with data.
void put(scope const(ubyte)[] data...) @trusted pure nothrow @nogc
{
foreach (immutable ubyte i; data)
{
_a += i;
_b += _a;
--_tlen;
if (_tlen == 0)
{
_a %= 65521;
_b %= 65521;
_tlen = moduloInterval;
}
}
if (_tlen != moduloInterval)
{
_a %= 65521;
_b %= 65521;
}
}
/// Returns the finished Adler-32 digest. This also calls start to reset the internal state.
ubyte[4] finish() @trusted pure nothrow @nogc
{
import std.bitmanip : nativeToBigEndian;
auto a = _a, b = _b;
start();
static if (__VERSION__ < 2067)
{
// Phobos bug: std.bitmanip.nativeToBigEndian is not annotated with @nogc
return (cast(ubyte[4]function(uint) @safe pure nothrow @nogc)&nativeToBigEndian!uint)(
(b << 16) | a);
}
else
{
return nativeToBigEndian((b << 16) | a);
}
}
private:
uint _a = void, _b = void;
uint _tlen = void;
enum moduloInterval = 5552;
}
///
unittest
{
Adler32 adler;
adler.start();
adler.put(cast(ubyte[]) "abc");
assert(adler.finish() == hexString!"024d0127");
adler.start();
adler.put(cast(ubyte[]) "def");
assert(adler.finish() == hexString!"025F0130");
}
/// Convenience alias for $(D digest) function in std.digest using the Adler32 implementation.
auto adler32Of(T...)(T data)
{
return digest!(Adler32, T)(data);
}
/// OOP API for Adler32.
alias Adler32Digest = WrapperDigest!Adler32;
///
unittest
{
auto adler = new Adler32Digest;
assert(adler.digest("abc") == hexString!"024d0127");
}
@safe pure nothrow @nogc unittest
{
static assert(isDigest!Adler32);
assert(adler32Of("abc") == hexString!"024d0127");
assert(adler32Of("abcdefghijklmnopqrstuvwxyz") == hexString!"90860B20");
}
version(unittest)
{
import std.conv : hexString;
}
| D |
// Written in the D programming language.
/**
A one-stop shop for converting values from one type to another.
Copyright: Copyright Digital Mars 2007-.
License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: $(WEB digitalmars.com, Walter Bright),
$(WEB erdani.org, Andrei Alexandrescu),
Shin Fujishiro,
Adam D. Ruppe,
Kenji Hara
Source: $(PHOBOSSRC std/_conv.d)
*/
module std.conv;
import core.stdc.math : ldexpl;
import core.stdc.string;
import std.algorithm, std.array, std.ascii, std.exception, std.math, std.range,
std.string, std.traits, std.typecons, std.typetuple, std.uni,
std.utf;
import std.format;
import std.metastrings;
//debug=conv; // uncomment to turn on debugging printf's
/* ************* Exceptions *************** */
/**
* Thrown on conversion errors.
*/
class ConvException : Exception
{
this(string s, string fn = __FILE__, size_t ln = __LINE__)
{
super(s, fn, ln);
}
}
private string convError_unexpected(S)(S source) {
return source.empty ? "end of input" : text("'", source.front, "'");
}
private void convError(S, T)(S source, string fn = __FILE__, size_t ln = __LINE__)
{
throw new ConvException(
text("Unexpected ", convError_unexpected(source),
" when converting from type "~S.stringof~" to type "~T.stringof),
fn, ln);
}
private void convError(S, T)(S source, int radix, string fn = __FILE__, size_t ln = __LINE__)
{
throw new ConvException(
text("Unexpected ", convError_unexpected(source),
" when converting from type "~S.stringof~" base ", radix,
" to type "~T.stringof),
fn, ln);
}
private void parseError(lazy string msg, string fn = __FILE__, size_t ln = __LINE__)
{
throw new ConvException(text("Can't parse string: ", msg), fn, ln);
}
private void parseCheck(alias source)(dchar c, string fn = __FILE__, size_t ln = __LINE__)
{
if (source.front != c)
parseError(text("\"", c, "\" is missing"), fn, ln);
source.popFront();
}
private
{
template isImaginary(T)
{
enum bool isImaginary = staticIndexOf!(Unqual!(T),
ifloat, idouble, ireal) >= 0;
}
template isComplex(T)
{
enum bool isComplex = staticIndexOf!(Unqual!(T),
cfloat, cdouble, creal) >= 0;
}
template isNarrowInteger(T)
{
enum bool isNarrowInteger = staticIndexOf!(Unqual!(T),
byte, ubyte, short, ushort) >= 0;
}
T toStr(T, S)(S src)
if (isSomeString!T)
{
auto w = appender!T();
FormatSpec!(ElementEncodingType!T) f;
formatValue(w, src, f);
return w.data;
}
template isEnumStrToStr(S, T)
{
enum isEnumStrToStr = isImplicitlyConvertible!(S, T) &&
is(S == enum) && isSomeString!T;
}
template isNullToStr(S, T)
{
enum isNullToStr = isImplicitlyConvertible!(S, T) &&
is(S == typeof(null)) && isSomeString!T;
}
template isRawStaticArray(T, A...)
{
enum isRawStaticArray =
A.length == 0 &&
isStaticArray!T &&
!is(T == class) &&
!is(T == interface) &&
!is(T == struct) &&
!is(T == union);
}
}
/**
* Thrown on conversion overflow errors.
*/
class ConvOverflowException : ConvException
{
this(string s, string fn = __FILE__, size_t ln = __LINE__)
{
super(s, fn, ln);
}
}
/* **************************************************************
The $(D_PARAM to) family of functions converts a value from type
$(D_PARAM Source) to type $(D_PARAM Target). The source type is
deduced and the target type must be specified, for example the
expression $(D_PARAM to!int(42.0)) converts the number 42 from
$(D_PARAM double) to $(D_PARAM int). The conversion is "safe", i.e.,
it checks for overflow; $(D_PARAM to!int(4.2e10)) would throw the
$(D_PARAM ConvOverflowException) exception. Overflow checks are only
inserted when necessary, e.g., $(D_PARAM to!double(42)) does not do
any checking because any int fits in a double.
Converting a value to its own type (useful mostly for generic code)
simply returns its argument.
Example:
-------------------------
int a = 42;
auto b = to!int(a); // b is int with value 42
auto c = to!double(3.14); // c is double with value 3.14
-------------------------
Converting among numeric types is a safe way to cast them around.
Conversions from floating-point types to integral types allow loss of
precision (the fractional part of a floating-point number). The
conversion is truncating towards zero, the same way a cast would
truncate. (To round a floating point value when casting to an
integral, use $(D_PARAM roundTo).)
Examples:
-------------------------
int a = 420;
auto b = to!long(a); // same as long b = a;
auto c = to!byte(a / 10); // fine, c = 42
auto d = to!byte(a); // throw ConvOverflowException
double e = 4.2e6;
auto f = to!int(e); // f == 4200000
e = -3.14;
auto g = to!uint(e); // fails: floating-to-integral negative overflow
e = 3.14;
auto h = to!uint(e); // h = 3
e = 3.99;
h = to!uint(a); // h = 3
e = -3.99;
f = to!int(a); // f = -3
-------------------------
Conversions from integral types to floating-point types always
succeed, but might lose accuracy. The largest integers with a
predecessor representable in floating-point format are 2^24-1 for
float, 2^53-1 for double, and 2^64-1 for $(D_PARAM real) (when
$(D_PARAM real) is 80-bit, e.g. on Intel machines).
Example:
-------------------------
int a = 16_777_215; // 2^24 - 1, largest proper integer representable as float
assert(to!int(to!float(a)) == a);
assert(to!int(to!float(-a)) == -a);
a += 2;
assert(to!int(to!float(a)) == a); // fails!
-------------------------
Conversions from string to numeric types differ from the C equivalents
$(D_PARAM atoi()) and $(D_PARAM atol()) by checking for overflow and
not allowing whitespace.
For conversion of strings to signed types, the grammar recognized is:
<pre>
$(I Integer): $(I Sign UnsignedInteger)
$(I UnsignedInteger)
$(I Sign):
$(B +)
$(B -)
</pre>
For conversion to unsigned types, the grammar recognized is:
<pre>
$(I UnsignedInteger):
$(I DecimalDigit)
$(I DecimalDigit) $(I UnsignedInteger)
</pre>
Converting an array to another array type works by converting each
element in turn. Associative arrays can be converted to associative
arrays as long as keys and values can in turn be converted.
Example:
-------------------------
int[] a = ([1, 2, 3]).dup;
auto b = to!(float[])(a);
assert(b == [1.0f, 2, 3]);
string str = "1 2 3 4 5 6";
auto numbers = to!(double[])(split(str));
assert(numbers == [1.0, 2, 3, 4, 5, 6]);
int[string] c;
c["a"] = 1;
c["b"] = 2;
auto d = to!(double[wstring])(c);
assert(d["a"w] == 1 && d["b"w] == 2);
-------------------------
Conversions operate transitively, meaning that they work on arrays and
associative arrays of any complexity:
-------------------------
int[string][double[int[]]] a;
...
auto b = to!(short[wstring][string[double[]]])(a);
-------------------------
This conversion works because $(D_PARAM to!short) applies to an
$(D_PARAM int), $(D_PARAM to!wstring) applies to a $(D_PARAM
string), $(D_PARAM to!string) applies to a $(D_PARAM double), and
$(D_PARAM to!(double[])) applies to an $(D_PARAM int[]). The
conversion might throw an exception because $(D_PARAM to!short)
might fail the range check.
Macros: WIKI=Phobos/StdConv
*/
/**
Entry point that dispatches to the appropriate conversion
primitive. Client code normally calls $(D _to!TargetType(value))
(and not some variant of $(D toImpl)).
*/
template to(T)
{
T to(A...)(A args)
if (!isRawStaticArray!A)
{
return toImpl!T(args);
}
// Fix issue 6175
T to(S)(ref S arg)
if (isRawStaticArray!S)
{
return toImpl!T(arg);
}
}
// Tests for issue 6175
unittest
{
char[9] sarr = "blablabla";
auto darr = to!(char[])(sarr);
assert(sarr.ptr == darr.ptr);
assert(sarr.length == darr.length);
}
// Tests for issue 7348
unittest
{
assert(to!string(null) == "null");
assert(text(null) == "null");
}
/**
If the source type is implicitly convertible to the target type, $(D
to) simply performs the implicit conversion.
*/
T toImpl(T, S)(S value)
if (isImplicitlyConvertible!(S, T) &&
!isEnumStrToStr!(S, T) && !isNullToStr!(S, T))
{
alias isUnsigned isUnsignedInt;
// Conversion from integer to integer, and changing its sign
static if (isUnsignedInt!S && isSignedInt!T && S.sizeof == T.sizeof)
{ // unsigned to signed & same size
enforce(value <= cast(S)T.max,
new ConvOverflowException("Conversion positive overflow"));
}
else static if (isSignedInt!S && isUnsignedInt!T)
{ // signed to unsigned
enforce(0 <= value,
new ConvOverflowException("Conversion negative overflow"));
}
return value;
}
private template isSignedInt(T)
{
enum isSignedInt = isIntegral!T && isSigned!T;
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
int a = 42;
auto b = to!long(a);
assert(a == b);
}
// Tests for issue 6377
unittest
{
// Conversion between same size
foreach (S; TypeTuple!(byte, short, int, long))
{
alias Unsigned!S U;
foreach (Sint; TypeTuple!(S, const(S), immutable(S)))
foreach (Uint; TypeTuple!(U, const(U), immutable(U)))
{
// positive overflow
Uint un = Uint.max;
assertThrown!ConvOverflowException(to!Sint(un), text(
Sint.stringof, ' ', Uint.stringof, ' ', un));
// negative overflow
Sint sn = -1;
assertThrown!ConvOverflowException(to!Uint(sn), text(
Sint.stringof, ' ', Uint.stringof, ' ', un));
}
}
// Conversion between different size
foreach (i, S1; TypeTuple!(byte, short, int, long))
foreach ( S2; TypeTuple!(byte, short, int, long)[i+1..$])
{
alias Unsigned!S1 U1;
alias Unsigned!S2 U2;
static assert(U1.sizeof < S2.sizeof);
// small unsigned to big signed
foreach (Uint; TypeTuple!(U1, const(U1), immutable(U1)))
foreach (Sint; TypeTuple!(S2, const(S2), immutable(S2)))
{
Uint un = Uint.max;
assertNotThrown(to!Sint(un));
assert(to!Sint(un) == un);
}
// big unsigned to small signed
foreach (Uint; TypeTuple!(U2, const(U2), immutable(U2)))
foreach (Sint; TypeTuple!(S1, const(S1), immutable(S1)))
{
Uint un = Uint.max;
assertThrown(to!Sint(un));
}
static assert(S1.sizeof < U2.sizeof);
// small signed to big unsigned
foreach (Sint; TypeTuple!(S1, const(S1), immutable(S1)))
foreach (Uint; TypeTuple!(U2, const(U2), immutable(U2)))
{
Sint sn = -1;
assertThrown!ConvOverflowException(to!Uint(sn));
}
// big signed to small unsigned
foreach (Sint; TypeTuple!(S2, const(S2), immutable(S2)))
foreach (Uint; TypeTuple!(U1, const(U1), immutable(U1)))
{
Sint sn = -1;
assertThrown!ConvOverflowException(to!Uint(sn));
}
}
}
/*
Converting static arrays forwards to their dynamic counterparts.
*/
T toImpl(T, S)(ref S s)
if (isRawStaticArray!S)
{
return toImpl!(T, typeof(s[0])[])(s);
}
unittest
{
char[4] test = ['a', 'b', 'c', 'd'];
static assert(!isInputRange!(Unqual!(char[4])));
assert(to!string(test) == test);
}
/**
$(RED Deprecated. It will be removed in August 2012. Please define $(D opCast)
for user-defined types instead of a $(D to) function.
$(LREF to) will now use $(D opCast).)
Object-_to-non-object conversions look for a method "to" of the source
object.
Example:
----
class Date
{
T to(T)() if(is(T == long))
{
return timestamp;
}
...
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
auto d = new Date;
auto ts = to!long(d); // same as d.to!long()
}
----
*/
deprecated T toImpl(T, S)(S value)
if (is(S : Object) && !is(T : Object) && !isSomeString!T &&
hasMember!(S, "to") && is(typeof(S.init.to!T()) : T))
{
return value.to!T();
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
class B
{
T to(T)() { return 43; }
}
auto b = new B;
assert(to!int(b) == 43);
}
/**
When source type supports member template function opCast, is is used.
*/
T toImpl(T, S)(S value)
if (is(typeof(S.init.opCast!T()) : T) &&
!isSomeString!T)
{
return value.opCast!T();
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
class B
{
T opCast(T)() { return 43; }
}
auto b = new B;
assert(to!int(b) == 43);
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
struct S
{
T opCast(T)() { return 43; }
}
auto s = S();
assert(to!int(s) == 43);
}
/**
When target type supports 'converting construction', it is used.
$(UL $(LI If target type is struct, $(D T(value)) is used.)
$(LI If target type is class, $(D new T(value)) is used.))
*/
T toImpl(T, S)(S value)
if (!isImplicitlyConvertible!(S, T) &&
is(T == struct) && is(typeof(T(value))))
{
return T(value);
}
// Bugzilla 3961
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
struct Int
{
int x;
}
Int i = to!Int(1);
static struct Int2
{
int x;
this(int x) { this.x = x; }
}
Int2 i2 = to!Int2(1);
static struct Int3
{
int x;
static Int3 opCall(int x)
{
Int3 i;
i.x = x;
return i;
}
}
Int3 i3 = to!Int3(1);
}
// Bugzilla 6808
unittest
{
static struct FakeBigInt
{
this(string s){}
}
string s = "101";
auto i3 = to!FakeBigInt(s);
}
/// ditto
T toImpl(T, S)(S value)
if (!isImplicitlyConvertible!(S, T) &&
is(T == class) && is(typeof(new T(value))))
{
return new T(value);
}
unittest
{
static struct S
{
int x;
}
static class C
{
int x;
this(int x) { this.x = x; }
}
static class B
{
int value;
this(S src) { value = src.x; }
this(C src) { value = src.x; }
}
S s = S(1);
auto b1 = to!B(s); // == new B(s)
assert(b1.value == 1);
C c = new C(2);
auto b2 = to!B(c); // == new B(c)
assert(b2.value == 2);
auto c2 = to!C(3); // == new C(3)
assert(c2.x == 3);
}
version (unittest)
{
class A
{
this(B b) {}
}
class B : A
{
this() { super(this); }
}
}
unittest
{
B b = new B();
A a = to!A(b); // == cast(A)b
// (do not run construction conversion like new A(b))
assert(b is a);
static class C : Object
{
this() {}
this(Object o) {}
}
Object oc = new C();
C a2 = to!C(oc); // == new C(a)
// Construction conversion overrides down-casting conversion
assert(a2 != a); //
}
/**
Object-to-object conversions by dynamic casting throw exception when the source is
non-null and the target is null.
*/
T toImpl(T, S)(S value)
if (!isImplicitlyConvertible!(S, T) &&
(is(S == class) || is(S == interface)) && !is(typeof(value.opCast!T()) : T) &&
(is(T == class) || is(T == interface)) && !is(typeof(new T(value))))
{
static if (is(T == immutable))
{
// immutable <- immutable
enum isModConvertible = is(S == immutable);
}
else static if (is(T == const))
{
static if (is(T == shared))
{
// shared const <- shared
// shared const <- shared const
// shared const <- immutable
enum isModConvertible = is(S == shared) || is(S == immutable);
}
else
{
// const <- mutable
// const <- immutable
enum isModConvertible = !is(S == shared);
}
}
else
{
static if (is(T == shared))
{
// shared <- shared mutable
enum isModConvertible = is(S == shared) && !is(S == const);
}
else
{
// (mutable) <- (mutable)
enum isModConvertible = is(Unqual!S == S);
}
}
static assert(isModConvertible, "Bad modifier conversion: "~S.stringof~" to "~T.stringof);
auto result = cast(T) value;
if (!result && value)
{
throw new ConvException("Cannot convert object of static type "
~S.classinfo.name~" and dynamic type "~value.classinfo.name
~" to type "~T.classinfo.name);
}
return result;
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
// Testing object conversions
class A {}
class B : A {}
class C : A {}
A a1 = new A, a2 = new B, a3 = new C;
assert(to!B(a2) is a2);
assert(to!C(a3) is a3);
assertThrown!ConvException(to!B(a3));
}
// Unittest for 6288
version (unittest)
{
private template Identity(T) { alias T Identity; }
private template toConst(T) { alias const(T) toConst; }
private template toShared(T) { alias shared(T) toShared; }
private template toSharedConst(T) { alias shared(const(T)) toSharedConst; }
private template toImmutable(T) { alias immutable(T) toImmutable; }
private template AddModifier(int n) if (0 <= n && n < 5)
{
static if (n == 0) alias Identity AddModifier;
else static if (n == 1) alias toConst AddModifier;
else static if (n == 2) alias toShared AddModifier;
else static if (n == 3) alias toSharedConst AddModifier;
else static if (n == 4) alias toImmutable AddModifier;
}
}
unittest
{
interface I {}
interface J {}
class A {}
class B : A {}
class C : B, I, J {}
class D : I {}
foreach (m1; TypeTuple!(0,1,2,3,4)) // enumerate modifiers
foreach (m2; TypeTuple!(0,1,2,3,4)) // ditto
{
alias AddModifier!m1 srcmod;
alias AddModifier!m2 tgtmod;
//pragma(msg, srcmod!Object, " -> ", tgtmod!Object, ", convertible = ",
// isImplicitlyConvertible!(srcmod!Object, tgtmod!Object));
// Compile time convertible equals to modifier convertible.
static if (isImplicitlyConvertible!(srcmod!Object, tgtmod!Object))
{
// Test runtime conversions: class to class, class to interface,
// interface to class, and interface to interface
// Check that the runtime conversion to succeed
srcmod!A ac = new srcmod!C();
srcmod!I ic = new srcmod!C();
assert(to!(tgtmod!C)(ac) !is null); // A(c) to C
assert(to!(tgtmod!I)(ac) !is null); // A(c) to I
assert(to!(tgtmod!C)(ic) !is null); // I(c) to C
assert(to!(tgtmod!J)(ic) !is null); // I(c) to J
// Check that the runtime conversion fails
srcmod!A ab = new srcmod!B();
srcmod!I id = new srcmod!D();
assertThrown(to!(tgtmod!C)(ab)); // A(b) to C
assertThrown(to!(tgtmod!I)(ab)); // A(b) to I
assertThrown(to!(tgtmod!C)(id)); // I(d) to C
assertThrown(to!(tgtmod!J)(id)); // I(d) to J
}
else
{
// Check that the conversion is rejected statically
static assert(!is(typeof(to!(tgtmod!C)(srcmod!A.init)))); // A to C
static assert(!is(typeof(to!(tgtmod!I)(srcmod!A.init)))); // A to I
static assert(!is(typeof(to!(tgtmod!C)(srcmod!I.init)))); // I to C
static assert(!is(typeof(to!(tgtmod!J)(srcmod!I.init)))); // I to J
}
}
}
/**
Stringnize conversion from all types is supported.
$(UL
$(LI String _to string conversion works for any two string types having
($(D char), $(D wchar), $(D dchar)) character widths and any
combination of qualifiers (mutable, $(D const), or $(D immutable)).)
$(LI Converts array (other than strings) to string.
Each element is converted by calling $(D to!T).)
$(LI Associative array to string conversion.
Each element is printed by calling $(D to!T).)
$(LI Object to string conversion calls $(D toString) against the object or
returns $(D "null") if the object is null.)
$(LI Struct to string conversion calls $(D toString) against the struct if
it is defined.)
$(LI For structs that do not define $(D toString), the conversion to string
produces the list of fields.)
$(LI Enumerated types are converted to strings as their symbolic names.)
$(LI Boolean values are printed as $(D "true") or $(D "false").)
$(LI $(D char), $(D wchar), $(D dchar) to a string type.)
$(LI Unsigned or signed integers to strings.
$(DL $(DT [special case])
$(DD Convert integral value to string in $(D_PARAM radix) radix.
radix must be a value from 2 to 36.
value is treated as a signed value only if radix is 10.
The characters A through Z are used to represent values 10 through 36.)))
$(LI All floating point types to all string types.)
$(LI Pointer to string conversions prints the pointer as a $(D size_t) value.
If pointer is $(D char*), treat it as C-style strings.))
*/
T toImpl(T, S)(S value)
if (!(isImplicitlyConvertible!(S, T) &&
!isEnumStrToStr!(S, T) && !isNullToStr!(S, T)) &&
isSomeString!T && !isAggregateType!T)
{
static if (isSomeString!S && value[0].sizeof == ElementEncodingType!T.sizeof)
{
// string-to-string with incompatible qualifier conversion
static if (is(ElementEncodingType!T == immutable))
{
// conversion (mutable|const) -> immutable
return value.idup;
}
else
{
// conversion (immutable|const) -> mutable
return value.dup;
}
}
else static if (isSomeString!S)
{
// other string-to-string conversions always run decode/encode
return toStr!T(value);
}
else static if (is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[]))
{
// Converting void array to string
alias Unqual!(ElementEncodingType!T) Char;
auto raw = cast(const(ubyte)[]) value;
enforce(raw.length % Char.sizeof == 0,
new ConvException("Alignment mismatch in converting a "
~ S.stringof ~ " to a "
~ T.stringof));
auto result = new Char[raw.length / Char.sizeof];
memcpy(result.ptr, value.ptr, value.length);
return cast(T) result;
}
else static if (isPointer!S && is(S : const(char)*))
{
return value ? cast(T) value[0 .. strlen(value)].dup : cast(string)null;
}
else
{
// other non-string values runs formatting
return toStr!T(value);
}
}
unittest
{
// string to string conversion
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
alias TypeTuple!(char, wchar, dchar) Chars;
foreach (LhsC; Chars)
{
alias TypeTuple!(LhsC[], const(LhsC)[], immutable(LhsC)[]) LhStrings;
foreach (Lhs; LhStrings)
{
foreach (RhsC; Chars)
{
alias TypeTuple!(RhsC[], const(RhsC)[], immutable(RhsC)[])
RhStrings;
foreach (Rhs; RhStrings)
{
Lhs s1 = to!Lhs("wyda");
Rhs s2 = to!Rhs(s1);
//writeln(Lhs.stringof, " -> ", Rhs.stringof);
assert(s1 == to!Lhs(s2));
}
}
}
}
foreach (T; Chars)
{
foreach (U; Chars)
{
T[] s1 = to!(T[])("Hello, world!");
auto s2 = to!(U[])(s1);
assert(s1 == to!(T[])(s2));
auto s3 = to!(const(U)[])(s1);
assert(s1 == to!(T[])(s3));
auto s4 = to!(immutable(U)[])(s1);
assert(s1 == to!(T[])(s4));
}
}
}
unittest
{
// Conversion reinterpreting void array to string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
auto a = "abcx"w;
const(void)[] b = a;
assert(b.length == 8);
auto c = to!(wchar[])(b);
assert(c == "abcx");
}
unittest
{
// char* to string conversion
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("string.to!string(char*).unittest\n");
assert(to!string(cast(char*) null) == "");
assert(to!string("foo\0".ptr) == "foo");
}
unittest
{
// Conversion representing bool value with string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
bool b;
assert(to!string(b) == "false");
b = true;
assert(to!string(b) == "true");
}
unittest
{
// Conversion representing character value with string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
alias TypeTuple!(
char, wchar, dchar,
const(char), const(wchar), const(dchar),
immutable(char), immutable(wchar), immutable(dchar)) AllChars;
foreach (Char1; AllChars)
{
foreach (Char2; AllChars)
{
Char1 c = 'a';
assert(to!(Char2[])(c)[0] == c);
}
uint x = 4;
assert(to!(Char1[])(x) == "4");
}
string s = "foo";
string s2;
foreach (char c; s)
{
s2 ~= to!string(c);
}
//printf("%.*s", s2);
assert(s2 == "foo");
}
unittest
{
// Conversion representing integer values with string
foreach (Int; TypeTuple!(ubyte, ushort, uint, ulong))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("string.to!string(%.*s).unittest\n", Int.stringof.length, Int.stringof.ptr);
assert(to!string(to!Int(0)) == "0");
assert(to!string(to!Int(9)) == "9");
assert(to!string(to!Int(123)) == "123");
}
foreach (Int; TypeTuple!(byte, short, int, long))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("string.to!string(%.*s).unittest\n", Int.stringof.length, Int.stringof.ptr);
assert(to!string(to!Int(0)) == "0");
assert(to!string(to!Int(9)) == "9");
assert(to!string(to!Int(123)) == "123");
assert(to!string(to!Int(-0)) == "0");
assert(to!string(to!Int(-9)) == "-9");
assert(to!string(to!Int(-123)) == "-123");
assert(to!string(to!(const Int)(6)) == "6");
}
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
assert(wtext(int.max) == "2147483647"w);
assert(wtext(int.min) == "-2147483648"w);
assert(to!string(0L) == "0");
}
unittest
{
// Conversion representing dynamic/static array with string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
long[] b = [ 1, 3, 5 ];
auto s = to!string(b);
assert(to!string(b) == "[1, 3, 5]", s);
double[2] a = [ 1.5, 2.5 ];
assert(to!string(a) == "[1.5, 2.5]");
}
unittest
{
// Conversion representing associative array with string
int[string] a = ["0":1, "1":2];
assert(to!string(a) == `["0":1, "1":2]`);
}
unittest
{
// Conversion representing class object with string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
class A
{
override string toString() { return "an A"; }
}
A a;
assert(to!string(a) == "null");
a = new A;
assert(to!string(a) == "an A");
// Bug 7660
class C { override string toString() { return "C"; } }
struct S { C c; alias c this; }
S s; s.c = new C();
assert(to!string(s) == "C");
}
unittest
{
// Conversion representing struct object with string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
struct S1
{
string toString() { return "wyda"; }
}
assert(to!string(S1()) == "wyda");
struct S2
{
int a = 42;
float b = 43.5;
}
S2 s2;
assert(to!string(s2) == "S2(42, 43.5)");
// Test for issue 8080
struct S8080
{
short[4] data;
alias data this;
string toString() { return "<S>"; }
}
S8080 s8080;
assert(to!string(s8080) == "<S>");
}
unittest
{
// Conversion representing enum value with string
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
enum EB : bool { a = true }
enum EU : uint { a = 0, b = 1, c = 2 } // base type is unsigned
enum EI : int { a = -1, b = 0, c = 1 } // base type is signed (bug 7909)
enum EF : real { a = 1.414, b = 1.732, c = 2.236 }
enum EC : char { a = 'a', b = 'b' }
enum ES : string { a = "aaa", b = "bbb" }
foreach (E; TypeTuple!(EB, EU, EI, EF, EC, ES))
{
assert(to! string(E.a) == "a"c);
assert(to!wstring(E.a) == "a"w);
assert(to!dstring(E.a) == "a"d);
}
// Test an value not corresponding to an enum member.
auto o = cast(EU)5;
assert(to! string(o) == "cast(EU)5"c);
assert(to!wstring(o) == "cast(EU)5"w);
assert(to!dstring(o) == "cast(EU)5"d);
}
/// ditto
T toImpl(T, S)(S value, uint radix)
if (isIntegral!S &&
isSomeString!T)
in
{
assert(radix >= 2 && radix <= 36);
}
body
{
static if (!is(IntegralTypeOf!S == ulong))
{
enforce(radix >= 2 && radix <= 36, new ConvException("Radix error"));
if (radix == 10)
return to!string(value); // handle signed cases only for radix 10
return to!string(cast(ulong) value, radix);
}
else
{
char[value.sizeof * 8] buffer;
uint i = buffer.length;
if (value < radix && value < hexDigits.length)
return hexDigits[cast(size_t)value .. cast(size_t)value + 1];
do
{
ubyte c;
c = cast(ubyte)(value % radix);
value = value / radix;
i--;
buffer[i] = cast(char)((c < 10) ? c + '0' : c + 'A' - 10);
} while (value);
return to!T(buffer[i .. $].dup);
}
}
unittest
{
foreach (Int; TypeTuple!(uint, ulong))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("string.to!string(%.*s, uint).unittest\n", Int.stringof.length, Int.stringof.ptr);
assert(to!string(to!Int(16), 16) == "10");
assert(to!string(to!Int(15), 2u) == "1111");
assert(to!string(to!Int(1), 2u) == "1");
assert(to!string(to!Int(0x1234AF), 16u) == "1234AF");
}
foreach (Int; TypeTuple!(int, long))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("string.to!string(%.*s, uint).unittest\n", Int.stringof.length, Int.stringof.ptr);
assert(to!string(to!Int(-10), 10u) == "-10");
}
}
/**
$(RED Deprecated. It will be removed in January 2013.
Please use $(XREF format, formattedWrite) instead.)
Conversions to string with optional configures.
*/
deprecated T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]")
if (!isSomeChar!(ElementType!S) && (isInputRange!S || isInputRange!(Unqual!S)) &&
isSomeString!T)
{
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
"std.format.formattedWrite"));
static if (!isInputRange!S)
{
alias toImpl!(T, Unqual!S) ti;
return ti(s, leftBracket, separator, rightBracket);
}
else
{
alias Unqual!(ElementEncodingType!T) Char;
// array-to-string conversion
auto result = appender!(Char[])();
result.put(leftBracket);
bool first = true;
for (; !s.empty; s.popFront())
{
if (!first)
{
result.put(separator);
}
else
{
first = false;
}
result.put(to!T(s.front));
}
result.put(rightBracket);
return cast(T) result.data;
}
}
/// ditto
deprecated T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]")
if ((is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) &&
isSomeString!T)
{
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
"std.format.formattedWrite"));
return toImpl(s);
}
/// ditto
deprecated T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]")
if (isAssociativeArray!S &&
isSomeString!T)
{
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
"std.format.formattedWrite"));
alias Unqual!(ElementEncodingType!T) Char;
auto result = appender!(Char[])();
// hash-to-string conversion
result.put(leftBracket);
bool first = true;
foreach (k, v; s)
{
if (!first)
result.put(separator);
else first = false;
result.put(to!T(k));
result.put(keyval);
result.put(to!T(v));
}
result.put(rightBracket);
return cast(T) result.data;
}
/// ditto
deprecated T toImpl(T, S)(S s, in T nullstr)
if (is(S : Object) &&
isSomeString!T)
{
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
"std.format.formattedWrite"));
if (!s)
return nullstr;
return to!T(s.toString());
}
/// ditto
deprecated T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")")
if (is(S == struct) && !is(typeof(&S.init.toString)) && !isInputRange!S &&
isSomeString!T)
{
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
"std.format.formattedWrite"));
Tuple!(FieldTypeTuple!S) * t = void;
static if ((*t).sizeof == S.sizeof)
{
// ok, attempt to forge the tuple
t = cast(typeof(t)) &s;
alias Unqual!(ElementEncodingType!T) Char;
auto app = appender!(Char[])();
app.put(left);
foreach (i, e; t.field)
{
if (i > 0)
app.put(to!T(separator));
app.put(to!T(e));
}
app.put(right);
return cast(T) app.data;
}
else
{
// struct with weird alignment
return to!T(S.stringof);
}
}
/*
$(LI A $(D typedef Type Symbol) is converted to string as $(D "Type(value)").)
*/
deprecated T toImpl(T, S)(S s, in T left = to!T(S.stringof~"("), in T right = ")")
if (is(S == typedef) &&
isSomeString!T)
{
static if (is(S Original == typedef))
{
// typedef
return left ~ to!T(cast(Original) s) ~ right;
}
}
/**
Narrowing numeric-numeric conversions throw when the value does not
fit in the narrower type.
*/
T toImpl(T, S)(S value)
if (!isImplicitlyConvertible!(S, T) &&
(isNumeric!S || isSomeChar!S) &&
(isNumeric!T || isSomeChar!T))
{
enum sSmallest = mostNegative!S;
enum tSmallest = mostNegative!T;
static if (sSmallest < 0)
{
// possible underflow converting from a signed
static if (tSmallest == 0)
{
immutable good = value >= 0;
}
else
{
static assert(tSmallest < 0);
immutable good = value >= tSmallest;
}
if (!good)
throw new ConvOverflowException("Conversion negative overflow");
}
static if (S.max > T.max)
{
// possible overflow
if (value > T.max)
throw new ConvOverflowException("Conversion positive overflow");
}
return cast(T) value;
}
unittest
{
dchar a = ' ';
assert(to!char(a) == ' ');
a = 300;
assert(collectException(to!char(a)));
dchar from0 = 'A';
char to0 = to!char(from0);
wchar from1 = 'A';
char to1 = to!char(from1);
char from2 = 'A';
char to2 = to!char(from2);
char from3 = 'A';
wchar to3 = to!wchar(from3);
char from4 = 'A';
dchar to4 = to!dchar(from4);
}
/**
Array-to-array conversion (except when target is a string type)
converts each element in turn by using $(D to).
*/
T toImpl(T, S)(S value)
if (!isImplicitlyConvertible!(S, T) &&
!isSomeString!S && isDynamicArray!S &&
!isSomeString!T && isArray!T)
{
alias ArrayTarget!T E;
auto result = new E[value.length];
foreach (i, e; value)
{
/* Temporarily cast to mutable type, so we can get it initialized,
* this is ok because there are no other references to result[]
*/
cast()(result[i]) = to!E(e);
}
return result;
}
unittest
{
// array to array conversions
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
uint[] a = ([ 1u, 2, 3 ]).dup;
auto b = to!(float[])(a);
assert(b == [ 1.0f, 2, 3 ]);
auto c = to!(string[])(b);
assert(c[0] == "1" && c[1] == "2" && c[2] == "3");
immutable(int)[3] d = [ 1, 2, 3 ];
b = to!(float[])(d);
assert(b == [ 1.0f, 2, 3 ]);
uint[][] e = [ a, a ];
auto f = to!(float[][])(e);
assert(f[0] == b && f[1] == b);
// Test for bug 8264
struct Wrap
{
string wrap;
alias wrap this;
}
Wrap[] warr = to!(Wrap[])(["foo", "bar"]); // should work
}
/**
Associative array to associative array conversion converts each key
and each value in turn.
*/
T toImpl(T, S)(S value)
if (isAssociativeArray!S &&
isAssociativeArray!T)
{
alias typeof(T.keys[0]) K2;
alias typeof(T.values[0]) V2;
T result;
foreach (k1, v1; value)
{
result[to!K2(k1)] = to!V2(v1);
}
return result;
}
unittest
{
// hash to hash conversions
int[string] a;
a["0"] = 1;
a["1"] = 2;
auto b = to!(double[dstring])(a);
assert(b["0"d] == 1 && b["1"d] == 2);
}
private void testIntegralToFloating(Integral, Floating)()
{
Integral a = 42;
auto b = to!Floating(a);
assert(a == b);
assert(a == to!Integral(b));
}
private void testFloatingToIntegral(Floating, Integral)()
{
bool convFails(Source, Target, E)(Source src)
{
try
auto t = to!Target(src);
catch (E)
return true;
return false;
}
// convert some value
Floating a = 4.2e1;
auto b = to!Integral(a);
assert(is(typeof(b) == Integral) && b == 42);
// convert some negative value (if applicable)
a = -4.2e1;
static if (Integral.min < 0)
{
b = to!Integral(a);
assert(is(typeof(b) == Integral) && b == -42);
}
else
{
// no go for unsigned types
assert(convFails!(Floating, Integral, ConvOverflowException)(a));
}
// convert to the smallest integral value
a = 0.0 + Integral.min;
static if (Integral.min < 0)
{
a = -a; // -Integral.min not representable as an Integral
assert(convFails!(Floating, Integral, ConvOverflowException)(a)
|| Floating.sizeof <= Integral.sizeof);
}
a = 0.0 + Integral.min;
assert(to!Integral(a) == Integral.min);
--a; // no more representable as an Integral
assert(convFails!(Floating, Integral, ConvOverflowException)(a)
|| Floating.sizeof <= Integral.sizeof);
a = 0.0 + Integral.max;
// fwritefln(stderr, "%s a=%g, %s conv=%s", Floating.stringof, a,
// Integral.stringof, to!Integral(a));
assert(to!Integral(a) == Integral.max || Floating.sizeof <= Integral.sizeof);
++a; // no more representable as an Integral
assert(convFails!(Floating, Integral, ConvOverflowException)(a)
|| Floating.sizeof <= Integral.sizeof);
// convert a value with a fractional part
a = 3.14;
assert(to!Integral(a) == 3);
a = 3.99;
assert(to!Integral(a) == 3);
static if (Integral.min < 0)
{
a = -3.14;
assert(to!Integral(a) == -3);
a = -3.99;
assert(to!Integral(a) == -3);
}
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
alias TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong)
AllInts;
alias TypeTuple!(float, double, real) AllFloats;
alias TypeTuple!(AllInts, AllFloats) AllNumerics;
// test with same type
{
foreach (T; AllNumerics)
{
T a = 42;
auto b = to!T(a);
assert(is(typeof(a) == typeof(b)) && a == b);
}
}
// test that floating-point numbers convert properly to largest ints
// see http://oregonstate.edu/~peterseb/mth351/docs/351s2001_fp80x87.html
// look for "largest fp integer with a predecessor"
{
// float
int a = 16_777_215; // 2^24 - 1
assert(to!int(to!float(a)) == a);
assert(to!int(to!float(-a)) == -a);
// double
long b = 9_007_199_254_740_991; // 2^53 - 1
assert(to!long(to!double(b)) == b);
assert(to!long(to!double(-b)) == -b);
// real
// @@@ BUG IN COMPILER @@@
// ulong c = 18_446_744_073_709_551_615UL; // 2^64 - 1
// assert(to!ulong(to!real(c)) == c);
// assert(to!ulong(-to!real(c)) == c);
}
// test conversions floating => integral
{
// AllInts[0 .. $ - 1] should be AllInts
// @@@ BUG IN COMPILER @@@
foreach (Integral; AllInts[0 .. $ - 1])
{
foreach (Floating; AllFloats)
{
testFloatingToIntegral!(Floating, Integral)();
}
}
}
// test conversion integral => floating
{
foreach (Integral; AllInts[0 .. $ - 1])
{
foreach (Floating; AllFloats)
{
testIntegralToFloating!(Integral, Floating)();
}
}
}
// test parsing
{
foreach (T; AllNumerics)
{
// from type immutable(char)[2]
auto a = to!T("42");
assert(a == 42);
// from type char[]
char[] s1 = "42".dup;
a = to!T(s1);
assert(a == 42);
// from type char[2]
char[2] s2;
s2[] = "42";
a = to!T(s2);
assert(a == 42);
// from type immutable(wchar)[2]
a = to!T("42"w);
assert(a == 42);
}
}
// test conversions to string
{
foreach (T; AllNumerics)
{
T a = 42;
assert(to!string(a) == "42");
//assert(to!wstring(a) == "42"w);
//assert(to!dstring(a) == "42"d);
// array test
// T[] b = new T[2];
// b[0] = 42;
// b[1] = 33;
// assert(to!string(b) == "[42,33]");
}
}
// test array to string conversion
foreach (T ; AllNumerics)
{
auto a = [to!T(1), 2, 3];
assert(to!string(a) == "[1, 2, 3]");
}
// test enum to int conversion
// enum Testing { Test1, Test2 };
// Testing t;
// auto a = to!string(t);
// assert(a == "0");
}
/**
String to non-string conversion runs parsing.
$(UL
$(LI When the source is a wide string, it is first converted to a narrow
string and then parsed.)
$(LI When the source is a narrow string, normal text parsing occurs.))
*/
T toImpl(T, S)(S value)
if (isDynamicArray!S && isSomeString!S &&
!isSomeString!T && is(typeof(parse!T(value))))
{
scope(exit)
{
if (value.length)
{
convError!(S, T)(value);
}
}
return parse!T(value);
}
/// ditto
T toImpl(T, S)(S value, uint radix)
if (isDynamicArray!S && isSomeString!S &&
!isSomeString!T && is(typeof(parse!T(value, radix))))
{
scope(exit)
{
if (value.length)
{
convError!(S, T)(value);
}
}
return parse!T(value, radix);
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
foreach (Char; TypeTuple!(char, wchar, dchar))
{
auto a = to!(Char[])("123");
assert(to!int(a) == 123);
assert(to!double(a) == 123);
}
// 6255
auto n = to!int("FF", 16);
assert(n == 255);
}
/***************************************************************
Rounded conversion from floating point to integral.
Example:
---------------
assert(roundTo!int(3.14) == 3);
assert(roundTo!int(3.49) == 3);
assert(roundTo!int(3.5) == 4);
assert(roundTo!int(3.999) == 4);
assert(roundTo!int(-3.14) == -3);
assert(roundTo!int(-3.49) == -3);
assert(roundTo!int(-3.5) == -4);
assert(roundTo!int(-3.999) == -4);
---------------
Rounded conversions do not work with non-integral target types.
*/
template roundTo(Target)
{
Target roundTo(Source)(Source value)
{
static assert(isFloatingPoint!Source);
static assert(isIntegral!Target);
return to!Target(trunc(value + (value < 0 ? -0.5L : 0.5L)));
}
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
assert(roundTo!int(3.14) == 3);
assert(roundTo!int(3.49) == 3);
assert(roundTo!int(3.5) == 4);
assert(roundTo!int(3.999) == 4);
assert(roundTo!int(-3.14) == -3);
assert(roundTo!int(-3.49) == -3);
assert(roundTo!int(-3.5) == -4);
assert(roundTo!int(-3.999) == -4);
assert(roundTo!(const int)(to!(const double)(-3.999)) == -4);
// boundary values
foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint))
{
assert(roundTo!Int(Int.min - 0.4L) == Int.min);
assert(roundTo!Int(Int.max + 0.4L) == Int.max);
assertThrown!ConvOverflowException(roundTo!Int(Int.min - 0.5L));
assertThrown!ConvOverflowException(roundTo!Int(Int.max + 0.5L));
}
}
/***************************************************************
* The $(D_PARAM parse) family of functions works quite like the
* $(D_PARAM to) family, except that (1) it only works with character ranges
* as input, (2) takes the input by reference and advances it to
* the position following the conversion, and (3) does not throw if it
* could not convert the entire input. It still throws if an overflow
* occurred during conversion or if no character of the input
* was meaningfully converted.
*
* Example:
--------------
string test = "123 \t 76.14";
auto a = parse!uint(test);
assert(a == 123);
assert(test == " \t 76.14"); // parse bumps string
munch(test, " \t\n\r"); // skip ws
assert(test == "76.14");
auto b = parse!double(test);
assert(b == 76.14);
assert(test == "");
--------------
*/
Target parse(Target, Source)(ref Source s)
if (isSomeChar!(ElementType!Source) &&
isIntegral!Target)
{
static if (Target.sizeof < int.sizeof)
{
// smaller types are handled like integers
auto v = .parse!(Select!(Target.min < 0, int, uint))(s);
auto result = cast(Target) v;
if (result != v)
goto Loverflow;
return result;
}
else
{
// Larger than int types
if (s.empty)
goto Lerr;
static if (Target.min < 0)
int sign = 0;
else
enum int sign = 0;
Target v = 0;
size_t i = 0;
enum char maxLastDigit = Target.min < 0 ? '7' : '5';
for (; !s.empty; ++i)
{
immutable c = s.front;
if (c >= '0' && c <= '9')
{
if (v >= Target.max/10 &&
(v != Target.max/10|| c + sign > maxLastDigit))
goto Loverflow;
v = cast(Target) (v * 10 + (c - '0'));
s.popFront();
}
else static if (Target.min < 0)
{
if (c == '-' && i == 0)
{
s.popFront();
if (s.empty)
goto Lerr;
sign = -1;
}
else if (c == '+' && i == 0)
{
s.popFront();
if (s.empty)
goto Lerr;
}
else
break;
}
else
break;
}
if (i == 0)
goto Lerr;
static if (Target.min < 0)
{
if (sign == -1)
{
v = -v;
}
}
return v;
}
Loverflow:
throw new ConvOverflowException("Overflow in integral conversion");
Lerr:
convError!(Source, Target)(s);
assert(0);
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
string s = "123";
auto a = parse!int(s);
}
unittest
{
foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("conv.to!%.*s.unittest\n", Int.stringof.length, Int.stringof.ptr);
{
assert(to!Int("0") == 0);
static if (isSigned!Int)
{
assert(to!Int("+0") == 0);
assert(to!Int("-0") == 0);
}
}
static if (Int.sizeof >= byte.sizeof)
{
assert(to!Int("6") == 6);
assert(to!Int("23") == 23);
assert(to!Int("68") == 68);
assert(to!Int("127") == 0x7F);
static if (isUnsigned!Int)
{
assert(to!Int("255") == 0xFF);
}
static if (isSigned!Int)
{
assert(to!Int("+6") == 6);
assert(to!Int("+23") == 23);
assert(to!Int("+68") == 68);
assert(to!Int("+127") == 0x7F);
assert(to!Int("-6") == -6);
assert(to!Int("-23") == -23);
assert(to!Int("-68") == -68);
assert(to!Int("-128") == -128);
}
}
static if (Int.sizeof >= short.sizeof)
{
assert(to!Int("468") == 468);
assert(to!Int("32767") == 0x7FFF);
static if (isUnsigned!Int)
{
assert(to!Int("65535") == 0xFFFF);
}
static if (isSigned!Int)
{
assert(to!Int("+468") == 468);
assert(to!Int("+32767") == 0x7FFF);
assert(to!Int("-468") == -468);
assert(to!Int("-32768") == -32768);
}
}
static if (Int.sizeof >= int.sizeof)
{
assert(to!Int("2147483647") == 0x7FFFFFFF);
static if (isUnsigned!Int)
{
assert(to!Int("4294967295") == 0xFFFFFFFF);
}
static if (isSigned!Int)
{
assert(to!Int("+2147483647") == 0x7FFFFFFF);
assert(to!Int("-2147483648") == -2147483648);
}
}
static if (Int.sizeof >= long.sizeof)
{
assert(to!Int("9223372036854775807") == 0x7FFFFFFFFFFFFFFF);
static if (isUnsigned!Int)
{
assert(to!Int("18446744073709551615") == 0xFFFFFFFFFFFFFFFF);
}
static if (isSigned!Int)
{
assert(to!Int("+9223372036854775807") == 0x7FFFFFFFFFFFFFFF);
assert(to!Int("-9223372036854775808") == 0x8000000000000000);
}
}
}
}
unittest
{
// parsing error check
foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("conv.to!%.*s.unittest (error)\n", Int.stringof.length, Int.stringof.ptr);
{
immutable string[] errors1 =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"xx",
"123h",
];
foreach (j, s; errors1)
assertThrown!ConvException(to!Int(s));
}
// parse!SomeUnsigned cannot parse head sign.
static if (isUnsigned!Int)
{
immutable string[] errors2 =
[
"+5",
"-78",
];
foreach (j, s; errors2)
assertThrown!ConvException(to!Int(s));
}
}
// positive overflow check
foreach (i, Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("conv.to!%.*s.unittest (pos overflow)\n", Int.stringof.length, Int.stringof.ptr);
immutable string[] errors =
[
"128", // > byte.max
"256", // > ubyte.max
"32768", // > short.max
"65536", // > ushort.max
"2147483648", // > int.max
"4294967296", // > uint.max
"9223372036854775808", // > long.max
"18446744073709551616", // > ulong.max
];
foreach (j, s; errors[i..$])
assertThrown!ConvOverflowException(to!Int(s));
}
// negative overflow check
foreach (i, Int; TypeTuple!(byte, short, int, long))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("conv.to!%.*s.unittest (neg overflow)\n", Int.stringof.length, Int.stringof.ptr);
immutable string[] errors =
[
"-129", // < byte.min
"-32769", // < short.min
"-2147483649", // < int.min
"-9223372036854775809", // < long.min
];
foreach (j, s; errors[i..$])
assertThrown!ConvOverflowException(to!Int(s));
}
}
/// ditto
Target parse(Target, Source)(ref Source s, uint radix)
if (isSomeChar!(ElementType!Source) &&
isIntegral!Target)
in
{
assert(radix >= 2 && radix <= 36);
}
body
{
if (radix == 10)
return parse!Target(s);
immutable uint beyond = (radix < 10 ? '0' : 'a'-10) + radix;
Target v = 0;
size_t i = 0;
for (; !s.empty; s.popFront(), ++i)
{
uint c = s.front;
if (c < '0')
break;
if (radix < 10)
{
if (c >= beyond)
break;
}
else
{
if (c > '9')
{
c |= 0x20;//poorman's tolower
if (c < 'a' || c >= beyond)
break;
c -= 'a'-10-'0';
}
}
auto blah = cast(Target) (v * radix + c - '0');
if (blah < v)
goto Loverflow;
v = blah;
}
if (!i)
goto Lerr;
return v;
Loverflow:
throw new ConvOverflowException("Overflow in integral conversion");
Lerr:
convError!(Source, Target)(s, radix);
assert(0);
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
// @@@BUG@@@ the size of China
// foreach (i; 2..37)
// {
// assert(parse!int("0",i) == 0);
// assert(parse!int("1",i) == 1);
// assert(parse!byte("10",i) == i);
// }
foreach (i; 2..37)
{
string s = "0";
assert(parse!int(s,i) == 0);
s = "1";
assert(parse!int(s,i) == 1);
s = "10";
assert(parse!byte(s,i) == i);
}
// Same @@@BUG@@@ as above
//assert(parse!int("0011001101101", 2) == 0b0011001101101);
// assert(parse!int("765",8) == 0765);
// assert(parse!int("fCDe",16) == 0xfcde);
auto s = "0011001101101";
assert(parse!int(s, 2) == 0b0011001101101);
s = "765";
assert(parse!int(s, 8) == octal!765);
s = "fCDe";
assert(parse!int(s, 16) == 0xfcde);
// 6609
s = "-42";
assert(parse!int(s, 10) == -42);
}
unittest // bugzilla 7302
{
auto r = cycle("2A!");
auto u = parse!uint(r, 16);
assert(u == 42);
assert(r.front == '!');
}
Target parse(Target, Source)(ref Source s)
if (isSomeString!Source &&
is(Target == enum))
{
Target result;
size_t longest_match = 0;
foreach (i, e; EnumMembers!Target)
{
auto ident = __traits(allMembers, Target)[i];
if (longest_match < ident.length && s.startsWith(ident))
{
result = e;
longest_match = ident.length ;
}
}
if( longest_match > 0 )
{
s = s[longest_match..$];
return result ;
}
throw new ConvException(
Target.stringof ~ " does not have a member named '"
~ to!string(s) ~ "'");
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
enum EB : bool { a = true, b = false, c = a }
enum EU { a, b, c }
enum EI { a = -1, b = 0, c = 1 }
enum EF : real { a = 1.414, b = 1.732, c = 2.236 }
enum EC : char { a = 'a', b = 'b', c = 'c' }
enum ES : string { a = "aaa", b = "bbb", c = "ccc" }
foreach (E; TypeTuple!(EB, EU, EI, EF, EC, ES))
{
assert(to!E("a"c) == E.a);
assert(to!E("b"w) == E.b);
assert(to!E("c"d) == E.c);
assertThrown!ConvException(to!E("d"));
}
}
unittest // bugzilla 4744
{
enum A { member1, member11, member111 }
assert(to!A("member1" ) == A.member1 );
assert(to!A("member11" ) == A.member11 );
assert(to!A("member111") == A.member111);
auto s = "member1111";
assert(parse!A(s) == A.member111 && s == "1");
}
Target parse(Target, Source)(ref Source p)
if (isInputRange!Source && isSomeChar!(ElementType!Source) &&
isFloatingPoint!Target)
{
static immutable real negtab[14] =
[ 1e-4096L,1e-2048L,1e-1024L,1e-512L,1e-256L,1e-128L,1e-64L,1e-32L,
1e-16L,1e-8L,1e-4L,1e-2L,1e-1L,1.0L ];
static immutable real postab[13] =
[ 1e+4096L,1e+2048L,1e+1024L,1e+512L,1e+256L,1e+128L,1e+64L,1e+32L,
1e+16L,1e+8L,1e+4L,1e+2L,1e+1L ];
// static immutable string infinity = "infinity";
// static immutable string nans = "nans";
ConvException bailOut(string msg = null, string fn = __FILE__, size_t ln = __LINE__)
{
if (!msg)
msg = "Floating point conversion error";
return new ConvException(text(msg, " for input \"", p, "\"."), fn, ln);
}
for (;;)
{
enforce(!p.empty, bailOut());
if (!std.uni.isWhite(p.front))
break;
p.popFront();
}
char sign = 0; /* indicating + */
switch (p.front)
{
case '-':
sign++;
p.popFront();
enforce(!p.empty, bailOut());
if (std.ascii.toLower(p.front) == 'i')
goto case 'i';
enforce(!p.empty, bailOut());
break;
case '+':
p.popFront();
enforce(!p.empty, bailOut());
break;
case 'i': case 'I':
p.popFront();
enforce(!p.empty, bailOut());
if (std.ascii.toLower(p.front) == 'n' &&
(p.popFront(), enforce(!p.empty, bailOut()), std.ascii.toLower(p.front) == 'f'))
{
// 'inf'
p.popFront();
return sign ? -Target.infinity : Target.infinity;
}
goto default;
default: {}
}
bool isHex = false;
bool startsWithZero = p.front == '0';
if(startsWithZero)
{
p.popFront();
if(p.empty)
{
return (sign) ? -0.0 : 0.0;
}
isHex = p.front == 'x' || p.front == 'X';
}
real ldval = 0.0;
char dot = 0; /* if decimal point has been seen */
int exp = 0;
long msdec = 0, lsdec = 0;
ulong msscale = 1;
if (isHex)
{
int guard = 0;
int anydigits = 0;
uint ndigits = 0;
p.popFront();
while (!p.empty)
{
int i = p.front;
while (isHexDigit(i))
{
anydigits = 1;
i = std.ascii.isAlpha(i) ? ((i & ~0x20) - ('A' - 10)) : i - '0';
if (ndigits < 16)
{
msdec = msdec * 16 + i;
if (msdec)
ndigits++;
}
else if (ndigits == 16)
{
while (msdec >= 0)
{
exp--;
msdec <<= 1;
i <<= 1;
if (i & 0x10)
msdec |= 1;
}
guard = i << 4;
ndigits++;
exp += 4;
}
else
{
guard |= i;
exp += 4;
}
exp -= dot;
p.popFront();
if (p.empty)
break;
i = p.front;
if (i == '_')
{
p.popFront();
if (p.empty)
break;
i = p.front;
}
}
if (i == '.' && !dot)
{ p.popFront();
dot = 4;
}
else
break;
}
// Round up if (guard && (sticky || odd))
if (guard & 0x80 && (guard & 0x7F || msdec & 1))
{
msdec++;
if (msdec == 0) // overflow
{ msdec = 0x8000000000000000L;
exp++;
}
}
enforce(anydigits, bailOut());
enforce(!p.empty && (p.front == 'p' || p.front == 'P'),
bailOut("Floating point parsing: exponent is required"));
char sexp;
int e;
sexp = 0;
p.popFront();
if (!p.empty)
{
switch (p.front)
{ case '-': sexp++;
goto case;
case '+': p.popFront(); enforce(!p.empty,
new ConvException("Error converting input"
" to floating point"));
break;
default: {}
}
}
ndigits = 0;
e = 0;
while (!p.empty && isDigit(p.front))
{
if (e < 0x7FFFFFFF / 10 - 10) // prevent integer overflow
{
e = e * 10 + p.front - '0';
}
p.popFront();
ndigits = 1;
}
exp += (sexp) ? -e : e;
enforce(ndigits, new ConvException("Error converting input"
" to floating point"));
if (msdec)
{
int e2 = 0x3FFF + 63;
// left justify mantissa
while (msdec >= 0)
{ msdec <<= 1;
e2--;
}
// Stuff mantissa directly into real
*cast(long *)&ldval = msdec;
(cast(ushort *)&ldval)[4] = cast(ushort) e2;
// Exponent is power of 2, not power of 10
ldval = ldexpl(ldval,exp);
}
goto L6;
}
else // not hex
{
if (std.ascii.toUpper(p.front) == 'N' && !startsWithZero)
{
// nan
enforce((p.popFront(), !p.empty && std.ascii.toUpper(p.front) == 'A')
&& (p.popFront(), !p.empty && std.ascii.toUpper(p.front) == 'N'),
new ConvException("error converting input to floating point"));
// skip past the last 'n'
p.popFront();
return typeof(return).nan;
}
bool sawDigits = startsWithZero;
while (!p.empty)
{
int i = p.front;
while (isDigit(i))
{
sawDigits = true; /* must have at least 1 digit */
if (msdec < (0x7FFFFFFFFFFFL-10)/10)
msdec = msdec * 10 + (i - '0');
else if (msscale < (0xFFFFFFFF-10)/10)
{ lsdec = lsdec * 10 + (i - '0');
msscale *= 10;
}
else
{
exp++;
}
exp -= dot;
p.popFront();
if (p.empty)
break;
i = p.front;
if (i == '_')
{
p.popFront();
if (p.empty)
break;
i = p.front;
}
}
if (i == '.' && !dot)
{
p.popFront();
dot++;
}
else
{
break;
}
}
enforce(sawDigits, new ConvException("no digits seen"));
}
if (!p.empty && (p.front == 'e' || p.front == 'E'))
{
char sexp;
int e;
sexp = 0;
p.popFront();
enforce(!p.empty, new ConvException("Unexpected end of input"));
switch (p.front)
{ case '-': sexp++;
goto case;
case '+': p.popFront();
break;
default: {}
}
bool sawDigits = 0;
e = 0;
while (!p.empty && isDigit(p.front))
{
if (e < 0x7FFFFFFF / 10 - 10) // prevent integer overflow
{
e = e * 10 + p.front - '0';
}
p.popFront();
sawDigits = 1;
}
exp += (sexp) ? -e : e;
enforce(sawDigits, new ConvException("No digits seen."));
}
ldval = msdec;
if (msscale != 1) /* if stuff was accumulated in lsdec */
ldval = ldval * msscale + lsdec;
if (ldval)
{
uint u = 0;
int pow = 4096;
while (exp > 0)
{
while (exp >= pow)
{
ldval *= postab[u];
exp -= pow;
}
pow >>= 1;
u++;
}
while (exp < 0)
{
while (exp <= -pow)
{
ldval *= negtab[u];
enforce(ldval != 0, new ConvException("Range error"));
exp += pow;
}
pow >>= 1;
u++;
}
}
L6: // if overflow occurred
enforce(ldval != core.stdc.math.HUGE_VAL, new ConvException("Range error"));
L1:
return (sign) ? -ldval : ldval;
}
unittest
{
// Compare reals with given precision
bool feq(in real rx, in real ry, in real precision = 0.000001L)
{
if (rx == ry)
return 1;
if (isnan(rx))
return cast(bool)isnan(ry);
if (isnan(ry))
return 0;
return cast(bool)(fabs(rx - ry) <= precision);
}
// Make given typed literal
F Literal(F)(F f)
{
return f;
}
foreach (Float; TypeTuple!(float, double, real))
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("conv.to!%.*s.unittest\n", Float.stringof.length, Float.stringof.ptr);
assert(to!Float("123") == Literal!Float(123));
assert(to!Float("+123") == Literal!Float(+123));
assert(to!Float("-123") == Literal!Float(-123));
assert(to!Float("123e2") == Literal!Float(123e2));
assert(to!Float("123e+2") == Literal!Float(123e+2));
assert(to!Float("123e-2") == Literal!Float(123e-2));
assert(to!Float("123.") == Literal!Float(123.));
assert(to!Float(".456") == Literal!Float(.456));
assert(to!Float("1.23456E+2") == Literal!Float(1.23456E+2));
assert(to!Float("0") is 0.0);
assert(to!Float("-0") is -0.0);
assert(isnan(to!Float("nan")));
assertThrown!ConvException(to!Float("\x00"));
}
// min and max
float f = to!float("1.17549e-38");
assert(feq(cast(real)f, cast(real)1.17549e-38));
assert(feq(cast(real)f, cast(real)float.min_normal));
f = to!float("3.40282e+38");
assert(to!string(f) == to!string(3.40282e+38));
// min and max
double d = to!double("2.22508e-308");
assert(feq(cast(real)d, cast(real)2.22508e-308));
assert(feq(cast(real)d, cast(real)double.min_normal));
d = to!double("1.79769e+308");
assert(to!string(d) == to!string(1.79769e+308));
assert(to!string(d) == to!string(double.max));
assert(to!string(to!real(to!string(real.max / 2L))) == to!string(real.max / 2L));
// min and max
real r = to!real(to!string(real.min_normal));
assert(to!string(r) == to!string(real.min_normal));
r = to!real(to!string(real.max));
assert(to!string(r) == to!string(real.max));
}
unittest
{
import core.stdc.errno;
import core.stdc.stdlib;
errno = 0; // In case it was set by another unittest in a different module.
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
struct longdouble
{
ushort value[5];
}
real ld;
longdouble x;
real ld1;
longdouble x1;
int i;
string s = "0x1.FFFFFFFFFFFFFFFEp-16382";
ld = parse!real(s);
assert(s.empty);
x = *cast(longdouble *)&ld;
ld1 = strtold("0x1.FFFFFFFFFFFFFFFEp-16382", null);
x1 = *cast(longdouble *)&ld1;
assert(x1 == x && ld1 == ld);
// for (i = 4; i >= 0; i--)
// {
// printf("%04x ", x.value[i]);
// }
// printf("\n");
assert(!errno);
s = "1.0e5";
ld = parse!real(s);
assert(s.empty);
x = *cast(longdouble *)&ld;
ld1 = strtold("1.0e5", null);
x1 = *cast(longdouble *)&ld1;
// for (i = 4; i >= 0; i--)
// {
// printf("%04x ", x.value[i]);
// }
// printf("\n");
}
// Unittest for bug 4959
unittest
{
auto s = "0 ";
auto x = parse!double(s);
assert(s == " ");
assert(x == 0.0);
}
// Unittest for bug 3369
unittest
{
assert(to!float("inf") == float.infinity);
assert(to!float("-inf") == -float.infinity);
}
// Unittest for bug 6160
unittest
{
assert(1000_000_000e50L == to!real("1000_000_000_e50")); // 1e59
assert(0x1000_000_000_p10 == to!real("0x1000_000_000_p10")); // 7.03687e+13
}
// Unittest for bug 6258
unittest
{
assertThrown!ConvException(to!real("-"));
assertThrown!ConvException(to!real("in"));
}
// Unittest for bug 7055
unittest
{
assertThrown!ConvException(to!float("INF2"));
}
/**
Parsing one character off a string returns the character and bumps the
string up one position.
*/
Target parse(Target, Source)(ref Source s)
if (isSomeString!Source &&
staticIndexOf!(Unqual!Target, dchar, Unqual!(ElementEncodingType!Source)) >= 0)
{
static if (is(Unqual!Target == dchar))
{
Target result = s.front;
s.popFront();
return result;
}
else
{
// Special case: okay so parse a Char off a Char[]
Target result = s[0];
s = s[1 .. $];
return result;
}
}
unittest
{
foreach (Str; TypeTuple!(string, wstring, dstring))
{
foreach (Char; TypeTuple!(char, wchar, dchar))
{
static if (is(Unqual!Char == dchar) ||
Char.sizeof == ElementEncodingType!Str.sizeof)
{
Str s = "aaa";
assert(parse!Char(s) == 'a');
assert(s == "aa");
}
}
}
}
Target parse(Target, Source)(ref Source s)
if (!isSomeString!Source && isInputRange!Source && isSomeChar!(ElementType!Source) &&
isSomeChar!Target && Target.sizeof >= ElementType!Source.sizeof)
{
Target result = s.front;
s.popFront();
return result;
}
// string to bool conversions
Target parse(Target, Source)(ref Source s)
if (isSomeString!Source &&
is(Unqual!Target == bool))
{
if (s.length >= 4 && icmp(s[0 .. 4], "true")==0)
{
s = s[4 .. $];
return true;
}
if (s.length >= 5 && icmp(s[0 .. 5], "false")==0)
{
s = s[5 .. $];
return false;
}
parseError("bool should be case-insensive 'true' or 'false'");
assert(0);
}
/*
Tests for to!bool and parse!bool
*/
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
debug(conv) printf("conv.to!bool.unittest\n");
assert (to!bool("TruE") == true);
assert (to!bool("faLse"d) == false);
assertThrown!ConvException(to!bool("maybe"));
auto t = "TrueType";
assert (parse!bool(t) == true);
assert (t == "Type");
auto f = "False killer whale"d;
assert (parse!bool(f) == false);
assert (f == " killer whale"d);
auto m = "maybe";
assertThrown!ConvException(parse!bool(m));
assert (m == "maybe"); // m shouldn't change on failure
auto s = "true";
auto b = parse!(const(bool))(s);
assert(b == true);
}
// string to null literal conversions
Target parse(Target, Source)(ref Source s)
if (isSomeString!Source &&
is(Unqual!Target == typeof(null)))
{
if (s.length >= 4 && icmp(s[0 .. 4], "null")==0)
{
s = s[4 .. $];
return null;
}
parseError("null should be case-insensive 'null'");
assert(0);
}
unittest
{
alias typeof(null) NullType;
auto s1 = "null";
assert(parse!NullType(s1) is null);
assert(s1 == "");
auto s2 = "NUll"d;
assert(parse!NullType(s2) is null);
assert(s2 == "");
auto m = "maybe";
assertThrown!ConvException(parse!NullType(m));
assert(m == "maybe"); // m shouldn't change on failure
auto s = "NULL";
assert(parse!(const(NullType))(s) is null);
}
private void skipWS(R)(ref R r)
{
skipAll(r, ' ', '\n', '\t', '\r');
}
/**
* Parses an array from a string given the left bracket (default $(D
* '[')), right bracket (default $(D ']')), and element seprator (by
* default $(D ',')).
*/
Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar comma = ',')
if (isSomeString!Source &&
isDynamicArray!Target)
{
Target result;
parseCheck!s(lbracket);
skipWS(s);
if (s.front == rbracket)
{
s.popFront();
return result;
}
for (;; s.popFront(), skipWS(s))
{
result ~= parseElement!(ElementType!Target)(s);
skipWS(s);
if (s.front != comma)
break;
}
parseCheck!s(rbracket);
return result;
}
unittest
{
int[] a = [1, 2, 3, 4, 5];
auto s = to!string(a);
assert(to!(int[])(s) == a);
}
unittest
{
int[][] a = [ [1, 2] , [3], [4, 5] ];
auto s = to!string(a);
assert(to!(int[][])(s) == a);
}
unittest
{
int[][][] ia = [ [[1,2],[3,4],[5]] , [[6],[],[7,8,9]] , [[]] ];
char[] s = to!(char[])(ia);
int[][][] ia2;
ia2 = to!(typeof(ia2))(s);
assert( ia == ia2);
}
unittest
{
auto s1 = `[['h', 'e', 'l', 'l', 'o'], "world"]`;
auto a1 = parse!(string[])(s1);
assert(a1 == ["hello", "world"]);
auto s2 = `["aaa", "bbb", "ccc"]`;
auto a2 = parse!(string[])(s2);
assert(a2 == ["aaa", "bbb", "ccc"]);
}
/// ditto
Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar comma = ',')
if (isSomeString!Source &&
isStaticArray!Target)
{
Target result = void;
parseCheck!s(lbracket);
skipWS(s);
if (s.front == rbracket)
{
static if (result.length != 0)
goto Lmanyerr;
else
{
s.popFront();
return result;
}
}
for (size_t i = 0; ; s.popFront(), skipWS(s))
{
if (i == result.length)
goto Lmanyerr;
result[i++] = parseElement!(ElementType!Target)(s);
skipWS(s);
if (s.front != comma)
{
if (i != result.length)
goto Lfewerr;
break;
}
}
parseCheck!s(rbracket);
return result;
Lmanyerr:
parseError(text("Too many elements in input, ", result.length, " elements expected."));
assert(0);
Lfewerr:
parseError(text("Too few elements in input, ", result.length, " elements expected."));
assert(0);
}
unittest
{
auto s1 = "[1,2,3,4]";
auto sa1 = parse!(int[4])(s1);
assert(sa1 == [1,2,3,4]);
auto s2 = "[[1],[2,3],[4]]";
auto sa2 = parse!(int[][3])(s2);
assert(sa2 == [[1],[2,3],[4]]);
auto s3 = "[1,2,3]";
assertThrown!ConvException(parse!(int[4])(s3));
auto s4 = "[1,2,3,4,5]";
assertThrown!ConvException(parse!(int[4])(s4));
}
/**
* Parses an associative array from a string given the left bracket (default $(D
* '[')), right bracket (default $(D ']')), key-value separator (default $(D
* ':')), and element seprator (by default $(D ',')).
*/
Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar keyval = ':', dchar comma = ',')
if (isSomeString!Source &&
isAssociativeArray!Target)
{
alias typeof(Target.keys[0]) KeyType;
alias typeof(Target.values[0]) ValueType;
Target result;
parseCheck!s(lbracket);
skipWS(s);
if (s.front == rbracket)
{
s.popFront();
return result;
}
for (;; s.popFront(), skipWS(s))
{
auto key = parseElement!KeyType(s);
skipWS(s);
parseCheck!s(keyval);
skipWS(s);
auto val = parseElement!ValueType(s);
skipWS(s);
result[key] = val;
if (s.front != comma) break;
}
parseCheck!s(rbracket);
return result;
}
unittest
{
auto s1 = "[1:10, 2:20, 3:30]";
auto aa1 = parse!(int[int])(s1);
assert(aa1 == [1:10, 2:20, 3:30]);
auto s2 = `["aaa":10, "bbb":20, "ccc":30]`;
auto aa2 = parse!(int[string])(s2);
assert(aa2 == ["aaa":10, "bbb":20, "ccc":30]);
auto s3 = `["aaa":[1], "bbb":[2,3], "ccc":[4,5,6]]`;
auto aa3 = parse!(int[][string])(s3);
assert(aa3 == ["aaa":[1], "bbb":[2,3], "ccc":[4,5,6]]);
}
private dchar parseEscape(Source)(ref Source s)
if (isInputRange!Source && isSomeChar!(ElementType!Source))
{
parseCheck!s('\\');
dchar getHexDigit()
{
s.popFront();
if (s.empty)
parseError("Unterminated escape sequence");
dchar c = s.front;
if (!isHexDigit(c))
parseError("Hex digit is missing");
return std.ascii.isAlpha(c) ? ((c & ~0x20) - ('A' - 10)) : c - '0';
}
dchar result;
switch (s.front)
{
case 'a': result = '\a'; break;
case 'b': result = '\b'; break;
case 'f': result = '\f'; break;
case 'n': result = '\n'; break;
case 'r': result = '\r'; break;
case 't': result = '\t'; break;
case 'v': result = '\v'; break;
case 'x':
result = getHexDigit() << 4;
result |= getHexDigit();
break;
case 'u':
result = getHexDigit() << 12;
result |= getHexDigit() << 8;
result |= getHexDigit() << 4;
result |= getHexDigit();
break;
case 'U':
result = getHexDigit() << 28;
result |= getHexDigit() << 24;
result |= getHexDigit() << 20;
result |= getHexDigit() << 16;
result |= getHexDigit() << 12;
result |= getHexDigit() << 8;
result |= getHexDigit() << 4;
result |= getHexDigit();
break;
default:
parseError("Unknown escape character " ~ to!string(s.front));
break;
}
s.popFront();
return result;
}
// Undocumented
Target parseElement(Target, Source)(ref Source s)
if (isInputRange!Source && isSomeChar!(ElementType!Source) &&
isSomeString!Target)
{
auto result = appender!Target();
// parse array of chars
if (s.front == '[')
return parse!Target(s);
parseCheck!s('\"');
if (s.front == '\"')
{
s.popFront();
return result.data;
}
while (true)
{
if (s.empty)
parseError("Unterminated quoted string");
switch (s.front)
{
case '\"':
s.popFront();
return result.data;
case '\\':
result.put(parseEscape(s));
break;
default:
result.put(s.front());
s.popFront();
break;
}
}
assert(0);
}
// ditto
Target parseElement(Target, Source)(ref Source s)
if (isInputRange!Source && isSomeChar!(ElementType!Source) &&
isSomeChar!Target)
{
Target c;
parseCheck!s('\'');
if (s.front != '\\')
{
c = s.front;
s.popFront();
}
else
c = parseEscape(s);
parseCheck!s('\'');
return c;
}
// ditto
Target parseElement(Target, Source)(ref Source s)
if (isInputRange!Source && isSomeChar!(ElementType!Source) &&
!isSomeString!Target && !isSomeChar!Target)
{
return parse!Target(s);
}
/***************************************************************
Convenience functions for converting any number and types of
arguments into _text (the three character widths).
Example:
----
assert(text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz");
assert(wtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"w);
assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d);
----
*/
string text(T...)(T args)
{
return textImpl!string(args);
}
///ditto
wstring wtext(T...)(T args)
{
return textImpl!wstring(args);
}
///ditto
dstring dtext(T...)(T args)
{
return textImpl!dstring(args);
}
private S textImpl(S, U...)(U args)
{
S result;
foreach (i, arg; args)
{
result ~= to!S(args[i]);
}
return result;
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
assert(text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz");
assert(wtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"w);
assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d);
}
/***************************************************************
The $(D octal) facility is intended as an experimental facility to
replace _octal literals starting with $(D '0'), which many find
confusing. Using $(D octal!177) or $(D octal!"177") instead of $(D
0177) as an _octal literal makes code clearer and the intent more
visible. If use of this facility becomes preponderent, a future
version of the language may deem old-style _octal literals deprecated.
The rules for strings are the usual for literals: If it can fit in an
$(D int), it is an $(D int). Otherwise, it is a $(D long). But, if the
user specifically asks for a $(D long) with the $(D L) suffix, always
give the $(D long). Give an unsigned iff it is asked for with the $(D
U) or $(D u) suffix. _Octals created from integers preserve the type
of the passed-in integral.
Example:
----
// same as 0177
auto x = octal!177;
// octal is a compile-time device
enum y = octal!160;
// Create an unsigned octal
auto z = octal!"1_000_000u";
----
*/
@property int octal(string num)()
if((octalFitsInInt!(num) && !literalIsLong!(num)) && !literalIsUnsigned!(num))
{
return octal!(int, num);
}
/// Ditto
@property long octal(string num)()
if((!octalFitsInInt!(num) || literalIsLong!(num)) && !literalIsUnsigned!(num))
{
return octal!(long, num);
}
/// Ditto
@property uint octal(string num)()
if((octalFitsInInt!(num) && !literalIsLong!(num)) && literalIsUnsigned!(num))
{
return octal!(int, num);
}
/// Ditto
@property ulong octal(string num)()
if((!octalFitsInInt!(num) || literalIsLong!(num)) && literalIsUnsigned!(num))
{
return octal!(long, num);
}
/// Ditto
template octal(alias s)
if (isIntegral!(typeof(s)))
{
enum auto octal = octal!(typeof(s), toStringNow!(s));
}
/*
Takes a string, num, which is an octal literal, and returns its
value, in the type T specified.
So:
int a = octal!(int, "10");
assert(a == 8);
*/
@property T octal(T, string num)()
if (isOctalLiteral!num)
{
ulong pow = 1;
T value = 0;
for (int pos = num.length - 1; pos >= 0; pos--)
{
char s = num[pos];
if (s < '0' || s > '7') // we only care about digits; skip the rest
// safe to skip - this is checked out in the assert so these
// are just suffixes
continue;
value += pow * (s - '0');
pow *= 8;
}
return value;
}
/*
Take a look at int.max and int.max+1 in octal and the logic for this
function follows directly.
*/
template octalFitsInInt(string octalNum)
{
// note it is important to strip the literal of all
// non-numbers. kill the suffix and underscores lest they mess up
// the number of digits here that we depend on.
enum bool octalFitsInInt = strippedOctalLiteral(octalNum).length < 11 ||
strippedOctalLiteral(octalNum).length == 11 &&
strippedOctalLiteral(octalNum)[0] == '1';
}
string strippedOctalLiteral(string original)
{
string stripped = "";
foreach (c; original)
if (c >= '0' && c <= '7')
stripped ~= c;
return stripped;
}
template literalIsLong(string num)
{
static if (num.length > 1)
// can be xxL or xxLu according to spec
enum literalIsLong = (num[$-1] == 'L' || num[$-2] == 'L');
else
enum literalIsLong = false;
}
template literalIsUnsigned(string num)
{
static if (num.length > 1)
// can be xxU or xxUL according to spec
enum literalIsUnsigned = (num[$-1] == 'u' || num[$-2] == 'u')
// both cases are allowed too
|| (num[$-1] == 'U' || num[$-2] == 'U');
else
enum literalIsUnsigned = false;
}
/*
Returns if the given string is a correctly formatted octal literal.
The format is specified in lex.html. The leading zero is allowed, but
not required.
*/
bool isOctalLiteralString(string num)
{
if (num.length == 0)
return false;
// Must start with a number. To avoid confusion, literals that
// start with a '0' are not allowed
if (num[0] == '0' && num.length > 1)
return false;
if (num[0] < '0' || num[0] > '7')
return false;
foreach (i, c; num)
{
if ((c < '0' || c > '7') && c != '_') // not a legal character
{
if (i < num.length - 2)
return false;
else // gotta check for those suffixes
{
if (c != 'U' && c != 'u' && c != 'L')
return false;
if (i != num.length - 1)
{
// if we're not the last one, the next one must
// also be a suffix to be valid
char c2 = num[$-1];
if (c2 != 'U' && c2 != 'u' && c2 != 'L')
return false; // spam at the end of the string
if (c2 == c)
return false; // repeats are disallowed
}
}
}
}
return true;
}
/*
Returns true if the given compile time string is an octal literal.
*/
template isOctalLiteral(string num)
{
enum bool isOctalLiteral = isOctalLiteralString(num);
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
// ensure that you get the right types, even with embedded underscores
auto w = octal!"100_000_000_000";
static assert(!is(typeof(w) == int));
auto w2 = octal!"1_000_000_000";
static assert(is(typeof(w2) == int));
static assert(octal!"45" == 37);
static assert(octal!"0" == 0);
static assert(octal!"7" == 7);
static assert(octal!"10" == 8);
static assert(octal!"666" == 438);
static assert(octal!45 == 37);
static assert(octal!0 == 0);
static assert(octal!7 == 7);
static assert(octal!10 == 8);
static assert(octal!666 == 438);
static assert(octal!"66_6" == 438);
static assert(octal!2520046213 == 356535435);
static assert(octal!"2520046213" == 356535435);
static assert(octal!17777777777 == int.max);
static assert(!__traits(compiles, octal!823));
static assert(!__traits(compiles, octal!"823"));
static assert(!__traits(compiles, octal!"_823"));
static assert(!__traits(compiles, octal!"spam"));
static assert(!__traits(compiles, octal!"77%"));
int a;
long b;
// biggest value that should fit in an it
static assert(__traits(compiles, a = octal!"17777777777"));
// should not fit in the int
static assert(!__traits(compiles, a = octal!"20000000000"));
// ... but should fit in a long
static assert(__traits(compiles, b = octal!"20000000000"));
static assert(!__traits(compiles, a = octal!"1L"));
// this should pass, but it doesn't, since the int converter
// doesn't pass along its suffix to helper templates
//static assert(!__traits(compiles, a = octal!1L));
static assert(__traits(compiles, b = octal!"1L"));
static assert(__traits(compiles, b = octal!1L));
}
// emplace
/**
Given a pointer $(D chunk) to uninitialized memory (but already typed
as $(D T)), constructs an object of non-$(D class) type $(D T) at that
address.
This function can be $(D @trusted) if the corresponding constructor of
$(D T) is $(D @safe).
Returns: A pointer to the newly constructed object (which is the same
as $(D chunk)).
*/
T* emplace(T)(T* chunk)
if (!is(T == class))
{
auto result = cast(typeof(return)) chunk;
static T i;
memcpy(result, &i, T.sizeof);
return result;
}
///ditto
T* emplace(T)(T* chunk)
if (is(T == class))
{
*chunk = null;
return chunk;
}
/**
Given a pointer $(D chunk) to uninitialized memory (but already typed
as a non-class type $(D T)), constructs an object of type $(D T) at
that address from arguments $(D args).
This function can be $(D @trusted) if the corresponding constructor of
$(D T) is $(D @safe).
Returns: A pointer to the newly constructed object (which is the same
as $(D chunk)).
*/
T* emplace(T, Args...)(T* chunk, Args args)
if (!is(T == struct) && Args.length == 1)
{
*chunk = args[0];
return chunk;
}
// Specialization for struct
T* emplace(T, Args...)(T* chunk, Args args)
if (is(T == struct))
{
auto result = cast(typeof(return)) chunk;
void initialize()
{
static T i;
memcpy(chunk, &i, T.sizeof);
}
static if (is(typeof(result.__ctor(args))))
{
// T defines a genuine constructor accepting args
// Go the classic route: write .init first, then call ctor
initialize();
result.__ctor(args);
}
else static if (is(typeof(T(args))))
{
// Struct without constructor that has one matching field for
// each argument
*result = T(args);
}
else //static if (Args.length == 1 && is(Args[0] : T))
{
static assert(Args.length == 1);
//static assert(0, T.stringof ~ " " ~ Args.stringof);
// initialize();
*result = args[0];
}
return result;
}
/**
Given a raw memory area $(D chunk), constructs an object of $(D class)
type $(D T) at that address. The constructor is passed the arguments
$(D Args). The $(D chunk) must be as least as large as $(D T) needs
and should have an alignment multiple of $(D T)'s alignment. (The size
of a $(D class) instance is obtained by using $(D
__traits(classInstanceSize, T))).
This function can be $(D @trusted) if the corresponding constructor of
$(D T) is $(D @safe).
Returns: A pointer to the newly constructed object.
*/
T emplace(T, Args...)(void[] chunk, Args args) if (is(T == class))
{
enum classSize = __traits(classInstanceSize, T);
enforce(chunk.length >= classSize,
new ConvException("emplace: chunk size too small"));
auto a = cast(size_t) chunk.ptr;
enforce(a % T.alignof == 0, text(a, " vs. ", T.alignof));
auto result = cast(typeof(return)) chunk.ptr;
// Initialize the object in its pre-ctor state
(cast(byte[]) chunk)[0 .. classSize] = typeid(T).init[];
// Call the ctor if any
static if (is(typeof(result.__ctor(args))))
{
// T defines a genuine constructor accepting args
// Go the classic route: write .init first, then call ctor
result.__ctor(args);
}
else
{
static assert(args.length == 0 && !is(typeof(&T.__ctor)),
"Don't know how to initialize an object of type "
~ T.stringof ~ " with arguments " ~ Args.stringof);
}
return result;
}
/**
Given a raw memory area $(D chunk), constructs an object of non-$(D
class) type $(D T) at that address. The constructor is passed the
arguments $(D args), if any. The $(D chunk) must be as least as large
as $(D T) needs and should have an alignment multiple of $(D T)'s
alignment.
This function can be $(D @trusted) if the corresponding constructor of
$(D T) is $(D @safe).
Returns: A pointer to the newly constructed object.
*/
T* emplace(T, Args...)(void[] chunk, Args args)
if (!is(T == class))
{
enforce(chunk.length >= T.sizeof,
new ConvException("emplace: chunk size too small"));
auto a = cast(size_t) chunk.ptr;
enforce(a % T.alignof == 0, text(a, " vs. ", T.alignof));
auto result = cast(typeof(return)) chunk.ptr;
return emplace(result, args);
}
unittest
{
struct S
{
int a, b;
}
auto p = new void[S.sizeof];
S s;
s.a = 42;
s.b = 43;
auto s1 = emplace!S(p, s);
assert(s1.a == 42 && s1.b == 43);
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
int a;
int b = 42;
assert(*emplace!int(&a, b) == 42);
struct S
{
double x = 5, y = 6;
this(int a, int b)
{
assert(x == 5 && y == 6);
x = a;
y = b;
}
}
auto s1 = new void[S.sizeof];
auto s2 = S(42, 43);
assert(*emplace!S(cast(S*) s1.ptr, s2) == s2);
assert(*emplace!S(cast(S*) s1, 44, 45) == S(44, 45));
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
class A
{
int x = 5;
int y = 42;
this(int z)
{
assert(x == 5 && y == 42);
x = y = z;
}
}
void[] buf;
static byte[__traits(classInstanceSize, A)] sbuf;
buf = sbuf[];
auto a = emplace!A(buf, 55);
assert(a.x == 55 && a.y == 55);
// emplace in bigger buffer
buf = new byte[](__traits(classInstanceSize, A) + 10);
a = emplace!A(buf, 55);
assert(a.x == 55 && a.y == 55);
// need ctor args
static assert(!is(typeof(emplace!A(buf))));
}
unittest
{
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
// Check fix for http://d.puremagic.com/issues/show_bug.cgi?id=2971
assert(equal(map!(to!int)(["42", "34", "345"]), [42, 34, 345]));
}
unittest
{
struct Foo
{
uint num;
}
Foo foo;
emplace!Foo(&foo, 2U);
assert(foo.num == 2);
}
unittest
{
interface I {}
class K : I {}
K k = void;
emplace!K(&k);
assert(k is null);
K k2 = new K;
assert(k2 !is null);
emplace!K(&k, k2);
assert(k is k2);
I i = void;
emplace!I(&i);
assert(i is null);
emplace!I(&i, k);
assert(i is k);
}
// Undocumented for the time being
void toTextRange(T, W)(T value, W writer)
if (isIntegral!T && isOutputRange!(W, char))
{
Unqual!(Unsigned!T) v = void;
if (value < 0)
{
put(writer, '-');
v = -value;
}
else
{
v = value;
}
if (v < 10 && v < hexDigits.length)
{
put(writer, hexDigits[cast(size_t) v]);
return;
}
char[v.sizeof * 4] buffer = void;
auto i = buffer.length;
do
{
auto c = cast(ubyte) (v % 10);
v = v / 10;
i--;
buffer[i] = cast(char) (c + '0');
} while (v);
put(writer, buffer[i .. $]);
}
template hardDeprec(string vers, string date, string oldFunc, string newFunc)
{
enum hardDeprec = Format!("Notice: As of Phobos %s, %s has been deprecated. " ~
"It will be removed in %s. Please use %s instead.",
vers, oldFunc, date, newFunc);
}
| D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto nk = readln.split.to!(int[]);
auto N = nk[0];
auto K = nk[1];
writeln((N+1) / 2 >= K ? "YES" : "NO");
} | D |
/Users/tcadmin/Documents/XCode/tests/TestAutoHeight/Build/Intermediates/TestAutoHeight.build/Debug-iphonesimulator/TestAutoHeight.build/Objects-normal/x86_64/AppDelegate.o : /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/ViewController.swift /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/TestAutoHeight-Bridging-Header.h /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/Pods/Headers/Public/LoremIpsum/LoremIpsum.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule
/Users/tcadmin/Documents/XCode/tests/TestAutoHeight/Build/Intermediates/TestAutoHeight.build/Debug-iphonesimulator/TestAutoHeight.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule : /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/ViewController.swift /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/TestAutoHeight-Bridging-Header.h /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/Pods/Headers/Public/LoremIpsum/LoremIpsum.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule
/Users/tcadmin/Documents/XCode/tests/TestAutoHeight/Build/Intermediates/TestAutoHeight.build/Debug-iphonesimulator/TestAutoHeight.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc : /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/ViewController.swift /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/TestAutoHeight/TestAutoHeight-Bridging-Header.h /Users/tcadmin/Documents/XCode/tests/TestAutoHeight/Pods/Headers/Public/LoremIpsum/LoremIpsum.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule
| D |
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
module engine.thirdparty.derelict.opengl.impl;
import engine.thirdparty.derelict.opengl.types;
version(DerelictGL3_Contexts) {
mixin template glContext(GLVersion core = GLVersion.highestSupported, bool loadDep = false)
{
static if(!loadDep) mixin(glImports);
else mixin(gl_depImports);
mixin glDecls!(core, loadDep);
struct GLContext
{
mixin glFuncs!(core, loadDep);
mixin glLoaders!(core, loadDep);
}
}
}
else {
mixin template glFreeFuncs(GLVersion core = GLVersion.highestSupported, bool loadDep = false)
{
static if(!loadDep) mixin(glImports);
else mixin(gl_depImports);
mixin glDecls!(core, loadDep);
mixin glFuncs!(core, loadDep);
mixin glLoaders!(core, loadDep);
}
version(DerelictGL3_CustomFreeFuncs) {}
else mixin glFreeFuncs;
}
enum glImports =
q{
import engine.thirdparty.derelict.opengl.gl,
engine.thirdparty.derelict.opengl.glloader,
engine.thirdparty.derelict.opengl.versions.base,
engine.thirdparty.derelict.opengl.versions.gl2x,
engine.thirdparty.derelict.opengl.versions.gl3x,
engine.thirdparty.derelict.opengl.versions.gl4x;
};
enum gl_depImports =
q{
import engine.thirdparty.derelict.opengl.gl,
engine.thirdparty.derelict.opengl.glloader,
engine.thirdparty.derelict.opengl.versions.base_dep,
engine.thirdparty.derelict.opengl.versions.gl2x_dep,
engine.thirdparty.derelict.opengl.versions.gl3x_dep,
engine.thirdparty.derelict.opengl.versions.gl4x;
};
mixin template glDecls(GLVersion core, bool declDep = false)
{
static if(!declDep) mixin(gl2Decls);
else mixin(gl2_depDecls);
static if(core >= GLVersion.gl30 && !declDep) mixin(gl30Decls);
else static if(core >= GLVersion.gl30) mixin(gl30_depDecls);
static if(core >= GLVersion.gl31) mixin(gl31Decls);
static if(core >= GLVersion.gl32) mixin(gl32Decls);
static if(core >= GLVersion.gl33) mixin(gl33Decls);
static if(core >= GLVersion.gl40) mixin(gl40Decls);
static if(core >= GLVersion.gl41) mixin(gl41Decls);
static if(core >= GLVersion.gl42) mixin(gl42Decls);
static if(core >= GLVersion.gl43) mixin(gl43Decls);
static if(core >= GLVersion.gl44) mixin(gl44Decls);
static if(core >= GLVersion.gl45) mixin(gl45Decls);
}
mixin template glFuncs(GLVersion core, bool loadDep = false)
{
static if(!loadDep) mixin(gl2Funcs);
else mixin(gl2_depFuncs);
static if(core >= GLVersion.gl30) mixin(gl30Funcs);
static if(core >= GLVersion.gl31) mixin(gl31Funcs);
static if(core >= GLVersion.gl32) mixin(gl32Funcs);
static if(core >= GLVersion.gl33) mixin(gl33Funcs);
static if(core >= GLVersion.gl40) mixin(gl40Funcs);
static if(core >= GLVersion.gl41) mixin(gl41Funcs);
static if(core >= GLVersion.gl42) mixin(gl42Funcs);
static if(core >= GLVersion.gl43) mixin(gl43Funcs);
static if(core >= GLVersion.gl44) mixin(gl44Funcs);
static if(core >= GLVersion.gl45) mixin(gl45Funcs);
}
enum glLoaderDecls =
q{
version(DerelictGL3_Contexts) alias theLoader = _loader;
else alias theLoader = DerelictGL3;
GLVersion glVer = theLoader.loadedVersion;
GLVersion maxVer = theLoader.contextVersion;
};
mixin template glLoaders(GLVersion core, bool loadDep = false)
{
version(DerelictGL3_Contexts) {
private GLLoader _loader;
GLLoader loader() { return _loader; }
alias loader this;
GLVersion load()
{
_loader = GLLoader(&loadBaseGL, &loadExtraGL);
_loader.loadBase();
_loader.loadExtra();
return _loader.loadedVersion;
}
}
else {
struct SetLoader {
import std.functional : toDelegate;
import engine.thirdparty.derelict.opengl.glloader;
static this()
{
auto baseDg = toDelegate(&loadBaseGL);
auto extraDg = toDelegate(&loadExtraGL);
DerelictGL3.glLoader = GLLoader(baseDg, extraDg);
}
}
static if(core >= GLVersion.gl30) mixin(corearb30Loader);
static if(core >= GLVersion.gl31) mixin(corearb31Loader);
static if(core >= GLVersion.gl32) mixin(corearb32Loader);
static if(core >= GLVersion.gl33) mixin(corearb33Loader);
static if(core >= GLVersion.gl40) mixin(corearb40Loader);
static if(core >= GLVersion.gl41) mixin(corearb41Loader);
static if(core >= GLVersion.gl42) mixin(corearb42Loader);
static if(core >= GLVersion.gl43) mixin(corearb43Loader);
static if(core >= GLVersion.gl44) mixin(corearb44Loader);
static if(core >= GLVersion.gl45) mixin(corearb45Loader);
}
private GLVersion loadBaseGL()
{
with(DerelictGL3) {
static if(!loadDep) mixin(baseLoader);
else mixin(base_depLoader);
}
return GLVersion.gl11;
}
private GLVersion loadExtraGL()
{
mixin(glLoaderDecls);
with(theLoader) {
static if(!loadDep) mixin(gl2Loader);
else mixin(gl2_depLoader);
static if(core >= GLVersion.gl30) mixin(gl30Loader);
static if(core >= GLVersion.gl31) mixin(gl31Loader);
static if(core >= GLVersion.gl32) mixin(gl32Loader);
static if(core >= GLVersion.gl33) mixin(gl33Loader);
static if(core >= GLVersion.gl40) mixin(gl40Loader);
static if(core >= GLVersion.gl41) mixin(gl41Loader);
static if(core >= GLVersion.gl42) mixin(gl42Loader);
static if(core >= GLVersion.gl43) mixin(gl43Loader);
static if(core >= GLVersion.gl44) mixin(gl44Loader);
static if(core >= GLVersion.gl45) mixin(gl45Loader);
}
static if(is(typeof(loadExtensions()))) loadExtensions();
return glVer;
}
}
| D |
a yellow phospholipid essential for the metabolism of fats
| D |
/Users/lap14205/Documents/home/blockchain_learning/casper/casper-get-started/src/tests/target/debug/deps/libthiserror_impl-1727163b94f0f8a0.dylib: /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/lib.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/ast.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/attr.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/expand.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/fmt.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/generics.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/prop.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/valid.rs
/Users/lap14205/Documents/home/blockchain_learning/casper/casper-get-started/src/tests/target/debug/deps/thiserror_impl-1727163b94f0f8a0.d: /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/lib.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/ast.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/attr.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/expand.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/fmt.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/generics.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/prop.rs /Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/valid.rs
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/lib.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/ast.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/attr.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/expand.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/fmt.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/generics.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/prop.rs:
/Users/lap14205/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-impl-1.0.29/src/valid.rs:
| D |
instance DIA_STRF_1_EXIT(C_INFO)
{
nr = 999;
condition = dia_strf_1_exit_condition;
information = dia_strf_1_exit_info;
permanent = TRUE;
description = DIALOG_ENDE;
};
func int dia_strf_1_exit_condition()
{
return TRUE;
};
func void dia_strf_1_exit_info()
{
AI_StopProcessInfos(self);
};
instance DIA_STRF_1_STANDARD(C_INFO)
{
nr = 2;
condition = dia_strf_1_standard_condition;
information = dia_strf_1_standard_info;
permanent = TRUE;
important = TRUE;
};
func int dia_strf_1_standard_condition()
{
if(Npc_IsInState(self,zs_talk))
{
return TRUE;
};
};
func void dia_strf_1_standard_info()
{
var int randy;
randy = Hlp_Random(3);
if(randy == 0)
{
AI_Output(self,other,"DIA_STRF_1_STANDARD_01_00"); //Если бы мне удалось вырваться отсюда, когда у меня был шанс, мне бы сейчас не пришлось гнуть спину на эту свинью!
};
if(randy == 1)
{
AI_Output(self,other,"DIA_STRF_1_STANDARD_01_01"); //Это все из-за этой руды. Всегда все одно и то же. Всем позарез нужна эта проклятая руда.
};
if(randy == 2)
{
AI_Output(self,other,"DIA_STRF_1_STANDARD_01_02"); //Если бы ты попробовал это дерьмо, которым нас снабжают, ты бы тоже стал подумывать о бунте!
};
AI_StopProcessInfos(self);
};
func void b_assignambientinfos_strf_1(var C_NPC slf)
{
dia_strf_1_exit.npc = Hlp_GetInstanceID(slf);
dia_strf_1_standard.npc = Hlp_GetInstanceID(slf);
};
| D |
///////////////////////////////////////////////////////////////////////
// Info EXIT
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Moe_EXIT (C_INFO)
{
npc = VLK_432_Moe;
nr = 999;
condition = DIA_Moe_EXIT_Condition;
information = DIA_Moe_EXIT_Info;
permanent = TRUE;
description = DIALOG_ENDE;
};
FUNC INT DIA_Moe_EXIT_Condition()
{
return TRUE;
};
FUNC VOID DIA_Moe_EXIT_Info()
{
AI_StopProcessInfos (self);
};
// ************************************************************
// PICK POCKET
// ************************************************************
INSTANCE DIA_Moe_PICKPOCKET (C_INFO)
{
npc = VLK_432_Moe;
nr = 900;
condition = DIA_Moe_PICKPOCKET_Condition;
information = DIA_Moe_PICKPOCKET_Info;
permanent = TRUE;
description = Pickpocket_40;
};
FUNC INT DIA_Moe_PICKPOCKET_Condition()
{
C_Beklauen (25, 30);
};
FUNC VOID DIA_Moe_PICKPOCKET_Info()
{
Info_ClearChoices (DIA_Moe_PICKPOCKET);
Info_AddChoice (DIA_Moe_PICKPOCKET, DIALOG_BACK ,DIA_Moe_PICKPOCKET_BACK);
Info_AddChoice (DIA_Moe_PICKPOCKET, DIALOG_PICKPOCKET ,DIA_Moe_PICKPOCKET_DoIt);
};
func void DIA_Moe_PICKPOCKET_DoIt()
{
B_Beklauen ();
Info_ClearChoices (DIA_Moe_PICKPOCKET);
};
func void DIA_Moe_PICKPOCKET_BACK()
{
Info_ClearChoices (DIA_Moe_PICKPOCKET);
};
// ************************************************************
// Hallo
// ************************************************************
INSTANCE DIA_Moe_Hallo(C_INFO)
{
npc = VLK_432_Moe;
nr = 2;
condition = DIA_Moe_Hallo_Condition;
information = DIA_Moe_Hallo_Info;
permanent = FALSE;
important = TRUE;
};
FUNC INT DIA_Moe_Hallo_Condition()
{
if (Npc_GetDistToNpc(self, other) <= ZivilAnquatschDist)
&& (hero.guild != GIL_PAL)
&& (hero.guild != GIL_KDF)
&& (hero.guild != GIL_MIL)
&& (hero.guild != GIL_NOV)
&& (Npc_RefuseTalk(self) == FALSE)
{
return TRUE;
};
};
FUNC VOID DIA_Moe_Hallo_Info()
{
AI_Output (self ,other,"DIA_Moe_Hallo_01_00"); //Hej, nie znam cię... Czego tutaj szukasz? Może knajpy?
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Nie, nie idę do knajpy... (KONIEC)",DIA_Moe_Hallo_Gehen);
Info_AddChoice (DIA_Moe_Hallo,"Więc to tutaj zbiera się całe towarzystwo...",DIA_Moe_Hallo_Witz);
Info_AddChoice (DIA_Moe_Hallo,"Tak, masz coś przeciwko?",DIA_Moe_Hallo_Reizen);
};
FUNC VOID DIA_Moe_Hallo_Gehen()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Gehen_15_00"); //Nie, nie szukam knajpy...
AI_Output (self ,other,"DIA_Moe_Hallo_Gehen_01_01"); //Tak, też bym tak powiedział. Ale to nie ma znaczenia - i dlatego możemy od razu przejść do interesów.
AI_Output (self ,other,"DIA_Moe_Hallo_Gehen_01_02"); //Ponieważ jesteś tu nowy, mam dla ciebie propozycję. Zapłacisz mi 50 sztuk złota, a ja pozwolę ci wejść.
AI_Output (self ,other,"DIA_Moe_Hallo_Gehen_01_03"); //Tyle kosztuje wejście do knajpy.
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Dowiedzmy się, co na ten temat sądzi straż...",DIA_Moe_Hallo_Miliz);
Info_AddChoice (DIA_Moe_Hallo,"Zapomnij o tym, nie dostaniesz nawet złamanego grosza!",DIA_Moe_Hallo_Vergisses);
Info_AddChoice (DIA_Moe_Hallo,"W porządku, zapłacę.",DIA_Moe_Hallo_Zahlen);
Info_AddChoice (DIA_Moe_Hallo,"Ale ja nie chcę wejść do knajpy!",DIA_Moe_Hallo_Kneipe);
};
FUNC VOID DIA_Moe_Hallo_Kneipe()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Kneipe_15_00"); //Ale ja nie chcę wejść do knajpy!
AI_Output (self ,other,"DIA_Moe_Hallo_Kneipe_01_01"); //Taaak, prędzej czy później każdy chce wejść do knajpy. Więc równie dobrze możesz mi zapłacić już teraz - i potem będziesz miał spokój.
};
FUNC VOID DIA_Moe_Hallo_Witz()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Witz_15_00"); //Ach, więc to tutaj zbiera się całe towarzystwo. Łatwo pomylić to miejsce z pałacem gubernatora...
AI_Output (self ,other,"DIA_Moe_Hallo_Witz_01_01"); //Hej, daruj sobie te kiepskie dowcipy, jeśli nie chcesz zbierać zębów z ulicy.
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Widzę, że nie obędzie się bez bijatyki...",DIA_Moe_Hallo_Pruegel);
Info_AddChoice (DIA_Moe_Hallo,"Za mało masz problemów?",DIA_Moe_Hallo_Aerger);
Info_AddChoice (DIA_Moe_Hallo,"Uspokój się, chcę tylko wypić piwo.",DIA_Moe_Hallo_Ruhig);
Info_AddChoice (DIA_Moe_Hallo,"Ale ja nie chcę wejść do knajpy!",DIA_Moe_Hallo_Kneipe);
};
FUNC VOID DIA_Moe_Hallo_Reizen()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Reizen_15_00"); //Tak, masz coś przeciwko?
AI_Output (self ,other,"DIA_Moe_Hallo_Reizen_01_01"); //Nie masz tu czego szukać, kurduplu.
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Widzę, że nie obędzie się bez bijatyki...",DIA_Moe_Hallo_Pruegel);
Info_AddChoice (DIA_Moe_Hallo,"Za mało masz problemów?",DIA_Moe_Hallo_Aerger);
Info_AddChoice (DIA_Moe_Hallo,"Uspokój się, chcę tylko wypić piwo.",DIA_Moe_Hallo_Ruhig);
};
FUNC VOID DIA_Moe_Hallo_Miliz()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Miliz_15_00"); //Dowiedzmy się, co na ten temat sądzi straż...
AI_Output (self ,other,"DIA_Moe_Hallo_Miliz_01_01"); //Na twoim miejscu nie liczyłbym na straż. Strażnicy tu nie przychodzą.
AI_Output (self ,other,"DIA_Moe_Hallo_Miliz_01_02"); //Jesteśmy w dzielnicy portowej, cwaniaczku. Baliby się tutaj z kimkolwiek zadrzeć.
AI_Output (self ,other,"DIA_Moe_Hallo_Miliz_01_03"); //Strażnicy mogą co najwyżej chodzić do 'Czerwonej Latarni'. A zatem, jak sam widzisz, to sprawa tylko między nami.
};
FUNC VOID DIA_Moe_Hallo_Pruegel()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Pruegel_15_00"); //Rozumiem. Widzę, że nie obejdzie się bez bijatyki.
AI_Output (self ,other,"DIA_Moe_Hallo_Pruegel_01_01"); //Proszę bardzo, spróbuj. Pokaż, co potrafisz!
AI_StopProcessInfos (self);
B_Attack (self, other, AR_NONE,1);
};
FUNC VOID DIA_Moe_Hallo_Aerger()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Aerger_15_00"); //Za mało masz problemów?
AI_Output (self ,other,"DIA_Moe_Hallo_Aerger_01_01"); //Jasne, problemy to moje drugie imię. Broń się, kurduplu!
AI_StopProcessInfos (self);
B_Attack (self, other, AR_NONE,1);
};
FUNC VOID DIA_Moe_Hallo_Ruhig()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Ruhig_15_00"); //Uspokój się, chcę tylko wypić piwo.
AI_Output (self ,other,"DIA_Moe_Hallo_Ruhig_01_01"); //Dobrze, ale żeby wejść do środka, musisz mi zapłacić 50 sztuk złota.
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Zapomnij o tym, nie dostaniesz nawet złamanego grosza!",DIA_Moe_Hallo_Vergisses);
Info_AddChoice (DIA_Moe_Hallo,"W porządku, zapłacę.",DIA_Moe_Hallo_Zahlen);
};
FUNC VOID DIA_Moe_Hallo_Zahlen()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Zahlen_15_00"); //W porządku, zapłacę.
if B_GiveInvItems (other, self, ItMi_Gold,50)
{
AI_Output (self ,other,"DIA_Moe_Hallo_Zahlen_01_01"); //Wspaniale. A skoro już poszło nam tak łatwo, możesz mi teraz oddać resztę swoich pieniędzy.
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Zapomnij o tym, nie dostaniesz nawet złamanego grosza!",DIA_Moe_Hallo_Vergisses);
Info_AddChoice (DIA_Moe_Hallo,"Proszę, to wszystko, co mam.",DIA_Moe_Hallo_Alles);
}
else if (Npc_HasItems (hero, ItMi_Gold) > 9)
{
AI_Output (other ,self,"DIA_Moe_Hallo_Zahlen_15_02"); //...ale nie mam przy sobie tylu pieniędzy.
AI_Output (self ,other,"DIA_Moe_Hallo_Zahlen_01_03"); //To nie ma znaczenia. Po prostu daj mi wszystko, co masz.
Info_ClearChoices (DIA_Moe_Hallo);
Info_AddChoice (DIA_Moe_Hallo,"Zapomnij o tym, nie dostaniesz nawet złamanego grosza!",DIA_Moe_Hallo_Vergisses);
Info_AddChoice (DIA_Moe_Hallo,"Proszę, to wszystko, co mam.",DIA_Moe_Hallo_Alles);
}
else
{
AI_Output (other ,self,"DIA_Moe_Hallo_Zahlen_15_04"); //...ale nie mam nawet 10 sztuk złota.
AI_Output (self ,other,"DIA_Moe_Hallo_Zahlen_01_05"); //Ale trafiłem.
AI_Output (self ,other,"DIA_Moe_Hallo_Zahlen_01_06"); //No dobrze już, dobrze, możesz wejść.
AI_StopProcessInfos (self);
};
};
FUNC VOID DIA_Moe_Hallo_Vergisses()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Vergisses_15_00"); //Zapomnij o tym, nie dostaniesz nawet złamanego grosza!
AI_Output (self ,other,"DIA_Moe_Hallo_Vergisses_01_01"); //Więc zabiorę wszystko, co masz - ale najpierw spuszczę ci porządne lanie.
AI_StopProcessInfos (self);
B_Attack (self, other, AR_NONE,1);
};
FUNC VOID DIA_Moe_Hallo_Alles()
{
AI_Output (other ,self,"DIA_Moe_Hallo_Alles_15_00"); //Proszę, to wszystko, co mam.
B_GiveInvItems (other, self, ItMi_Gold, Npc_HasItems (other,ItMi_Gold));
AI_Output (self ,other,"DIA_Moe_Hallo_Alles_01_01"); //Dobrze, to wystarczy. Chodząca pobłażliwość - oto cały ja.
AI_StopProcessInfos (self);
};
//************************************************
// Das Hafenviertel
//************************************************
INSTANCE DIA_Moe_Harbor(C_INFO)
{
npc = VLK_432_Moe;
nr = 998;
condition = DIA_Moe_Harbor_Condition;
information = DIA_Moe_Harbor_Info;
permanent = TRUE;
description = "Wiesz, co dzieje się w porcie, prawda?";
};
FUNC INT DIA_Moe_Harbor_Condition()
{
return TRUE;
};
FUNC VOID DIA_Moe_Harbor_Info()
{
AI_Output (other,self ,"DIA_Moe_Harbor_15_00"); //Wiesz, co dzieje się w porcie, prawda?
AI_Output (self ,other,"DIA_Moe_Harbor_01_01"); //Pewnie. A dlaczego pytasz?
Info_ClearChoices (DIA_Moe_Harbor);
Info_AddChoice (DIA_Moe_Harbor, DIALOG_BACK, DIA_Moe_Harbor_Back);
Info_AddChoice (DIA_Moe_Harbor,"Dużo tu macie statków?",DIA_Moe_Harbor_Ship);
Info_AddChoice (DIA_Moe_Harbor,"Czemu nie widzę tu żadnej straży?",DIA_Moe_Harbor_Militia);
Info_AddChoice (DIA_Moe_Harbor,"Słyszałeś ostatnio jakieś plotki?",DIA_Moe_Harbor_Rumors);
};
FUNC VOID DIA_Moe_Harbor_Back ()
{
Info_ClearChoices (DIA_Moe_Harbor);
};
FUNC VOID DIA_Moe_Harbor_Ship ()
{
AI_Output (other,self ,"DIA_Moe_Harbor_Ship_15_00"); //Dużo tu macie statków?
AI_Output (self ,other,"DIA_Moe_Harbor_Ship_01_01"); //Jedyny statek w tym mieście należy do paladynów.
AI_Output (self ,other,"DIA_Moe_Harbor_Ship_01_02"); //Jest zacumowany na południowym zachodzie.
};
FUNC VOID DIA_Moe_Harbor_Militia ()
{
AI_Output (other,self ,"DIA_Moe_Harbor_Militia_15_00"); //Czemu nie widzę tu żadnej straży?
AI_Output (self ,other,"DIA_Moe_Harbor_Militia_01_01"); //Straż tutaj nie przychodzi. Sami załatwiamy nasze spory.
};
FUNC VOID DIA_Moe_Harbor_Rumors ()
{
AI_Output (other,self ,"DIA_Moe_Harbor_Rumors_15_00"); //Słyszałeś ostatnio jakieś plotki?
if (Kapitel == 1)
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_01"); //W tych okolicach nie lubimy, kiedy ktoś zadaje zbyt dużo pytań. Szczególnie jeśli jest to ktoś obcy.
}
else if (Kapitel == 2)
{
if (hero.guild == GIL_MIL)
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_02"); //Żadnych. A czego się spodziewałeś? To spokojne miejsce.
}
else if (hero.guild == GIL_KDF)
|| (hero.guild == GIL_PAL)
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_03"); //Nie jest dobrze. Czasy są ciężkie, a my z trudem wiążemy koniec z końcem.
AI_Output (other,self ,"DIA_Moe_Harbor_Rumors_15_04"); //Przestań się ze mnie nabijać.
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_05"); //Jak mogłeś pomyśleć coś takiego? Zraniłeś moje uczucia.
}
else
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_06"); //Jest niewesoło. Od jakiegoś czasu Lord Andre ciągle wsadza nos w nie swoje sprawy.
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_07"); //Taki elegancik nigdy nie zrozumie, co się tutaj dzieje.
};
}
else if (Kapitel == 3)
{
if (Mis_RescueBennet == LOG_SUCCESS)
{
if (hero.guild == GIL_MIL)
|| (hero.guild == GIL_PAL)
|| (hero.guild == GIL_KDF)
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_08"); //Nie mamy z tym nic wspólnego.
AI_Output (other,self ,"DIA_Moe_Harbor_Rumors_15_09"); //To znaczy z czym?
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_10"); //Z tym zamordowanym paladynem. Powinieneś zainteresować się najemnikami, zamiast marnować tutaj swój czas.
}
else
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_11"); //Wiem, że nie miałeś z tym nic wspólnego, ale to morderstwo naprawdę wzbudziło niepokój porządnych obywateli.
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_12"); //Jeśli zechcesz przyjąć przyjacielską radę, najlepiej będzie, jeśli znikniesz z miasta. Przynajmniej na jakiś czas.
};
}
else
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_13"); //Odkąd zostało udowodnione, że najemnicy nie mieli nic wspólnego ze śmiercią tego paladyna, straż boi się tu przychodzić.
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_14"); //Pewnie obawiają się tych paru mieszkających tutaj pijaków, he, he. I dobrze.
};
}
else if (Kapitel == 4)
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_15"); //Nic się tu nie dzieje.
}
else //Kapitel 5
{
AI_Output (self ,other,"DIA_Moe_Harbor_Rumors_01_16"); //Ci nadęci paladyni opuszczają nasz port. Najwyższy czas.
};
};
///////////////////////////////////////////////////////////////////////
// Info LehmarGeldeintreiben
///////////////////////////////////////////////////////////////////////
instance DIA_Moe_LEHMARGELDEINTREIBEN (C_INFO)
{
npc = VLK_432_Moe;
nr = 2;
condition = DIA_Moe_LEHMARGELDEINTREIBEN_Condition;
information = DIA_Moe_LEHMARGELDEINTREIBEN_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Moe_LEHMARGELDEINTREIBEN_Condition ()
{
if ((Lehmar_GeldGeliehen_Day <= (Wld_GetDay()-2))
&& (Lehmar_GeldGeliehen != 0))
&& (RangerHelp_LehmarKohle == FALSE)
&& (Lehmar.aivar[AIV_DefeatedByPlayer] == FALSE)
{
return TRUE;
};
};
func void DIA_Moe_LEHMARGELDEINTREIBEN_Info ()
{
AI_Output (self, other, "DIA_Moe_LEHMARGELDEINTREIBEN_01_00"); //Hej, ty! Pozdrowienia od Lehmara.
AI_StopProcessInfos (self);
B_Attack (self, other, AR_NONE, 1);
};
| D |
module polyplex.core.render.gl.gloo;
public import bindbc.opengl;
private __gshared Buffer[GLenum] boundBuffers;
private __gshared Texture[GLenum] boundTextures;
private __gshared Framebuffer[GLenum] boundFramebuffers;
private __gshared Sampler[GLenum] boundSamplers;
private __gshared Renderbuffer boundRenderbuffer;
private __gshared VertexArray boundVertexArray;
//private __gshared AsyncQuery[GLenum] boundAsyncQueries;
//private __gshared Pipeline[GLenum] boundPipelines;
//private __gshared TransformFeedback[GLenum] boundTransformFeedbacks;
public @nogc:
enum Capability : GLenum {
AlphaTesting = GL_ALPHA_TEST,
AutoNormal = GL_AUTO_NORMAL,
Blending = GL_BLEND,
ColorLogic = GL_COLOR_LOGIC_OP,
ColorMaterial = GL_COLOR_MATERIAL,
ColorSum = GL_COLOR_SUM,
ColorTable = GL_COLOR_TABLE,
Convolution1D = GL_CONVOLUTION_1D,
Convolution2D = GL_CONVOLUTION_2D,
CullFace = GL_CULL_FACE,
DepthTesting = GL_DEPTH_TEST,
Dithering = GL_DITHER,
Fog = GL_FOG,
Histogram = GL_HISTOGRAM,
IndexLogic = GL_INDEX_LOGIC_OP,
Lighting = GL_LIGHTING,
LineSmooth = GL_LINE_SMOOTH,
LineStipple = GL_LINE_STIPPLE,
SampleAreaToCoverage = GL_SAMPLE_ALPHA_TO_COVERAGE,
// TODO: Add a bunch of GL_MAP stuff
MinMax = GL_MINMAX,
Multisample = GL_MULTISAMPLE,
Normalize = GL_NORMALIZE,
PointSmooth = GL_POINT_SMOOTH,
PointSprite = GL_POINT_SPRITE,
PolygonOffsetFill = GL_POLYGON_OFFSET_FILL,
PolygonOffsetLine = GL_POLYGON_OFFSET_LINE,
PolygonOffsetPoint = GL_POLYGON_OFFSET_POINT,
PolygonSmooth = GL_POLYGON_SMOOTH,
PolygonStipple = GL_POLYGON_STIPPLE,
ScissorTest = GL_SCISSOR_TEST,
StencilTest = GL_STENCIL_TEST
}
/**
Functions for OpenGL not attached to an object.
*/
class GL {
public:
enum : GLenum {
// Filters
Nearest = GL_NEAREST,
NearestMipmapNearest = GL_NEAREST_MIPMAP_NEAREST,
NearestMipmapLinear = GL_NEAREST_MIPMAP_LINEAR,
Linear = GL_LINEAR,
LinearMipmapNearest = GL_LINEAR_MIPMAP_NEAREST,
LinearMipmapLinear = GL_LINEAR_MIPMAP_LINEAR,
// Func
Greater = GL_GREATER,
Less = GL_LESS,
// Culling
Front = GL_FRONT,
Back = GL_BACK,
FrontAndBack = GL_FRONT_AND_BACK,
// Swizzle
Red = GL_RED,
Green = GL_GREEN,
Blue = GL_BLUE,
Alpha = GL_ALPHA,
// Wrap
ClampToEdge = GL_CLAMP_TO_EDGE,
ClampToBorder = GL_CLAMP_TO_BORDER,
MirroredRepeat = GL_MIRRORED_REPEAT,
Repeat = GL_REPEAT,
// Draw modes
Points = GL_POINTS,
LineStrip = GL_LINE_STRIP,
LineLoop = GL_LINE_LOOP,
Lines = GL_LINES,
LineStripAdjacency = GL_LINE_STRIP_ADJACENCY,
LinesAdjacency = GL_LINES_ADJACENCY,
TriangleStrip = GL_TRIANGLE_STRIP,
TriangleFan = GL_TRIANGLE_FAN,
Triangles = GL_TRIANGLES,
TriangleStripAdjacency = GL_TRIANGLE_STRIP_ADJACENCY,
TrianglesAdjacency = GL_TRIANGLES_ADJACENCY,
// Blending Operations
SourceColor = GL_SRC_COLOR,
SourceAlpha = GL_SRC_ALPHA,
DestinationColor = GL_DST_COLOR,
DestinationAlpha = GL_DST_ALPHA,
One = GL_ONE,
OneMinusSourceColor = GL_ONE_MINUS_SRC_COLOR,
OneMinusSourceAlpha = GL_ONE_MINUS_SRC_ALPHA,
Zero = GL_ZERO,
}
static:
/**
Enables an OpenGL capability.
*/
void Enable(Capability cap) {
glEnable(cap);
}
/**
Disables an OpenGL capability
*/
void Disable(Capability cap) {
glDisable(cap);
}
void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) {
glViewport(x, y, width, height);
}
void DrawArrays(GLenum mode, GLint first, GLsizei count) {
glDrawArrays(mode, first, count);
}
///
void SetTextureParameter(GLenum target, GLenum pname, GLint param) {
glTexParameteri(target, pname, param);
}
///
void SetTextureParameter(GLenum target, GLenum pname, GLfloat param) {
glTexParameterf(target, pname, param);
}
///
void SetTextureParameter(GLenum target, GLenum pname, GLint* param) {
glTexParameteriv(target, pname, param);
}
///
void SetTextureParameter(GLenum target, GLenum pname, GLfloat* param) {
glTexParameterfv(target, pname, param);
}
///
void SetTextureParameter(GLenum target, GLenum pname, const(GLint)* param) {
glTexParameterIiv(target, pname, param);
}
///
void SetTextureParameter(GLenum target, GLenum pname, const(GLuint)* param) {
glTexParameterIuiv(target, pname, param);
}
///
void BufferSubData(GLenum target, ptrdiff_t offset, ptrdiff_t size, void* data) {
glBufferSubData(target, offset, size, data);
}
///
void BufferData(GLenum target, ptrdiff_t size, void* data, GLenum usage) {
glBufferData(target, size, data, usage);
}
/+
Activating
+/
void ActiveTexture(GLenum texture) {
glActiveTexture(texture);
}
/+
Drawing
+/
void DrawBuffers(GLsizei count, const(GLenum)* buffers) {
glDrawBuffers(count, buffers);
}
/+
Binding
+/
void BindBuffer(GLenum target, GLuint id) {
glBindBuffer(target, id);
}
void BindFramebuffer(GLenum target, GLuint id) {
glBindFramebuffer(target, id);
}
void BindRenderbuffer(GLenum target, GLuint id) {
glBindRenderbuffer(target, id);
}
void BindTexture(GLenum target, GLuint id) {
glBindTexture(target, id);
}
void BindVertexArray(GLuint id) {
glBindVertexArray(id);
}
/*
AlphaFunc
*/
void AlphaFunc(GLenum mode, float clamp) {
glAlphaFunc(mode, clamp);
}
void DepthFunc(GLenum mode) {
glDepthFunc(mode);
}
void BlendFunc(GLenum logicOpA, GLenum logicOpB) {
glBlendFunc(logicOpA, logicOpB);
}
void BlendFuncSeperate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
/*
Culling
*/
void CullFace(GLenum face) {
glCullFace(face);
}
}
enum ObjectClass {
Anything,
Data,
Texture
}
abstract class GLObject {
private:
GLuint id;
public:
GLuint Id() {
return id;
}
/// Binds the object with default type
abstract void Bind();
/// Binds the object
abstract void Bind(GLenum target);
/// Unbinds the object
abstract void Unbind();
}
/*
------ BUFFERS ------
*/
enum BufferUsage : GLenum {
StreamDraw = GL_STREAM_DRAW,
StreamRead = GL_STREAM_READ,
StreamCopy = GL_STREAM_COPY,
StaticDraw = GL_STATIC_DRAW,
StaticRead = GL_STATIC_READ,
StaticCopy = GL_STATIC_COPY,
DynamicDraw = GL_DYNAMIC_DRAW,
DynamicRead = GL_DYNAMIC_READ,
DynamicCopy = GL_DYNAMIC_COPY,
}
enum BufferType : GLenum {
/// Vertex Attributes
Vertex = GL_ARRAY_BUFFER,
/// Buffer Copy Source
CopyRead = GL_COPY_READ_BUFFER,
/// Buffer Copy Destination
CopyWrite = GL_COPY_WRITE_BUFFER,
/// Vertex Array Indices
ElementAray = GL_ELEMENT_ARRAY_BUFFER,
/// Pixel Read Target
PixelPack = GL_PIXEL_PACK_BUFFER,
/// Texture Data Source
PixelUnpack = GL_PIXEL_UNPACK_BUFFER,
/// Texture Data Buffer
Texture = GL_TEXTURE_BUFFER,
/// Uniform Block Storage
Uniform = GL_UNIFORM_BUFFER
}
class Buffer : GLObject {
private:
GLenum boundTarget;
public:
this() {
glGenBuffers(1, &id);
}
~this() {
glDeleteBuffers(1, &id);
}
/// Binds the buffer with default type
override void Bind() {
Bind(BufferType.Vertex);
}
/// Binds the buffer
override void Bind(GLenum target) {
// We're already bound there, bail out.
if (target in boundBuffers &&
boundBuffers[target] !is null &&
boundBuffers[target].id == id) return;
// Unbind from old position if needed.
if (boundTarget != 0) Unbind();
// Bind to new position.
boundTarget = target;
boundBuffers[boundTarget] = this;
GL.BindBuffer(target, id);
}
/// Unbinds the buffer (binds buffer 0)
override void Unbind() {
/// Skip unbinding if not bound in the first place.
if (boundTarget == 0) return;
/// If another buffer is bound there, bail out.
if (boundBuffers[boundTarget].id != id) return;
/// Unbind target.
GL.BindBuffer(boundTarget, 0);
boundBuffers[boundTarget] = null;
boundTarget = 0;
}
///
void Data(ptrdiff_t size, void* data, GLenum usage) {
if (boundTarget == 0) return;
GL.BufferData(boundTarget, size, data, usage);
}
///
void SubData(ptrdiff_t offset, ptrdiff_t size, void* data) {
if (boundTarget == 0) return;
GL.BufferSubData(boundTarget, offset, size, data);
}
/*
/// glBufferStorage.
void BufferStorage(GLenum target, ptrdiff_t size, void* data, GLbitfield flags) {
Bind(target);
glBufferStorage(target, size, data, flags);
}
/// Clear buffer data.
void ClearBufferData(GLenum target, GLenum internalFormat, GLenum format, GLenum type, void* data) {
Bind(target);
glClearBufferData(target, internalFormat, format, type, data);
}
/// Clear buffer sub data.
void ClearBufferSubData(GLenum target, GLenum internalFormat, ptrdiff_t offset, ptrdiff_t size, GLenum format, GLenum type, void* data) {
Bind(target);
glClearBufferSubData(target, internalFormat, offset, size, format, type, data);
}
/*void CopyBufferSubData(GLenum readtarget, GLenum writetarget, ptrdiff_t readoffset, ptrdiff_t writeoffset, ptrdiff_t size) {
Bind(readtarget);
CopyBufferSubData(readtarget, writetarget, readoffset, writeoffset, size);
}*/
}
/*
------ TEXTURES ------
*/
enum TextureType : GLenum {
/// 1D Texture
Tex1D = GL_TEXTURE_1D,
/// 2D Texture
Tex2D = GL_TEXTURE_2D,
/// 3D Texture
Tex3D = GL_TEXTURE_3D,
/// Array of 1D Textures
Tex1DArray = GL_TEXTURE_1D_ARRAY,
/// Array of 2D Textures
Tex2DArray = GL_TEXTURE_2D_ARRAY,
/// Rectangle Texture
TexRectangle = GL_TEXTURE_RECTANGLE,
/// Cube Map
TexCubeMap = GL_TEXTURE_CUBE_MAP,
/// Buffer
TexBuffer = GL_TEXTURE_BUFFER,
/// Multisampled 2D Texture
Tex2DMultisample = GL_TEXTURE_2D_MULTISAMPLE,
/// Array of Multisampled 2D Textures
Tex2DMultisampleArray = GL_TEXTURE_2D_MULTISAMPLE_ARRAY
}
enum TextureParameter : GLenum {
///
BaseLevel = GL_TEXTURE_BASE_LEVEL,
///
CompareFunc = GL_TEXTURE_COMPARE_FUNC,
///
CompareMode = GL_TEXTURE_COMPARE_MODE,
///
LODBias = GL_TEXTURE_LOD_BIAS,
///
MinFilter = GL_TEXTURE_MIN_FILTER,
///
MagFilter = GL_TEXTURE_MAG_FILTER,
///
MinLOD = GL_TEXTURE_MIN_LOD,
///
MaxLOD = GL_TEXTURE_MAX_LOD,
///
MaxLevel = GL_TEXTURE_MAX_LEVEL,
///
SwizzleR = GL_TEXTURE_SWIZZLE_R,
///
SwizzleG = GL_TEXTURE_SWIZZLE_G,
///
SwizzleB = GL_TEXTURE_SWIZZLE_B,
///
SwizzleA = GL_TEXTURE_SWIZZLE_A,
///
WrapS = GL_TEXTURE_WRAP_S,
///
WrapT = GL_TEXTURE_WRAP_T,
///
WrapR = GL_TEXTURE_WRAP_R
}
class Texture : GLObject {
private:
GLenum boundTarget;
public:
this() {
glGenTextures(1, &id);
}
~this() {
glDeleteTextures(1, &id);
}
/// Binds the texture with default type
override void Bind() {
Bind(TextureType.Tex2D);
}
/// Binds the texture
override void Bind(GLenum target) {
// We're already bound there, bail out.
if (target in boundTextures &&
boundTextures[target] !is null &&
boundTextures[target].id == id) return;
// Unbind from old position if needed.
if (boundTarget != 0) Unbind();
// Bind to new position.
boundTarget = target;
boundTextures[boundTarget] = this;
GL.BindTexture(target, id);
}
/// Unbinds the texture (binds texture 0)
override void Unbind() {
/// Skip unbinding if not bound in the first place.
if (boundTarget == 0) return;
/// If another texture is bound there, bail out.
if (boundTarget in boundTextures && boundTextures[boundTarget] !is null && boundTextures[boundTarget].id != id) return;
/// Unbind target.
GL.BindTexture(boundTarget, 0);
boundTextures[boundTarget] = null;
boundTarget = 0;
}
///
void AttachTo(GLenum textureid) {
GL.ActiveTexture(GL_TEXTURE0+textureid);
}
///
void SetParameter(GLenum target, GLenum pname, GLint param) {
Bind(target);
GL.SetTextureParameter(target, pname, param);
}
///
void SetParameter(GLenum target, GLenum pname, GLfloat param) {
Bind(target);
GL.SetTextureParameter(target, pname, param);
}
///
void SetParameter(GLenum target, GLenum pname, GLint* param) {
Bind(target);
GL.SetTextureParameter(target, pname, param);
}
///
void SetParameter(GLenum target, GLenum pname, GLfloat* param) {
Bind(target);
GL.SetTextureParameter(target, pname, param);
}
///
void SetParameter(GLenum target, GLenum pname, const(GLint)* param) {
Bind(target);
GL.SetTextureParameter(target, pname, param);
}
///
void SetParameter(GLenum target, GLenum pname, const(GLuint)* param) {
Bind(target);
GL.SetTextureParameter(target, pname, param);
}
///
void Image1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const(GLvoid)* data) {
glTexImage1D(target, level, internalFormat, width, border, format, type, data);
}
///
void Image2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const(GLvoid)* data) {
glTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
}
///
void Image2DMultisample(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations) {
glTexImage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
}
///
void Image3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const(GLvoid)* data) {
glTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, data);
}
///
void Image3DMultisample(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) {
glTexImage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
}
}
/*
------ FRAMEBUFFERS ------
*/
enum FramebufferType : GLenum {
/// A framebuffer which does multiple operations
Multi = GL_FRAMEBUFFER,
/// Framebuffer that can be drawn to
Drawing = GL_DRAW_FRAMEBUFFER,
/// Framebuffer that can be read from.
Reading = GL_READ_FRAMEBUFFER
}
class Framebuffer : GLObject {
private:
GLenum boundTarget;
public:
this() {
glGenFramebuffers(1, &id);
}
~this() {
glDeleteFramebuffers(1, &id);
}
/// Binds the framebuffer with default type
override void Bind() {
Bind(FramebufferType.Multi);
}
/// Binds the framebuffer
override void Bind(GLenum target) {
// We're already bound there, bail out.
if (target in boundFramebuffers &&
boundFramebuffers[target] !is null &&
boundFramebuffers[target].id == id) return;
// Unbind from old position if needed.
if (boundTarget != 0) Unbind();
// Bind to new position.
boundTarget = target;
boundFramebuffers[boundTarget] = this;
GL.BindFramebuffer(target, id);
}
/// Unbinds the framebuffer (binds framebuffer 0)
override void Unbind() {
/// Skip unbinding if not bound in the first place.
if (boundTarget == 0) return;
/// If another framebuffer is bound there, bail out.
if (boundFramebuffers[boundTarget].id != id) return;
/// Unbind target.
GL.BindFramebuffer(boundTarget, 0);
boundFramebuffers[boundTarget] = null;
boundTarget = 0;
}
///
void Renderbuffer(GLenum target, GLenum attachment, GLenum source, GLuint buffer) {
Bind(target);
glFramebufferRenderbuffer(target, attachment, source, buffer);
}
///
void Texture(GLenum target, GLenum attachment, GLuint texture, GLint level) {
Bind(target);
glFramebufferTexture(target, attachment, texture, level);
}
///
void Texture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
Bind(target);
glFramebufferTexture1D(target, attachment, textarget, texture, level);
}
///
void Texture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
Bind(target);
glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
///
void Texture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer) {
Bind(target);
glFramebufferTexture3D(target, attachment, textarget, texture, level, layer);
}
///
void TextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) {
Bind(target);
glFramebufferTextureLayer(target, attachment, texture, level, layer);
}
}
/*
------ RENDERBUFFERS ------
*/
class Renderbuffer : GLObject {
public:
this() {
glGenRenderbuffers(1, &id);
}
~this() {
glDeleteRenderbuffers(1, &id);
}
/// Binds the renderbuffer with default type
override void Bind() {
Bind(0);
}
/// Binds the renderbuffer
override void Bind(GLenum target) {
// We're already bound there, bail out.
if (boundRenderbuffer is this) return;
// Bind to new position.
boundRenderbuffer = this;
GL.BindRenderbuffer(GL_RENDERBUFFER, id);
}
/// Unbinds the renderbuffer (binds renderbuffer 0)
override void Unbind() {
/// Skip unbinding if not bound in the first place.
if (boundRenderbuffer is null) return;
/// If another renderbuffer is bound there, bail out.
if (boundRenderbuffer !is this) return;
/// Unbind target.
GL.BindRenderbuffer(GL_RENDERBUFFER, 0);
boundRenderbuffer = null;
}
///
void Storage(GLenum internalFormat, GLsizei width, GLsizei height) {
glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, width, height);
}
///
void StorageMultisample(GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height) {
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, internalFormat, width, height);
}
}
/*
------ VERTEX ARRAYS ------
*/
class VertexArray : GLObject {
public:
this() {
glGenVertexArrays(1, &id);
}
~this() {
glDeleteVertexArrays(1, &id);
}
/// Binds the vertex array
override void Bind() {
Bind(0);
}
/// Binds the vertex array
override void Bind(GLenum target) {
// We're already bound there, bail out.
if (boundVertexArray is this) return;
// Bind to new position.
boundVertexArray = this;
GL.BindVertexArray(id);
}
/// Unbinds the vertex array (binds vertex array 0)
override void Unbind() {
/// If another vertex array is bound there, bail out.
if (boundVertexArray !is this) return;
/// Unbind target.
GL.BindVertexArray(0);
boundVertexArray = null;
}
void EnableArray(GLuint index) {
glEnableVertexAttribArray(index);
}
void DisableArray(GLuint index) {
glDisableVertexAttribArray(index);
}
void AttribPointer(GLuint attribute, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const(GLvoid)* offset) {
glVertexAttribPointer(attribute, size, type, normalized, stride, offset);
}
void AttribIPointer(GLuint attribute, GLint size, GLenum type, GLsizei stride, const(GLvoid)* offset) {
glVertexAttribIPointer(attribute, size, type, stride, offset);
}
}
// TODO: Implement features from this.
class Sampler : GLObject {
private:
GLuint id;
GLenum boundTarget;
public:
this() {
glGenSamplers(1, &id);
}
/// Binds the sampler
override void Bind(GLenum target) {
// We're already bound there, bail out.
if (boundSamplers[target].id == id) return;
// Unbind from old position if needed.
if (boundTarget != 0) Unbind();
// Bind to new position.
boundTarget = target;
boundSamplers[boundTarget] = this;
glBindSampler(target, id);
}
/// Unbinds the sampler (binds sampler 0)
override void Unbind() {
/// Skip unbinding if not bound in the first place.
if (boundTarget == 0) return;
/// If another sampler is bound there, bail out.
if (boundSamplers[boundTarget].id != id) return;
/// Unbind target.
glBindSampler(boundTarget, 0);
boundSamplers[boundTarget] = null;
boundTarget = 0;
}
}
// TODO: Implement these
/*
class AsyncQuery : GLObject {
private:
GLuint id;
GLenum boundTarget;
public:
this() {
glGenQueries(1, &id);
}
}
class Pipeline : GLObject {
private:
GLuint id;
GLenum boundTarget;
public:
this() {
glGenProgramPipelines(1, &id);
}
}
class TransformFeedback : GLObject {
private:
GLuint id;
GLenum boundTarget;
public:
this() {
glGenTransformFeedbacks(1, &id);
}
}*/
| D |
// Written in the D programming language.
/**
String handling functions.
$(SCRIPT inhibitQuickIndex = 1;)
$(DIVC quickindex,
$(BOOKTABLE ,
$(TR $(TH Category) $(TH Functions) )
$(TR $(TDNW Searching)
$(TD
$(MYREF column)
$(MYREF inPattern)
$(MYREF indexOf)
$(MYREF indexOfAny)
$(MYREF indexOfNeither)
$(MYREF lastIndexOf)
$(MYREF lastIndexOfAny)
$(MYREF lastIndexOfNeither)
)
)
$(TR $(TDNW Comparison)
$(TD
$(MYREF countchars)
$(MYREF isNumeric)
)
)
$(TR $(TDNW Mutation)
$(TD
$(MYREF capitalize)
$(MYREF munch)
$(MYREF removechars)
$(MYREF squeeze)
)
)
$(TR $(TDNW Pruning and Filling)
$(TD
$(MYREF center)
$(MYREF chomp)
$(MYREF chompPrefix)
$(MYREF chop)
$(MYREF detab)
$(MYREF entab)
$(MYREF leftJustify)
$(MYREF outdent)
$(MYREF rightJustify)
$(MYREF strip)
$(MYREF stripLeft)
$(MYREF stripRight)
$(MYREF wrap)
)
)
$(TR $(TDNW Substitution)
$(TD
$(MYREF abbrev)
$(MYREF soundex)
$(MYREF succ)
$(MYREF tr)
$(MYREF translate)
)
)
$(TR $(TDNW Miscellaneous)
$(TD
$(MYREF assumeUTF)
$(MYREF fromStringz)
$(MYREF lineSplitter)
$(MYREF representation)
$(MYREF splitLines)
$(MYREF toStringz)
)
)))
Objects of types $(D _string), $(D wstring), and $(D dstring) are value types
and cannot be mutated element-by-element. For using mutation during building
strings, use $(D char[]), $(D wchar[]), or $(D dchar[]). The $(D xxxstring)
types are preferable because they don't exhibit undesired aliasing, thus
making code more robust.
The following functions are publicly imported:
$(BOOKTABLE ,
$(TR $(TH Module) $(TH Functions) )
$(LEADINGROW Publicly imported functions)
$(TR $(TD std.algorithm)
$(TD
$(SHORTXREF algorithm, cmp)
$(SHORTXREF algorithm, count)
$(SHORTXREF algorithm, endsWith)
$(SHORTXREF algorithm, startsWith)
))
$(TR $(TD std.array)
$(TD
$(SHORTXREF array, join)
$(SHORTXREF array, replace)
$(SHORTXREF array, replaceInPlace)
$(SHORTXREF array, split)
))
$(TR $(TD std.format)
$(TD
$(SHORTXREF format, format)
$(SHORTXREF format, sformat)
))
$(TR $(TD std.uni)
$(TD
$(SHORTXREF uni, icmp)
$(SHORTXREF uni, toLower)
$(SHORTXREF uni, toLowerInPlace)
$(SHORTXREF uni, toUpper)
$(SHORTXREF uni, toUpperInPlace)
))
)
There is a rich set of functions for _string handling defined in other modules.
Functions related to Unicode and ASCII are found in $(LINK2 std_uni.html, std.uni)
and $(LINK2 std_ascii.html, std.ascii), respectively. Other functions that have a
wider generality than just strings can be found in $(LINK2 std_algorithm.html,
std.algorithm) and $(LINK2 std_range.html, std.range).
See_Also:
$(LIST
$(LINK2 std_algorithm.html, std.algorithm) and
$(LINK2 std_range.html, std.range)
for generic range algorithms
,
$(LINK2 std_ascii.html, std.ascii)
for functions that work with ASCII strings
,
$(LINK2 std_uni.html, std.uni)
for functions that work with unicode strings
)
Macros: WIKI = Phobos/StdString
SHORTXREF=$(XREF2 $1, $2, $(TT $2))
Copyright: Copyright Digital Mars 2007-.
License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: $(WEB digitalmars.com, Walter Bright),
$(WEB erdani.org, Andrei Alexandrescu),
and Jonathan M Davis
Source: $(PHOBOSSRC std/_string.d)
*/
module std.string;
//debug=string; // uncomment to turn on debugging trustedPrintf's
debug(string) private
void trustedPrintf(in char* str) @trusted nothrow @nogc
{
import core.stdc.stdio : printf;
printf("%s", str);
}
public import std.uni : icmp, toLower, toLowerInPlace, toUpper, toUpperInPlace;
public import std.format : format, sformat;
import std.typecons : Flag;
import std.range.primitives;
import std.traits;
import std.typetuple;
//public imports for backward compatibility
public import std.algorithm : startsWith, endsWith, cmp, count;
public import std.array : join, replace, replaceInPlace, split;
/* ************* Exceptions *************** */
/++
Exception thrown on errors in std.string functions.
+/
class StringException : Exception
{
/++
Params:
msg = The message for the exception.
file = The file where the exception occurred.
line = The line number where the exception occurred.
next = The previous exception in the chain of exceptions, if any.
+/
this(string msg,
string file = __FILE__,
size_t line = __LINE__,
Throwable next = null) @safe pure nothrow
{
super(msg, file, line, next);
}
}
/++
Returns a D-style array of $(D char) given a zero-terminated C-style string.
The returned array will retain the same type qualifiers as the input.
$(RED Important Note:) The returned array is a slice of the original buffer.
The original data is not changed and not copied.
+/
inout(char)[] fromStringz(inout(char)* cString) @system pure {
import core.stdc.string : strlen;
return cString ? cString[0 .. strlen(cString)] : null;
}
///
@system pure unittest
{
assert(fromStringz(null) == null);
assert(fromStringz("foo") == "foo");
}
/++
Returns a C-style zero-terminated string equivalent to $(D s). $(D s)
must not contain embedded $(D '\0')'s as any C function will treat the first
$(D '\0') that it sees as the end of the string. If $(D s.empty) is
$(D true), then a string containing only $(D '\0') is returned.
$(RED Important Note:) When passing a $(D char*) to a C function, and the C
function keeps it around for any reason, make sure that you keep a reference
to it in your D code. Otherwise, it may go away during a garbage collection
cycle and cause a nasty bug when the C code tries to use it.
+/
immutable(char)* toStringz(const(char)[] s) @trusted pure nothrow
in
{
// The assert below contradicts the unittests!
//assert(memchr(s.ptr, 0, s.length) == null,
//text(s.length, ": `", s, "'"));
}
out (result)
{
import core.stdc.string : strlen, memcmp;
if (result)
{
auto slen = s.length;
while (slen > 0 && s[slen-1] == 0) --slen;
assert(strlen(result) == slen);
assert(memcmp(result, s.ptr, slen) == 0);
}
}
body
{
import std.exception : assumeUnique;
/+ Unfortunately, this isn't reliable.
We could make this work if string literals are put
in read-only memory and we test if s[] is pointing into
that.
/* Peek past end of s[], if it's 0, no conversion necessary.
* Note that the compiler will put a 0 past the end of static
* strings, and the storage allocator will put a 0 past the end
* of newly allocated char[]'s.
*/
char* p = &s[0] + s.length;
if (*p == 0)
return s;
+/
// Need to make a copy
auto copy = new char[s.length + 1];
copy[0..s.length] = s[];
copy[s.length] = 0;
return assumeUnique(copy).ptr;
}
/++ Ditto +/
immutable(char)* toStringz(in string s) @trusted pure nothrow
{
if (s.empty) return "".ptr;
/* Peek past end of s[], if it's 0, no conversion necessary.
* Note that the compiler will put a 0 past the end of static
* strings, and the storage allocator will put a 0 past the end
* of newly allocated char[]'s.
*/
immutable p = s.ptr + s.length;
// Is p dereferenceable? A simple test: if the p points to an
// address multiple of 4, then conservatively assume the pointer
// might be pointing to a new block of memory, which might be
// unreadable. Otherwise, it's definitely pointing to valid
// memory.
if ((cast(size_t) p & 3) && *p == 0)
return s.ptr;
return toStringz(cast(const char[]) s);
}
pure nothrow unittest
{
import core.stdc.string : strlen;
import std.conv : to;
debug(string) trustedPrintf("string.toStringz.unittest\n");
// TODO: CTFEable toStringz is really necessary?
//assertCTFEable!(
//{
auto p = toStringz("foo");
assert(strlen(p) == 3);
const(char)[] foo = "abbzxyzzy";
p = toStringz(foo[3..5]);
assert(strlen(p) == 2);
string test = "";
p = toStringz(test);
assert(*p == 0);
test = "\0";
p = toStringz(test);
assert(*p == 0);
test = "foo\0";
p = toStringz(test);
assert(p[0] == 'f' && p[1] == 'o' && p[2] == 'o' && p[3] == 0);
const string test2 = "";
p = toStringz(test2);
assert(*p == 0);
//});
}
/**
Flag indicating whether a search is case-sensitive.
*/
alias CaseSensitive = Flag!"caseSensitive";
/++
Returns the index of the first occurrence of $(D c) in $(D s). If $(D c)
is not found, then $(D -1) is returned.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t indexOf(Char)(in Char[] s, in dchar c,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char)
{
import std.ascii : toLower, isASCII;
import std.uni : toLower;
if (cs == CaseSensitive.yes)
{
static if (Char.sizeof == 1)
{
import core.stdc.string : memchr;
if (std.ascii.isASCII(c) && !__ctfe)
{ // Plain old ASCII
auto trustedmemchr() @trusted { return cast(Char*)memchr(s.ptr, c, s.length); }
auto p = trustedmemchr();
if (p)
return p - s.ptr;
else
return -1;
}
}
// c is a universal character
foreach (ptrdiff_t i, dchar c2; s)
{
if (c == c2)
return i;
}
}
else
{
if (std.ascii.isASCII(c))
{ // Plain old ASCII
auto c1 = cast(char) std.ascii.toLower(c);
foreach (ptrdiff_t i, c2; s)
{
auto c3 = std.ascii.toLower(c2);
if (c1 == c3)
return i;
}
}
else
{ // c is a universal character
auto c1 = std.uni.toLower(c);
foreach (ptrdiff_t i, dchar c2; s)
{
auto c3 = std.uni.toLower(c2);
if (c1 == c3)
return i;
}
}
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOf.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
assert(indexOf(cast(S)null, cast(dchar)'a') == -1);
assert(indexOf(to!S("def"), cast(dchar)'a') == -1);
assert(indexOf(to!S("abba"), cast(dchar)'a') == 0);
assert(indexOf(to!S("def"), cast(dchar)'f') == 2);
assert(indexOf(to!S("def"), cast(dchar)'a', CaseSensitive.no) == -1);
assert(indexOf(to!S("def"), cast(dchar)'a', CaseSensitive.no) == -1);
assert(indexOf(to!S("Abba"), cast(dchar)'a', CaseSensitive.no) == 0);
assert(indexOf(to!S("def"), cast(dchar)'F', CaseSensitive.no) == 2);
assert(indexOf(to!S("ödef"), 'ö', CaseSensitive.no) == 0);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
assert(indexOf("def", cast(char)'f', CaseSensitive.no) == 2);
assert(indexOf(sPlts, cast(char)'P', CaseSensitive.no) == 23);
assert(indexOf(sPlts, cast(char)'R', CaseSensitive.no) == 2);
}
foreach (cs; EnumMembers!CaseSensitive)
{
assert(indexOf("hello\U00010143\u0100\U00010143", '\u0100', cs) == 9);
assert(indexOf("hello\U00010143\u0100\U00010143"w, '\u0100', cs) == 7);
assert(indexOf("hello\U00010143\u0100\U00010143"d, '\u0100', cs) == 6);
}
});
}
/++
Returns the index of the first occurrence of $(D c) in $(D s) with respect
to the start index $(D startIdx). If $(D c) is not found, then $(D -1) is
returned. If $(D c) is found the value of the returned index is at least
$(D startIdx). $(D startIdx) represents a codeunit index in $(D s). If the
sequence starting at $(D startIdx) does not represent a well formed codepoint,
then a $(XREF utf,UTFException) may be thrown.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t indexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char)
{
if (startIdx < s.length)
{
ptrdiff_t foundIdx = indexOf(s[startIdx .. $], c, cs);
if (foundIdx != -1)
{
return foundIdx + cast(ptrdiff_t)startIdx;
}
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOf(startIdx).unittest\n");
foreach (S; TypeTuple!(string, wstring, dstring))
{
assert(indexOf(cast(S)null, cast(dchar)'a', 1) == -1);
assert(indexOf(to!S("def"), cast(dchar)'a', 1) == -1);
assert(indexOf(to!S("abba"), cast(dchar)'a', 1) == 3);
assert(indexOf(to!S("def"), cast(dchar)'f', 1) == 2);
assert((to!S("def")).indexOf(cast(dchar)'a', 1,
CaseSensitive.no) == -1);
assert(indexOf(to!S("def"), cast(dchar)'a', 1,
CaseSensitive.no) == -1);
assert(indexOf(to!S("def"), cast(dchar)'a', 12,
CaseSensitive.no) == -1);
assert(indexOf(to!S("AbbA"), cast(dchar)'a', 2,
CaseSensitive.no) == 3);
assert(indexOf(to!S("def"), cast(dchar)'F', 2, CaseSensitive.no) == 2);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
assert(indexOf("def", cast(char)'f', cast(uint)2,
CaseSensitive.no) == 2);
assert(indexOf(sPlts, cast(char)'P', 12, CaseSensitive.no) == 23);
assert(indexOf(sPlts, cast(char)'R', cast(ulong)1,
CaseSensitive.no) == 2);
}
foreach(cs; EnumMembers!CaseSensitive)
{
assert(indexOf("hello\U00010143\u0100\U00010143", '\u0100', 2, cs)
== 9);
assert(indexOf("hello\U00010143\u0100\U00010143"w, '\u0100', 3, cs)
== 7);
assert(indexOf("hello\U00010143\u0100\U00010143"d, '\u0100', 6, cs)
== 6);
}
}
/++
Returns the index of the first occurrence of $(D sub) in $(D s). If $(D sub)
is not found, then $(D -1) is returned.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
in CaseSensitive cs = CaseSensitive.yes) @trusted
if (isSomeChar!Char1 && isSomeChar!Char2)
{
import std.uni : toLower;
import std.algorithm : find;
const(Char1)[] balance;
if (cs == CaseSensitive.yes)
{
balance = std.algorithm.find(s, sub);
}
else
{
balance = std.algorithm.find!
((a, b) => std.uni.toLower(a) == std.uni.toLower(b))
(s, sub);
}
return balance.empty ? -1 : balance.ptr - s.ptr;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOf.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(indexOf(cast(S)null, to!T("a")) == -1);
assert(indexOf(to!S("def"), to!T("a")) == -1);
assert(indexOf(to!S("abba"), to!T("a")) == 0);
assert(indexOf(to!S("def"), to!T("f")) == 2);
assert(indexOf(to!S("dfefffg"), to!T("fff")) == 3);
assert(indexOf(to!S("dfeffgfff"), to!T("fff")) == 6);
assert(indexOf(to!S("dfeffgfff"), to!T("a"), CaseSensitive.no) == -1);
assert(indexOf(to!S("def"), to!T("a"), CaseSensitive.no) == -1);
assert(indexOf(to!S("abba"), to!T("a"), CaseSensitive.no) == 0);
assert(indexOf(to!S("def"), to!T("f"), CaseSensitive.no) == 2);
assert(indexOf(to!S("dfefffg"), to!T("fff"), CaseSensitive.no) == 3);
assert(indexOf(to!S("dfeffgfff"), to!T("fff"), CaseSensitive.no) == 6);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
S sMars = "Who\'s \'My Favorite Maritian?\'";
assert(indexOf(sMars, to!T("MY fAVe"), CaseSensitive.no) == -1);
assert(indexOf(sMars, to!T("mY fAVOriTe"), CaseSensitive.no) == 7);
assert(indexOf(sPlts, to!T("mArS:"), CaseSensitive.no) == 0);
assert(indexOf(sPlts, to!T("rOcK"), CaseSensitive.no) == 17);
assert(indexOf(sPlts, to!T("Un."), CaseSensitive.no) == 41);
assert(indexOf(sPlts, to!T(sPlts), CaseSensitive.no) == 0);
assert(indexOf("\u0100", to!T("\u0100"), CaseSensitive.no) == 0);
// Thanks to Carlos Santander B. and zwang
assert(indexOf("sus mejores cortesanos. Se embarcaron en el puerto de Dubai y",
to!T("page-break-before"), CaseSensitive.no) == -1);
}();
foreach (cs; EnumMembers!CaseSensitive)
{
assert(indexOf("hello\U00010143\u0100\U00010143", to!S("\u0100"), cs) == 9);
assert(indexOf("hello\U00010143\u0100\U00010143"w, to!S("\u0100"), cs) == 7);
assert(indexOf("hello\U00010143\u0100\U00010143"d, to!S("\u0100"), cs) == 6);
}
}
});
}
/++
Returns the index of the first occurrence of $(D sub) in $(D s) with
respect to the start index $(D startIdx). If $(D sub) is not found, then
$(D -1) is returned. If $(D sub) is found the value of the returned index
is at least $(D startIdx). $(D startIdx) represents a codeunit index in
$(D s). If the sequence starting at $(D startIdx) does not represent a well
formed codepoint, then a $(XREF utf,UTFException) may be thrown.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes)
@safe if (isSomeChar!Char1 && isSomeChar!Char2)
{
if (startIdx < s.length)
{
ptrdiff_t foundIdx = indexOf(s[startIdx .. $], sub, cs);
if (foundIdx != -1)
{
return foundIdx + cast(ptrdiff_t)startIdx;
}
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOf(startIdx).unittest\n");
foreach(S; TypeTuple!(string, wstring, dstring))
{
foreach(T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(indexOf(cast(S)null, to!T("a"), 1337) == -1);
assert(indexOf(to!S("def"), to!T("a"), 0) == -1);
assert(indexOf(to!S("abba"), to!T("a"), 2) == 3);
assert(indexOf(to!S("def"), to!T("f"), 1) == 2);
assert(indexOf(to!S("dfefffg"), to!T("fff"), 1) == 3);
assert(indexOf(to!S("dfeffgfff"), to!T("fff"), 5) == 6);
assert(indexOf(to!S("dfeffgfff"), to!T("a"), 1, CaseSensitive.no) == -1);
assert(indexOf(to!S("def"), to!T("a"), 2, CaseSensitive.no) == -1);
assert(indexOf(to!S("abba"), to!T("a"), 3, CaseSensitive.no) == 3);
assert(indexOf(to!S("def"), to!T("f"), 1, CaseSensitive.no) == 2);
assert(indexOf(to!S("dfefffg"), to!T("fff"), 2, CaseSensitive.no) == 3);
assert(indexOf(to!S("dfeffgfff"), to!T("fff"), 4, CaseSensitive.no) == 6);
assert(indexOf(to!S("dfeffgffföä"), to!T("öä"), 9, CaseSensitive.no) == 9,
to!string(indexOf(to!S("dfeffgffföä"), to!T("öä"), 9, CaseSensitive.no))
~ " " ~ S.stringof ~ " " ~ T.stringof);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
S sMars = "Who\'s \'My Favorite Maritian?\'";
assert(indexOf(sMars, to!T("MY fAVe"), 10,
CaseSensitive.no) == -1);
assert(indexOf(sMars, to!T("mY fAVOriTe"), 4, CaseSensitive.no) == 7);
assert(indexOf(sPlts, to!T("mArS:"), 0, CaseSensitive.no) == 0);
assert(indexOf(sPlts, to!T("rOcK"), 12, CaseSensitive.no) == 17);
assert(indexOf(sPlts, to!T("Un."), 32, CaseSensitive.no) == 41);
assert(indexOf(sPlts, to!T(sPlts), 0, CaseSensitive.no) == 0);
assert(indexOf("\u0100", to!T("\u0100"), 0, CaseSensitive.no) == 0);
// Thanks to Carlos Santander B. and zwang
assert(indexOf("sus mejores cortesanos. Se embarcaron en el puerto de Dubai y",
to!T("page-break-before"), 10, CaseSensitive.no) == -1);
// In order for indexOf with and without index to be consistent
assert(indexOf(to!S(""), to!T("")) == indexOf(to!S(""), to!T(""), 0));
}();
foreach(cs; EnumMembers!CaseSensitive)
{
assert(indexOf("hello\U00010143\u0100\U00010143", to!S("\u0100"),
3, cs) == 9);
assert(indexOf("hello\U00010143\u0100\U00010143"w, to!S("\u0100"),
3, cs) == 7);
assert(indexOf("hello\U00010143\u0100\U00010143"d, to!S("\u0100"),
3, cs) == 6);
}
}
}
/++
Returns the index of the last occurrence of $(D c) in $(D s). If $(D c)
is not found, then $(D -1) is returned.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char)
{
import std.ascii : isASCII, toLower;
import std.utf : canSearchInCodeUnits;
if (cs == CaseSensitive.yes)
{
if (canSearchInCodeUnits!Char(c))
{
foreach_reverse (i, it; s)
{
if (it == c)
{
return i;
}
}
}
else
{
foreach_reverse (i, dchar it; s)
{
if (it == c)
{
return i;
}
}
}
}
else
{
if (std.ascii.isASCII(c))
{
immutable c1 = std.ascii.toLower(c);
foreach_reverse (i, it; s)
{
immutable c2 = std.ascii.toLower(it);
if (c1 == c2)
{
return i;
}
}
}
else
{
immutable c1 = std.uni.toLower(c);
foreach_reverse (i, dchar it; s)
{
immutable c2 = std.uni.toLower(it);
if (c1 == c2)
{
return i;
}
}
}
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOf.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
assert(lastIndexOf(cast(S) null, 'a') == -1);
assert(lastIndexOf(to!S("def"), 'a') == -1);
assert(lastIndexOf(to!S("abba"), 'a') == 3);
assert(lastIndexOf(to!S("def"), 'f') == 2);
assert(lastIndexOf(to!S("ödef"), 'ö') == 0);
assert(lastIndexOf(cast(S) null, 'a', CaseSensitive.no) == -1);
assert(lastIndexOf(to!S("def"), 'a', CaseSensitive.no) == -1);
assert(lastIndexOf(to!S("AbbA"), 'a', CaseSensitive.no) == 3);
assert(lastIndexOf(to!S("def"), 'F', CaseSensitive.no) == 2);
assert(lastIndexOf(to!S("ödef"), 'ö', CaseSensitive.no) == 0);
assert(lastIndexOf(to!S("i\u0100def"), to!dchar("\u0100"),
CaseSensitive.no) == 1);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
assert(lastIndexOf(to!S("def"), 'f', CaseSensitive.no) == 2);
assert(lastIndexOf(sPlts, 'M', CaseSensitive.no) == 34);
assert(lastIndexOf(sPlts, 'S', CaseSensitive.no) == 40);
}
foreach (cs; EnumMembers!CaseSensitive)
{
assert(lastIndexOf("\U00010143\u0100\U00010143hello", '\u0100', cs) == 4);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, '\u0100', cs) == 2);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, '\u0100', cs) == 1);
}
});
}
/++
Returns the index of the last occurrence of $(D c) in $(D s). If $(D c) is
not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in
the following way $(D s[0 .. startIdx]). $(D startIdx) represents a
codeunit index in $(D s). If the sequence ending at $(D startIdx) does not
represent a well formed codepoint, then a $(XREF utf,UTFException) may be
thrown.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char)
{
if (startIdx <= s.length)
{
return lastIndexOf(s[0u .. startIdx], c, cs);
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOf.unittest\n");
foreach(S; TypeTuple!(string, wstring, dstring))
{
assert(lastIndexOf(cast(S) null, 'a') == -1);
assert(lastIndexOf(to!S("def"), 'a') == -1);
assert(lastIndexOf(to!S("abba"), 'a', 3) == 0);
assert(lastIndexOf(to!S("deff"), 'f', 3) == 2);
assert(lastIndexOf(cast(S) null, 'a', CaseSensitive.no) == -1);
assert(lastIndexOf(to!S("def"), 'a', CaseSensitive.no) == -1);
assert(lastIndexOf(to!S("AbbAa"), 'a', to!ushort(4), CaseSensitive.no) == 3,
to!string(lastIndexOf(to!S("AbbAa"), 'a', 4, CaseSensitive.no)));
assert(lastIndexOf(to!S("def"), 'F', 3, CaseSensitive.no) == 2);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
assert(lastIndexOf(to!S("def"), 'f', 4, CaseSensitive.no) == -1);
assert(lastIndexOf(sPlts, 'M', sPlts.length -2, CaseSensitive.no) == 34);
assert(lastIndexOf(sPlts, 'S', sPlts.length -2, CaseSensitive.no) == 40);
}
foreach(cs; EnumMembers!CaseSensitive)
{
assert(lastIndexOf("\U00010143\u0100\U00010143hello", '\u0100', cs) == 4);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, '\u0100', cs) == 2);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, '\u0100', cs) == 1);
}
}
/++
Returns the index of the last occurrence of $(D sub) in $(D s). If $(D sub)
is not found, then $(D -1) is returned.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char1 && isSomeChar!Char2)
{
import std.utf : strideBack;
import std.conv : to;
import std.algorithm : endsWith;
if (sub.empty)
return s.length;
if (walkLength(sub) == 1)
return lastIndexOf(s, sub.front, cs);
if (cs == CaseSensitive.yes)
{
static if (is(Unqual!Char1 == Unqual!Char2))
{
import core.stdc.string : memcmp;
immutable c = sub[0];
for (ptrdiff_t i = s.length - sub.length; i >= 0; --i)
{
if (s[i] == c)
{
if (__ctfe)
{
foreach (j; 1 .. sub.length)
{
if (s[i + j] != sub[j])
continue;
}
return i;
}
else
{
auto trustedMemcmp(in void* s1, in void* s2, size_t n) @trusted
{
return memcmp(s1, s2, n);
}
if (trustedMemcmp(&s[i + 1], &sub[1],
(sub.length - 1) * Char1.sizeof) == 0)
return i;
}
}
}
}
else
{
for (size_t i = s.length; !s.empty;)
{
if (s.endsWith(sub))
return cast(ptrdiff_t)i - to!(const(Char1)[])(sub).length;
i -= strideBack(s, i);
s = s[0 .. i];
}
}
}
else
{
for (size_t i = s.length; !s.empty;)
{
if (endsWith!((a, b) => std.uni.toLower(a) == std.uni.toLower(b))
(s, sub))
{
return cast(ptrdiff_t)i - to!(const(Char1)[])(sub).length;
}
i -= strideBack(s, i);
s = s[0 .. i];
}
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOf.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
enum typeStr = S.stringof ~ " " ~ T.stringof;
assert(lastIndexOf(cast(S)null, to!T("a")) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("c")) == 6, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd")) == 6, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("ef")) == 8, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("c")) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("cd")) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("x")) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("xy")) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("")) == 10, typeStr);
assert(lastIndexOf(to!S("öabcdefcdef"), to!T("ö")) == 0, typeStr);
assert(lastIndexOf(cast(S)null, to!T("a"), CaseSensitive.no) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), CaseSensitive.no) == 6, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), CaseSensitive.no) == 6, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("x"), CaseSensitive.no) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("xy"), CaseSensitive.no) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), CaseSensitive.no) == 10, typeStr);
assert(lastIndexOf(to!S("öabcdefcdef"), to!T("ö"), CaseSensitive.no) == 0, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), CaseSensitive.no) == 6, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), CaseSensitive.no) == 6, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("def"), CaseSensitive.no) == 7, typeStr);
assert(lastIndexOf(to!S("ödfeffgfff"), to!T("ö"), CaseSensitive.yes) == 0);
S sPlts = "Mars: the fourth Rock (Planet) from the Sun.";
S sMars = "Who\'s \'My Favorite Maritian?\'";
assert(lastIndexOf(sMars, to!T("RiTE maR"), CaseSensitive.no) == 14, typeStr);
assert(lastIndexOf(sPlts, to!T("FOuRTh"), CaseSensitive.no) == 10, typeStr);
assert(lastIndexOf(sMars, to!T("whO\'s \'MY"), CaseSensitive.no) == 0, typeStr);
assert(lastIndexOf(sMars, to!T(sMars), CaseSensitive.no) == 0, typeStr);
}();
foreach (cs; EnumMembers!CaseSensitive)
{
enum csString = to!string(cs);
assert(lastIndexOf("\U00010143\u0100\U00010143hello", to!S("\u0100"), cs) == 4, csString);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, to!S("\u0100"), cs) == 2, csString);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, to!S("\u0100"), cs) == 1, csString);
}
}
});
}
@safe pure unittest // issue13529
{
import std.conv : to;
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
{
enum typeStr = S.stringof ~ " " ~ T.stringof;
auto idx = lastIndexOf(to!T("Hällö Wörldö ö"),to!S("ö ö"));
assert(idx != -1, to!string(idx) ~ " " ~ typeStr);
idx = lastIndexOf(to!T("Hällö Wörldö ö"),to!S("ö öd"));
assert(idx == -1, to!string(idx) ~ " " ~ typeStr);
}
}
}
/++
Returns the index of the last occurrence of $(D sub) in $(D s). If $(D sub)
is not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in
the following way $(D s[0 .. startIdx]). $(D startIdx) represents a
codeunit index in $(D s). If the sequence ending at $(D startIdx) does not
represent a well formed codepoint, then a $(XREF utf,UTFException) may be
thrown.
$(D cs) indicates whether the comparisons are case sensitive.
+/
ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char1 && isSomeChar!Char2)
{
if (startIdx <= s.length)
{
return lastIndexOf(s[0u .. startIdx], sub, cs);
}
return -1;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOf.unittest\n");
foreach(S; TypeTuple!(string, wstring, dstring))
{
foreach(T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
enum typeStr = S.stringof ~ " " ~ T.stringof;
assert(lastIndexOf(cast(S)null, to!T("a")) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), 5) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), 3) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("ef"), 6) == 4, typeStr ~
format(" %u", lastIndexOf(to!S("abcdefcdef"), to!T("ef"), 6)));
assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), 5) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("cd"), 3) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdefx"), to!T("x"), 1) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdefxy"), to!T("xy"), 6) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), 8) == 8, typeStr);
assert(lastIndexOf(to!S("öafö"), to!T("ö"), 3) == 0, typeStr ~
to!string(lastIndexOf(to!S("öafö"), to!T("ö"), 3))); //BUG 10472
assert(lastIndexOf(cast(S)null, to!T("a"), 1, CaseSensitive.no) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), 5, CaseSensitive.no) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), 4, CaseSensitive.no) == 2, typeStr ~
" " ~ to!string(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), 3, CaseSensitive.no)));
assert(lastIndexOf(to!S("abcdefcdef"), to!T("x"),3 , CaseSensitive.no) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdefXY"), to!T("xy"), 4, CaseSensitive.no) == -1, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), 7, CaseSensitive.no) == 7, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), 4, CaseSensitive.no) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), 4, CaseSensitive.no) == 2, typeStr);
assert(lastIndexOf(to!S("abcdefcdef"), to!T("def"), 6, CaseSensitive.no) == 3, typeStr);
assert(lastIndexOf(to!S(""), to!T(""), 0) == lastIndexOf(to!S(""), to!T("")), typeStr);
}();
foreach(cs; EnumMembers!CaseSensitive)
{
enum csString = to!string(cs);
assert(lastIndexOf("\U00010143\u0100\U00010143hello", to!S("\u0100"), 6, cs) == 4, csString);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, to!S("\u0100"), 6, cs) == 2, csString);
assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, to!S("\u0100"), 3, cs) == 1, csString);
}
}
}
private ptrdiff_t indexOfAnyNeitherImpl(bool forward, bool any, Char, Char2)(
const(Char)[] haystack, const(Char2)[] needles,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
import std.algorithm : canFind;
if (cs == CaseSensitive.yes)
{
static if (forward)
{
static if (any)
{
import std.algorithm : findAmong;
size_t n = haystack.findAmong(needles).length;
return n ? haystack.length - n : -1;
}
else
{
foreach (idx, dchar hay; haystack)
{
if (!canFind(needles, hay))
{
return idx;
}
}
}
}
else
{
static if (any)
{
import std.utf : strideBack;
import std.algorithm : findAmong;
import std.range : retro;
size_t n = haystack.retro.findAmong(needles).source.length;
if (n)
{
return n - haystack.strideBack(n);
}
}
else
{
foreach_reverse (idx, dchar hay; haystack)
{
if(!canFind(needles, hay))
{
return idx;
}
}
}
}
}
else
{
if (needles.length <= 16 && needles.walkLength(17))
{
size_t si = 0;
dchar[16] scratch = void;
foreach ( dchar c; needles)
{
scratch[si++] = std.uni.toLower(c);
}
static if (forward)
{
foreach (i, dchar c; haystack)
{
if (canFind(scratch[0 .. si], std.uni.toLower(c)) == any)
{
return i;
}
}
}
else
{
foreach_reverse (i, dchar c; haystack)
{
if (canFind(scratch[0 .. si], std.uni.toLower(c)) == any)
{
return i;
}
}
}
}
else
{
static bool f(dchar a, dchar b)
{
return std.uni.toLower(a) == b;
}
static if (forward)
{
foreach (i, dchar c; haystack)
{
if (canFind!f(needles, std.uni.toLower(c)) == any)
{
return i;
}
}
}
else
{
foreach_reverse (i, dchar c; haystack)
{
if (canFind!f(needles, std.uni.toLower(c)) == any)
{
return i;
}
}
}
}
}
return -1;
}
/**
Returns the index of the first occurence of any of the elements in $(D
needles) in $(D haystack). If no element of $(D needles) is found,
then $(D -1) is returned.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
return indexOfAnyNeitherImpl!(true, true)(haystack, needles, cs);
}
///
@safe pure unittest {
import std.conv : to;
ptrdiff_t i = "helloWorld".indexOfAny("Wr");
assert(i == 5);
i = "öällo world".indexOfAny("lo ");
assert(i == 4, to!string(i));
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOfAny.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(indexOfAny(cast(S)null, to!T("a")) == -1);
assert(indexOfAny(to!S("def"), to!T("rsa")) == -1);
assert(indexOfAny(to!S("abba"), to!T("a")) == 0);
assert(indexOfAny(to!S("def"), to!T("f")) == 2);
assert(indexOfAny(to!S("dfefffg"), to!T("fgh")) == 1);
assert(indexOfAny(to!S("dfeffgfff"), to!T("feg")) == 1);
assert(indexOfAny(to!S("zfeffgfff"), to!T("ACDC"),
CaseSensitive.no) == -1);
assert(indexOfAny(to!S("def"), to!T("MI6"),
CaseSensitive.no) == -1);
assert(indexOfAny(to!S("abba"), to!T("DEA"),
CaseSensitive.no) == 0);
assert(indexOfAny(to!S("def"), to!T("FBI"), CaseSensitive.no) == 2);
assert(indexOfAny(to!S("dfefffg"), to!T("NSA"), CaseSensitive.no)
== -1);
assert(indexOfAny(to!S("dfeffgfff"), to!T("BND"),
CaseSensitive.no) == 0);
assert(indexOfAny(to!S("dfeffgfff"), to!T("BNDabCHIJKQEPÖÖSYXÄ??ß"),
CaseSensitive.no) == 0);
assert(indexOfAny("\u0100", to!T("\u0100"), CaseSensitive.no) == 0);
}();
}
}
);
}
/**
Returns the index of the first occurence of any of the elements in $(D
needles) in $(D haystack). If no element of $(D needles) is found,
then $(D -1) is returned. The $(D startIdx) slices $(D s) in the following
way $(D haystack[startIdx .. $]). $(D startIdx) represents a codeunit
index in $(D haystack). If the sequence ending at $(D startIdx) does not
represent a well formed codepoint, then a $(XREF utf,UTFException) may be
thrown.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
startIdx = slices haystack like this $(D haystack[startIdx .. $]). If
the startIdx is greater equal the length of haystack the functions
returns $(D -1).
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
if (startIdx < haystack.length)
{
ptrdiff_t foundIdx = indexOfAny(haystack[startIdx .. $], needles, cs);
if (foundIdx != -1)
{
return foundIdx + cast(ptrdiff_t)startIdx;
}
}
return -1;
}
///
@safe pure unittest
{
import std.conv : to;
ptrdiff_t i = "helloWorld".indexOfAny("Wr", 4);
assert(i == 5);
i = "Foo öällo world".indexOfAny("lh", 3);
assert(i == 8, to!string(i));
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOfAny(startIdx).unittest\n");
foreach(S; TypeTuple!(string, wstring, dstring))
{
foreach(T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(indexOfAny(cast(S)null, to!T("a"), 1337) == -1);
assert(indexOfAny(to!S("def"), to!T("AaF"), 0) == -1);
assert(indexOfAny(to!S("abba"), to!T("NSa"), 2) == 3);
assert(indexOfAny(to!S("def"), to!T("fbi"), 1) == 2);
assert(indexOfAny(to!S("dfefffg"), to!T("foo"), 2) == 3);
assert(indexOfAny(to!S("dfeffgfff"), to!T("fsb"), 5) == 6);
assert(indexOfAny(to!S("dfeffgfff"), to!T("NDS"), 1,
CaseSensitive.no) == -1);
assert(indexOfAny(to!S("def"), to!T("DRS"), 2,
CaseSensitive.no) == -1);
assert(indexOfAny(to!S("abba"), to!T("SI"), 3,
CaseSensitive.no) == -1);
assert(indexOfAny(to!S("deO"), to!T("ASIO"), 1,
CaseSensitive.no) == 2);
assert(indexOfAny(to!S("dfefffg"), to!T("fbh"), 2,
CaseSensitive.no) == 3);
assert(indexOfAny(to!S("dfeffgfff"), to!T("fEe"), 4,
CaseSensitive.no) == 4);
assert(indexOfAny(to!S("dfeffgffföä"), to!T("föä"), 9,
CaseSensitive.no) == 9);
assert(indexOfAny("\u0100", to!T("\u0100"), 0,
CaseSensitive.no) == 0);
}();
foreach(cs; EnumMembers!CaseSensitive)
{
assert(indexOfAny("hello\U00010143\u0100\U00010143",
to!S("e\u0100"), 3, cs) == 9);
assert(indexOfAny("hello\U00010143\u0100\U00010143"w,
to!S("h\u0100"), 3, cs) == 7);
assert(indexOfAny("hello\U00010143\u0100\U00010143"d,
to!S("l\u0100"), 5, cs) == 6);
}
}
}
/**
Returns the index of the last occurence of any of the elements in $(D
needles) in $(D haystack). If no element of $(D needles) is found,
then $(D -1) is returned.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
return indexOfAnyNeitherImpl!(false, true)(haystack, needles, cs);
}
///
@safe pure unittest
{
ptrdiff_t i = "helloWorld".lastIndexOfAny("Wlo");
assert(i == 8);
i = "Foo öäöllo world".lastIndexOfAny("öF");
assert(i == 8);
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOfAny.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(lastIndexOfAny(cast(S)null, to!T("a")) == -1);
assert(lastIndexOfAny(to!S("def"), to!T("rsa")) == -1);
assert(lastIndexOfAny(to!S("abba"), to!T("a")) == 3);
assert(lastIndexOfAny(to!S("def"), to!T("f")) == 2);
assert(lastIndexOfAny(to!S("dfefffg"), to!T("fgh")) == 6);
ptrdiff_t oeIdx = 9;
if (is(S == wstring) || is(S == dstring))
{
oeIdx = 8;
}
auto foundOeIdx = lastIndexOfAny(to!S("dfeffgföf"), to!T("feg"));
assert(foundOeIdx == oeIdx, to!string(foundOeIdx));
assert(lastIndexOfAny(to!S("zfeffgfff"), to!T("ACDC"),
CaseSensitive.no) == -1);
assert(lastIndexOfAny(to!S("def"), to!T("MI6"),
CaseSensitive.no) == -1);
assert(lastIndexOfAny(to!S("abba"), to!T("DEA"),
CaseSensitive.no) == 3);
assert(lastIndexOfAny(to!S("def"), to!T("FBI"),
CaseSensitive.no) == 2);
assert(lastIndexOfAny(to!S("dfefffg"), to!T("NSA"),
CaseSensitive.no) == -1);
oeIdx = 2;
if (is(S == wstring) || is(S == dstring))
{
oeIdx = 1;
}
assert(lastIndexOfAny(to!S("ödfeffgfff"), to!T("BND"),
CaseSensitive.no) == oeIdx);
assert(lastIndexOfAny("\u0100", to!T("\u0100"),
CaseSensitive.no) == 0);
}();
}
}
);
}
/**
Returns the index of the last occurence of any of the elements in $(D
needles) in $(D haystack). If no element of $(D needles) is found,
then $(D -1) is returned. The $(D stopIdx) slices $(D s) in the following
way $(D s[0 .. stopIdx]). $(D stopIdx) represents a codeunit index in
$(D s). If the sequence ending at $(D startIdx) does not represent a well
formed codepoint, then a $(XREF utf,UTFException) may be thrown.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]). If
the stopIdx is greater equal the length of haystack the functions
returns $(D -1).
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
const(Char2)[] needles, in size_t stopIdx,
in CaseSensitive cs = CaseSensitive.yes) @safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
if (stopIdx <= haystack.length)
{
return lastIndexOfAny(haystack[0u .. stopIdx], needles, cs);
}
return -1;
}
///
@safe pure unittest
{
import std.conv : to;
ptrdiff_t i = "helloWorld".lastIndexOfAny("Wlo", 4);
assert(i == 3);
i = "Foo öäöllo world".lastIndexOfAny("öF", 3);
assert(i == 0);
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOfAny(index).unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
enum typeStr = S.stringof ~ " " ~ T.stringof;
assert(lastIndexOfAny(cast(S)null, to!T("a"), 1337) == -1,
typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("c"), 7) == 6,
typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("cd"), 5) == 3,
typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("ef"), 6) == 5,
typeStr);
assert(lastIndexOfAny(to!S("abcdefCdef"), to!T("c"), 8) == 2,
typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("x"), 7) == -1,
typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("xy"), 4) == -1,
typeStr);
assert(lastIndexOfAny(to!S("öabcdefcdef"), to!T("ö"), 2) == 0,
typeStr);
assert(lastIndexOfAny(cast(S)null, to!T("a"), 1337,
CaseSensitive.no) == -1, typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("C"), 7,
CaseSensitive.no) == 6, typeStr);
assert(lastIndexOfAny(to!S("ABCDEFCDEF"), to!T("cd"), 5,
CaseSensitive.no) == 3, typeStr);
assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("EF"), 6,
CaseSensitive.no) == 5, typeStr);
assert(lastIndexOfAny(to!S("ABCDEFcDEF"), to!T("C"), 8,
CaseSensitive.no) == 6, typeStr);
assert(lastIndexOfAny(to!S("ABCDEFCDEF"), to!T("x"), 7,
CaseSensitive.no) == -1, typeStr);
assert(lastIndexOfAny(to!S("abCdefcdef"), to!T("XY"), 4,
CaseSensitive.no) == -1, typeStr);
assert(lastIndexOfAny(to!S("ÖABCDEFCDEF"), to!T("ö"), 2,
CaseSensitive.no) == 0, typeStr);
}();
}
}
);
}
/**
Returns the index of the first occurence of any character not an elements
in $(D needles) in $(D haystack). If all element of $(D haystack) are
element of $(D needles) $(D -1) is returned.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack,
const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes)
@safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
return indexOfAnyNeitherImpl!(true, false)(haystack, needles, cs);
}
///
@safe pure unittest
{
assert(indexOfNeither("def", "a") == 0);
assert(indexOfNeither("def", "de") == 2);
assert(indexOfNeither("dfefffg", "dfe") == 6);
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOf.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(indexOfNeither(cast(S)null, to!T("a")) == -1);
assert(indexOfNeither("abba", "a") == 1);
assert(indexOfNeither(to!S("dfeffgfff"), to!T("a"),
CaseSensitive.no) == 0);
assert(indexOfNeither(to!S("def"), to!T("D"),
CaseSensitive.no) == 1);
assert(indexOfNeither(to!S("ABca"), to!T("a"),
CaseSensitive.no) == 1);
assert(indexOfNeither(to!S("def"), to!T("f"),
CaseSensitive.no) == 0);
assert(indexOfNeither(to!S("DfEfffg"), to!T("dFe"),
CaseSensitive.no) == 6);
if (is(S == string))
{
assert(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"),
CaseSensitive.no) == 8,
to!string(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"),
CaseSensitive.no)));
}
else
{
assert(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"),
CaseSensitive.no) == 7,
to!string(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"),
CaseSensitive.no)));
}
}();
}
}
);
}
/**
Returns the index of the first occurence of any character not an elements
in $(D needles) in $(D haystack). If all element of $(D haystack) are
element of $(D needles) $(D -1) is returned.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
startIdx = slices haystack like this $(D haystack[startIdx .. $]). If
the startIdx is greater equal the length of haystack the functions
returns $(D -1).
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack,
const(Char2)[] needles, in size_t startIdx,
in CaseSensitive cs = CaseSensitive.yes)
@safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
if (startIdx < haystack.length)
{
ptrdiff_t foundIdx = indexOfAnyNeitherImpl!(true, false)(
haystack[startIdx .. $], needles, cs);
if (foundIdx != -1)
{
return foundIdx + cast(ptrdiff_t)startIdx;
}
}
return -1;
}
///
@safe pure unittest
{
assert(indexOfNeither("abba", "a", 2) == 2);
assert(indexOfNeither("def", "de", 1) == 2);
assert(indexOfNeither("dfefffg", "dfe", 4) == 6);
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.indexOfNeither(index).unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(indexOfNeither(cast(S)null, to!T("a"), 1) == -1);
assert(indexOfNeither(to!S("def"), to!T("a"), 1) == 1,
to!string(indexOfNeither(to!S("def"), to!T("a"), 1)));
assert(indexOfNeither(to!S("dfeffgfff"), to!T("a"), 4,
CaseSensitive.no) == 4);
assert(indexOfNeither(to!S("def"), to!T("D"), 2,
CaseSensitive.no) == 2);
assert(indexOfNeither(to!S("ABca"), to!T("a"), 3,
CaseSensitive.no) == -1);
assert(indexOfNeither(to!S("def"), to!T("tzf"), 2,
CaseSensitive.no) == -1);
assert(indexOfNeither(to!S("DfEfffg"), to!T("dFe"), 5,
CaseSensitive.no) == 6);
if (is(S == string))
{
assert(indexOfNeither(to!S("öDfEfffg"), to!T("äDi"), 2,
CaseSensitive.no) == 3, to!string(indexOfNeither(
to!S("öDfEfffg"), to!T("äDi"), 2, CaseSensitive.no)));
}
else
{
assert(indexOfNeither(to!S("öDfEfffg"), to!T("äDi"), 2,
CaseSensitive.no) == 2, to!string(indexOfNeither(
to!S("öDfEfffg"), to!T("äDi"), 2, CaseSensitive.no)));
}
}();
}
}
);
}
/**
Returns the last index of the first occurence of any character that is not
an elements in $(D needles) in $(D haystack). If all element of
$(D haystack) are element of $(D needles) $(D -1) is returned.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack,
const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes)
@safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
return indexOfAnyNeitherImpl!(false, false)(haystack, needles, cs);
}
///
@safe pure unittest
{
assert(lastIndexOfNeither("abba", "a") == 2);
assert(lastIndexOfNeither("def", "f") == 1);
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOfNeither.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(lastIndexOfNeither(cast(S)null, to!T("a")) == -1);
assert(lastIndexOfNeither(to!S("def"), to!T("rsa")) == 2);
assert(lastIndexOfNeither(to!S("dfefffg"), to!T("fgh")) == 2);
ptrdiff_t oeIdx = 8;
if (is(S == string))
{
oeIdx = 9;
}
auto foundOeIdx = lastIndexOfNeither(to!S("ödfefegff"), to!T("zeg"));
assert(foundOeIdx == oeIdx, to!string(foundOeIdx));
assert(lastIndexOfNeither(to!S("zfeffgfsb"), to!T("FSB"),
CaseSensitive.no) == 5);
assert(lastIndexOfNeither(to!S("def"), to!T("MI6"),
CaseSensitive.no) == 2, to!string(lastIndexOfNeither(to!S("def"),
to!T("MI6"), CaseSensitive.no)));
assert(lastIndexOfNeither(to!S("abbadeafsb"), to!T("fSb"),
CaseSensitive.no) == 6, to!string(lastIndexOfNeither(
to!S("abbadeafsb"), to!T("fSb"), CaseSensitive.no)));
assert(lastIndexOfNeither(to!S("defbi"), to!T("FBI"),
CaseSensitive.no) == 1);
assert(lastIndexOfNeither(to!S("dfefffg"), to!T("NSA"),
CaseSensitive.no) == 6);
assert(lastIndexOfNeither(to!S("dfeffgfffö"), to!T("BNDabCHIJKQEPÖÖSYXÄ??ß"),
CaseSensitive.no) == 8, to!string(lastIndexOfNeither(to!S("dfeffgfffö"),
to!T("BNDabCHIJKQEPÖÖSYXÄ??ß"), CaseSensitive.no)));
}();
}
}
);
}
/**
Returns the last index of the first occurence of any character that is not
an elements in $(D needles) in $(D haystack). If all element of
$(D haystack) are element of $(D needles) $(D -1) is returned.
Params:
haystack = String to search for needles in.
needles = Strings to search for in haystack.
stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]) If
the stopIdx is greater equal the length of haystack the functions
returns $(D -1).
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack,
const(Char2)[] needles, in size_t stopIdx,
in CaseSensitive cs = CaseSensitive.yes)
@safe pure
if (isSomeChar!Char && isSomeChar!Char2)
{
if (stopIdx < haystack.length)
{
return indexOfAnyNeitherImpl!(false, false)(haystack[0 .. stopIdx],
needles, cs);
}
return -1;
}
///
@safe pure unittest
{
assert(lastIndexOfNeither("def", "rsa", 3) == -1);
assert(lastIndexOfNeither("abba", "a", 2) == 1);
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.lastIndexOfNeither(index).unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
foreach (T; TypeTuple!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(lastIndexOfNeither(cast(S)null, to!T("a"), 1337) == -1);
assert(lastIndexOfNeither(to!S("def"), to!T("f")) == 1);
assert(lastIndexOfNeither(to!S("dfefffg"), to!T("fgh")) == 2);
ptrdiff_t oeIdx = 4;
if (is(S == string))
{
oeIdx = 5;
}
auto foundOeIdx = lastIndexOfNeither(to!S("ödfefegff"), to!T("zeg"),
7);
assert(foundOeIdx == oeIdx, to!string(foundOeIdx));
assert(lastIndexOfNeither(to!S("zfeffgfsb"), to!T("FSB"), 6,
CaseSensitive.no) == 5);
assert(lastIndexOfNeither(to!S("def"), to!T("MI6"), 2,
CaseSensitive.no) == 1, to!string(lastIndexOfNeither(to!S("def"),
to!T("MI6"), 2, CaseSensitive.no)));
assert(lastIndexOfNeither(to!S("abbadeafsb"), to!T("fSb"), 6,
CaseSensitive.no) == 5, to!string(lastIndexOfNeither(
to!S("abbadeafsb"), to!T("fSb"), 6, CaseSensitive.no)));
assert(lastIndexOfNeither(to!S("defbi"), to!T("FBI"), 3,
CaseSensitive.no) == 1);
assert(lastIndexOfNeither(to!S("dfefffg"), to!T("NSA"), 2,
CaseSensitive.no) == 1, to!string(lastIndexOfNeither(
to!S("dfefffg"), to!T("NSA"), 2, CaseSensitive.no)));
}();
}
}
);
}
/**
* Returns the representation of a string, which has the same type
* as the string except the character type is replaced by $(D ubyte),
* $(D ushort), or $(D uint) depending on the character width.
*/
auto representation(Char)(Char[] s) @safe pure nothrow @nogc
if (isSomeChar!Char)
{
alias ToRepType(T) = TypeTuple!(ubyte, ushort, uint)[T.sizeof / 2];
return cast(ModifyTypePreservingSTC!(ToRepType, Char)[])s;
}
///
@safe pure unittest
{
string s = "hello";
static assert(is(typeof(representation(s)) == immutable(ubyte)[]));
assert(representation(s) is cast(immutable(ubyte)[]) s);
assert(representation(s) == [0x68, 0x65, 0x6c, 0x6c, 0x6f]);
}
@trusted pure unittest
{
import std.exception;
import std.typecons;
assertCTFEable!(
{
void test(Char, T)(Char[] str)
{
static assert(is(typeof(representation(str)) == T[]));
assert(representation(str) is cast(T[]) str);
}
foreach (Type; TypeTuple!(Tuple!(char , ubyte ),
Tuple!(wchar, ushort),
Tuple!(dchar, uint )))
{
alias Char = FieldTypeTuple!Type[0];
alias Int = FieldTypeTuple!Type[1];
enum immutable(Char)[] hello = "hello";
test!( immutable Char, immutable Int)(hello);
test!( const Char, const Int)(hello);
test!( Char, Int)(hello.dup);
test!( shared Char, shared Int)(cast(shared) hello.dup);
test!(const shared Char, const shared Int)(hello);
}
});
}
/++
Capitalize the first character of $(D s) and convert the rest of $(D s)
to lowercase.
+/
S capitalize(S)(S s) @trusted pure
if (isSomeString!S)
{
import std.utf : encode;
Unqual!(typeof(s[0]))[] retval;
bool changed = false;
foreach (i, dchar c; s)
{
dchar c2;
if (i == 0)
{
c2 = std.uni.toUpper(c);
if (c != c2)
changed = true;
}
else
{
c2 = std.uni.toLower(c);
if (c != c2)
{
if (!changed)
{
changed = true;
retval = s[0 .. i].dup;
}
}
}
if (changed)
std.utf.encode(retval, c2);
}
return changed ? cast(S)retval : s;
}
@trusted pure unittest
{
import std.conv : to;
import std.algorithm : cmp;
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring, char[], wchar[], dchar[]))
{
S s1 = to!S("FoL");
S s2;
s2 = capitalize(s1);
assert(cmp(s2, "Fol") == 0);
assert(s2 !is s1);
s2 = capitalize(s1[0 .. 2]);
assert(cmp(s2, "Fo") == 0);
assert(s2.ptr == s1.ptr);
s1 = to!S("fOl");
s2 = capitalize(s1);
assert(cmp(s2, "Fol") == 0);
assert(s2 !is s1);
s1 = to!S("\u0131 \u0130");
s2 = capitalize(s1);
assert(cmp(s2, "\u0049 \u0069") == 0);
assert(s2 !is s1);
s1 = to!S("\u017F \u0049");
s2 = capitalize(s1);
assert(cmp(s2, "\u0053 \u0069") == 0);
assert(s2 !is s1);
}
});
}
/++
Split $(D s) into an array of lines according to the unicode standard using
$(D '\r'), $(D '\n'), $(D "\r\n"), $(XREF uni, lineSep),
$(XREF uni, paraSep), $(D U+0085) (NEL), $(D '\v') and $(D '\f')
as delimiters. If $(D keepTerm) is set to $(D KeepTerminator.yes), then the
delimiter is included in the strings returned.
Does not throw on invalid UTF; such is simply passed unchanged
to the output.
Allocates memory; use $(LREF lineSplitter) for an alternative that
does not.
Adheres to $(WEB http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf, Unicode 7.0).
Params:
s = a string of $(D chars), $(D wchars), or $(D dchars)
keepTerm = whether delimiter is included or not in the results
Returns:
array of strings, each element is a line that is a slice of $(D s)
See_Also:
$(LREF lineSplitter)
$(XREF algorithm, splitter)
$(XREF regex, splitter)
+/
alias KeepTerminator = Flag!"keepTerminator";
/// ditto
S[] splitLines(S)(S s, in KeepTerminator keepTerm = KeepTerminator.no) @safe pure
if (isSomeString!S)
{
import std.uni : lineSep, paraSep;
import std.array : appender;
size_t iStart = 0;
auto retval = appender!(S[])();
for (size_t i; i < s.length; ++i)
{
switch (s[i])
{
case '\v', '\f', '\n':
retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes)]);
iStart = i + 1;
break;
case '\r':
if (i + 1 < s.length && s[i + 1] == '\n')
{
retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes) * 2]);
iStart = i + 2;
++i;
}
else
{
goto case '\n';
}
break;
static if (s[i].sizeof == 1)
{
/* Manually decode:
* lineSep is E2 80 A8
* paraSep is E2 80 A9
*/
case 0xE2:
if (i + 2 < s.length &&
s[i + 1] == 0x80 &&
(s[i + 2] == 0xA8 || s[i + 2] == 0xA9)
)
{
retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes) * 3]);
iStart = i + 3;
i += 2;
}
else
goto default;
break;
/* Manually decode:
* NEL is C2 85
*/
case 0xC2:
if(i + 1 < s.length && s[i + 1] == 0x85)
{
retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes) * 2]);
iStart = i + 2;
i += 1;
}
else
goto default;
break;
}
else
{
case lineSep:
case paraSep:
case '\u0085':
goto case '\n';
}
default:
break;
}
}
if (iStart != s.length)
retval.put(s[iStart .. $]);
return retval.data;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.splitLines.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
auto s = to!S(
"\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\nsunday\n" ~
"mon\u2030day\nschadenfreude\vkindergarten\f\vcookies\u0085"
);
auto lines = splitLines(s);
assert(lines.length == 14);
assert(lines[0] == "");
assert(lines[1] == "peter");
assert(lines[2] == "");
assert(lines[3] == "paul");
assert(lines[4] == "jerry");
assert(lines[5] == "ice");
assert(lines[6] == "cream");
assert(lines[7] == "");
assert(lines[8] == "sunday");
assert(lines[9] == "mon\u2030day");
assert(lines[10] == "schadenfreude");
assert(lines[11] == "kindergarten");
assert(lines[12] == "");
assert(lines[13] == "cookies");
ubyte[] u = ['a', 0xFF, 0x12, 'b']; // invalid UTF
auto ulines = splitLines(cast(char[])u);
assert(cast(ubyte[])(ulines[0]) == u);
lines = splitLines(s, KeepTerminator.yes);
assert(lines.length == 14);
assert(lines[0] == "\r");
assert(lines[1] == "peter\n");
assert(lines[2] == "\r");
assert(lines[3] == "paul\r\n");
assert(lines[4] == "jerry\u2028");
assert(lines[5] == "ice\u2029");
assert(lines[6] == "cream\n");
assert(lines[7] == "\n");
assert(lines[8] == "sunday\n");
assert(lines[9] == "mon\u2030day\n");
assert(lines[10] == "schadenfreude\v");
assert(lines[11] == "kindergarten\f");
assert(lines[12] == "\v");
assert(lines[13] == "cookies\u0085");
s.popBack(); // Lop-off trailing \n
lines = splitLines(s);
assert(lines.length == 14);
assert(lines[9] == "mon\u2030day");
lines = splitLines(s, KeepTerminator.yes);
assert(lines.length == 14);
assert(lines[13] == "cookies");
}
});
}
/***********************************
* Split an array or slicable range of characters into a range of lines
using $(D '\r'), $(D '\n'), $(D '\v'), $(D '\f'), $(D "\r\n"),
$(XREF uni, lineSep), $(XREF uni, paraSep) and $(D '\u0085') (NEL)
as delimiters. If $(D keepTerm) is set to $(D KeepTerminator.yes), then the
delimiter is included in the slices returned.
Does not throw on invalid UTF; such is simply passed unchanged
to the output.
Adheres to $(WEB http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf, Unicode 7.0).
Does not allocate memory.
Params:
r = array of $(D chars), $(D wchars), or $(D dchars) or a slicable range
keepTerm = whether delimiter is included or not in the results
Returns:
range of slices of the input range $(D r)
See_Also:
$(LREF splitLines)
$(XREF algorithm, splitter)
$(XREF regex, splitter)
*/
auto lineSplitter(KeepTerminator keepTerm = KeepTerminator.no, Range)(Range r)
if ((hasSlicing!Range && hasLength!Range) ||
isSomeString!Range)
{
import std.uni : lineSep, paraSep;
import std.conv : unsigned;
static struct Result
{
private:
Range _input;
alias IndexType = typeof(unsigned(_input.length));
enum IndexType _unComputed = IndexType.max;
IndexType iStart = _unComputed;
IndexType iEnd = 0;
IndexType iNext = 0;
public:
this(Range input)
{
_input = input;
}
static if (isInfinite!Range)
{
enum bool empty = false;
}
else
{
@property bool empty()
{
return iStart == _unComputed && iNext == _input.length;
}
}
@property Range front()
{
if (iStart == _unComputed)
{
iStart = iNext;
Loop:
for (IndexType i = iNext; ; ++i)
{
if (i == _input.length)
{
iEnd = i;
iNext = i;
break Loop;
}
switch (_input[i])
{
case '\v', '\f', '\n':
iEnd = i + (keepTerm == KeepTerminator.yes);
iNext = i + 1;
break Loop;
case '\r':
if (i + 1 < _input.length && _input[i + 1] == '\n')
{
iEnd = i + (keepTerm == KeepTerminator.yes) * 2;
iNext = i + 2;
break Loop;
}
else
{
goto case '\n';
}
static if (_input[i].sizeof == 1)
{
/* Manually decode:
* lineSep is E2 80 A8
* paraSep is E2 80 A9
*/
case 0xE2:
if (i + 2 < _input.length &&
_input[i + 1] == 0x80 &&
(_input[i + 2] == 0xA8 || _input[i + 2] == 0xA9)
)
{
iEnd = i + (keepTerm == KeepTerminator.yes) * 3;
iNext = i + 3;
break Loop;
}
else
goto default;
/* Manually decode:
* NEL is C2 85
*/
case 0xC2:
if(i + 1 < _input.length && _input[i + 1] == 0x85)
{
iEnd = i + (keepTerm == KeepTerminator.yes) * 2;
iNext = i + 2;
break Loop;
}
else
goto default;
}
else
{
case '\u0085':
case lineSep:
case paraSep:
goto case '\n';
}
default:
break;
}
}
}
return _input[iStart .. iEnd];
}
void popFront()
{
if (iStart == _unComputed)
{
assert(!empty);
front();
}
iStart = _unComputed;
}
static if (isForwardRange!Range)
{
@property typeof(this) save()
{
auto ret = this;
ret._input = _input.save;
return ret;
}
}
}
return Result(r);
}
@safe pure unittest
{
import std.conv : to;
import std.array : array;
debug(string) trustedPrintf("string.lineSplitter.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
auto s = to!S(
"\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\n" ~
"sunday\nmon\u2030day\nschadenfreude\vkindergarten\f\vcookies\u0085"
);
auto lines = lineSplitter(s).array;
assert(lines.length == 14);
assert(lines[0] == "");
assert(lines[1] == "peter");
assert(lines[2] == "");
assert(lines[3] == "paul");
assert(lines[4] == "jerry");
assert(lines[5] == "ice");
assert(lines[6] == "cream");
assert(lines[7] == "");
assert(lines[8] == "sunday");
assert(lines[9] == "mon\u2030day");
assert(lines[10] == "schadenfreude");
assert(lines[11] == "kindergarten");
assert(lines[12] == "");
assert(lines[13] == "cookies");
ubyte[] u = ['a', 0xFF, 0x12, 'b']; // invalid UTF
auto ulines = lineSplitter(cast(char[])u).array;
assert(cast(ubyte[])(ulines[0]) == u);
lines = lineSplitter!(KeepTerminator.yes)(s).array;
assert(lines.length == 14);
assert(lines[0] == "\r");
assert(lines[1] == "peter\n");
assert(lines[2] == "\r");
assert(lines[3] == "paul\r\n");
assert(lines[4] == "jerry\u2028");
assert(lines[5] == "ice\u2029");
assert(lines[6] == "cream\n");
assert(lines[7] == "\n");
assert(lines[8] == "sunday\n");
assert(lines[9] == "mon\u2030day\n");
assert(lines[10] == "schadenfreude\v");
assert(lines[11] == "kindergarten\f");
assert(lines[12] == "\v");
assert(lines[13] == "cookies\u0085");
s.popBack(); // Lop-off trailing \n
lines = lineSplitter(s).array;
assert(lines.length == 14);
assert(lines[9] == "mon\u2030day");
lines = lineSplitter!(KeepTerminator.yes)(s).array;
assert(lines.length == 14);
assert(lines[13] == "cookies");
}
});
}
///
@nogc @safe pure unittest
{
auto s = "\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\nsunday\nmon\u2030day\n";
auto lines = s.lineSplitter();
static immutable witness = ["", "peter", "", "paul", "jerry", "ice", "cream", "", "sunday", "mon\u2030day"];
uint i;
foreach (line; lines)
{
assert(line == witness[i++]);
}
assert(i == witness.length);
}
/++
Strips leading whitespace (as defined by $(XREF uni, isWhite)).
Returns: $(D str) stripped of leading whitespace.
Postconditions: $(D str) and the returned value
will share the same tail (see $(XREF array, sameTail)).
+/
C[] stripLeft(C)(C[] str) @safe pure @nogc
if (isSomeChar!C)
{
foreach (i, dchar c; str)
{
if (!std.uni.isWhite(c))
return str[i .. $];
}
return str[$ .. $]; //Empty string with correct type.
}
///
@safe pure unittest
{
import std.uni : lineSep, paraSep;
assert(stripLeft(" hello world ") ==
"hello world ");
assert(stripLeft("\n\t\v\rhello world\n\t\v\r") ==
"hello world\n\t\v\r");
assert(stripLeft("hello world") ==
"hello world");
assert(stripLeft([lineSep] ~ "hello world" ~ lineSep) ==
"hello world" ~ [lineSep]);
assert(stripLeft([paraSep] ~ "hello world" ~ paraSep) ==
"hello world" ~ [paraSep]);
}
/++
Strips trailing whitespace (as defined by $(XREF uni, isWhite)).
Returns: $(D str) stripped of trailing whitespace.
Postconditions: $(D str) and the returned value
will share the same head (see $(XREF array, sameHead)).
+/
C[] stripRight(C)(C[] str) @safe pure @nogc
if (isSomeChar!C)
{
import std.utf : codeLength;
foreach_reverse (i, dchar c; str)
{
if (!std.uni.isWhite(c))
return str[0 .. i + codeLength!C(c)];
}
return str[0 .. 0];
}
///
@safe pure unittest
{
import std.uni : lineSep, paraSep;
assert(stripRight(" hello world ") ==
" hello world");
assert(stripRight("\n\t\v\rhello world\n\t\v\r") ==
"\n\t\v\rhello world");
assert(stripRight("hello world") ==
"hello world");
assert(stripRight([lineSep] ~ "hello world" ~ lineSep) ==
[lineSep] ~ "hello world");
assert(stripRight([paraSep] ~ "hello world" ~ paraSep) ==
[paraSep] ~ "hello world");
}
/++
Strips both leading and trailing whitespace (as defined by
$(XREF uni, isWhite)).
Returns: $(D str) stripped of trailing whitespace.
+/
C[] strip(C)(C[] str) @safe pure
if (isSomeChar!C)
{
return stripRight(stripLeft(str));
}
///
@safe pure unittest
{
import std.uni : lineSep, paraSep;
assert(strip(" hello world ") ==
"hello world");
assert(strip("\n\t\v\rhello world\n\t\v\r") ==
"hello world");
assert(strip("hello world") ==
"hello world");
assert(strip([lineSep] ~ "hello world" ~ [lineSep]) ==
"hello world");
assert(strip([paraSep] ~ "hello world" ~ [paraSep]) ==
"hello world");
}
@safe pure unittest
{
import std.conv : to;
import std.algorithm : equal;
debug(string) trustedPrintf("string.strip.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!( char[], const char[], string,
wchar[], const wchar[], wstring,
dchar[], const dchar[], dstring))
{
assert(equal(stripLeft(to!S(" foo\t ")), "foo\t "));
assert(equal(stripLeft(to!S("\u2008 foo\t \u2007")), "foo\t \u2007"));
assert(equal(stripLeft(to!S("\u0085 μ \u0085 \u00BB \r")), "μ \u0085 \u00BB \r"));
assert(equal(stripLeft(to!S("1")), "1"));
assert(equal(stripLeft(to!S("\U0010FFFE")), "\U0010FFFE"));
assert(equal(stripLeft(to!S("")), ""));
assert(equal(stripRight(to!S(" foo\t ")), " foo"));
assert(equal(stripRight(to!S("\u2008 foo\t \u2007")), "\u2008 foo"));
assert(equal(stripRight(to!S("\u0085 μ \u0085 \u00BB \r")), "\u0085 μ \u0085 \u00BB"));
assert(equal(stripRight(to!S("1")), "1"));
assert(equal(stripRight(to!S("\U0010FFFE")), "\U0010FFFE"));
assert(equal(stripRight(to!S("")), ""));
assert(equal(strip(to!S(" foo\t ")), "foo"));
assert(equal(strip(to!S("\u2008 foo\t \u2007")), "foo"));
assert(equal(strip(to!S("\u0085 μ \u0085 \u00BB \r")), "μ \u0085 \u00BB"));
assert(equal(strip(to!S("\U0010FFFE")), "\U0010FFFE"));
assert(equal(strip(to!S("")), ""));
}
});
}
@safe pure unittest
{
import std.exception;
import std.range;
assertCTFEable!(
{
wstring s = " ";
assert(s.sameTail(s.stripLeft()));
assert(s.sameHead(s.stripRight()));
});
}
/++
If $(D str) ends with $(D delimiter), then $(D str) is returned without
$(D delimiter) on its end. If it $(D str) does $(I not) end with
$(D delimiter), then it is returned unchanged.
If no $(D delimiter) is given, then one trailing $(D '\r'), $(D '\n'),
$(D "\r\n"), $(D '\f'), $(D '\v'), $(XREF uni, lineSep), $(XREF uni, paraSep), or $(XREF uni, nelSep)
is removed from the end of $(D str). If $(D str) does not end with any of those characters,
then it is returned unchanged.
Params:
str = string or indexable range of characters
delimiter = string of characters to be sliced off end of str[]
Returns:
slice of str
+/
Range chomp(Range)(Range str)
if (isRandomAccessRange!Range && isSomeChar!(ElementEncodingType!Range) ||
isSomeString!Range)
{
import std.uni : lineSep, paraSep, nelSep;
if (str.empty)
return str;
alias C = ElementEncodingType!Range;
switch (str[$ - 1])
{
case '\n':
{
if (str.length > 1 && str[$ - 2] == '\r')
return str[0 .. $ - 2];
goto case;
}
case '\r', '\v', '\f':
return str[0 .. $ - 1];
// Pop off the last character if lineSep, paraSep, or nelSep
static if (is(C : const char))
{
/* Manually decode:
* lineSep is E2 80 A8
* paraSep is E2 80 A9
*/
case 0xA8: // Last byte of lineSep
case 0xA9: // Last byte of paraSep
if (str.length > 2 && str[$ - 2] == 0x80 && str[$ - 3] == 0xE2)
return str [0 .. $ - 3];
goto default;
/* Manually decode:
* NEL is C2 85
*/
case 0x85:
if (str.length > 1 && str[$ - 2] == 0xC2)
return str [0 .. $ - 2];
goto default;
}
else
{
case lineSep:
case paraSep:
case nelSep:
return str[0 .. $ - 1];
}
default:
return str;
}
}
/// Ditto
Range chomp(Range, C2)(Range str, const(C2)[] delimiter)
if ((isRandomAccessRange!Range && isSomeChar!(ElementEncodingType!Range) ||
isSomeString!Range) &&
isSomeChar!C2)
{
if (delimiter.empty)
return chomp(str);
alias C1 = ElementEncodingType!Range;
static if (is(Unqual!C1 == Unqual!C2))
{
import std.algorithm : endsWith;
if (str.endsWith(delimiter))
return str[0 .. $ - delimiter.length];
return str;
}
else
{
auto orig = str;
static if (isSomeString!Range)
alias C = dchar; // because strings auto-decode
else
alias C = C1; // and ranges do not
foreach_reverse (C c; delimiter)
{
if (str.empty || str.back != c)
return orig;
str.popBack();
}
return str;
}
}
///
@safe pure unittest
{
import std.utf : decode;
import std.uni : lineSep, paraSep, nelSep;
assert(chomp(" hello world \n\r") == " hello world \n");
assert(chomp(" hello world \r\n") == " hello world ");
assert(chomp(" hello world \f") == " hello world ");
assert(chomp(" hello world \v") == " hello world ");
assert(chomp(" hello world \n\n") == " hello world \n");
assert(chomp(" hello world \n\n ") == " hello world \n\n ");
assert(chomp(" hello world \n\n" ~ [lineSep]) == " hello world \n\n");
assert(chomp(" hello world \n\n" ~ [paraSep]) == " hello world \n\n");
assert(chomp(" hello world \n\n" ~ [ nelSep]) == " hello world \n\n");
assert(chomp(" hello world") == " hello world");
assert(chomp("") == "");
assert(chomp(" hello world", "orld") == " hello w");
assert(chomp(" hello world", " he") == " hello world");
assert(chomp("", "hello") == "");
// Don't decode pointlessly
assert(chomp("hello\xFE", "\r") == "hello\xFE");
}
unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.chomp.unittest\n");
string s;
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
// @@@ BUG IN COMPILER, MUST INSERT CAST
assert(chomp(cast(S)null) is null);
assert(chomp(to!S("hello")) == "hello");
assert(chomp(to!S("hello\n")) == "hello");
assert(chomp(to!S("hello\r")) == "hello");
assert(chomp(to!S("hello\r\n")) == "hello");
assert(chomp(to!S("hello\n\r")) == "hello\n");
assert(chomp(to!S("hello\n\n")) == "hello\n");
assert(chomp(to!S("hello\r\r")) == "hello\r");
assert(chomp(to!S("hello\nxxx\n")) == "hello\nxxx");
assert(chomp(to!S("hello\u2028")) == "hello");
assert(chomp(to!S("hello\u2029")) == "hello");
assert(chomp(to!S("hello\u0085")) == "hello");
assert(chomp(to!S("hello\u2028\u2028")) == "hello\u2028");
assert(chomp(to!S("hello\u2029\u2029")) == "hello\u2029");
assert(chomp(to!S("hello\u2029\u2129")) == "hello\u2029\u2129");
assert(chomp(to!S("hello\u2029\u0185")) == "hello\u2029\u0185");
foreach (T; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
// @@@ BUG IN COMPILER, MUST INSERT CAST
assert(chomp(cast(S)null, cast(T)null) is null);
assert(chomp(to!S("hello\n"), cast(T)null) == "hello");
assert(chomp(to!S("hello"), to!T("o")) == "hell");
assert(chomp(to!S("hello"), to!T("p")) == "hello");
// @@@ BUG IN COMPILER, MUST INSERT CAST
assert(chomp(to!S("hello"), cast(T) null) == "hello");
assert(chomp(to!S("hello"), to!T("llo")) == "he");
assert(chomp(to!S("\uFF28ello"), to!T("llo")) == "\uFF28e");
assert(chomp(to!S("\uFF28el\uFF4co"), to!T("l\uFF4co")) == "\uFF28e");
}();
}
});
// Ranges
import std.utf : byChar, byWchar, byDchar;
import std.array;
assert(chomp("hello world\r\n" .byChar ).array == "hello world");
assert(chomp("hello world\r\n"w.byWchar).array == "hello world"w);
assert(chomp("hello world\r\n"d.byDchar).array == "hello world"d);
assert(chomp("hello world"d.byDchar, "ld").array == "hello wor"d);
}
/++
If $(D str) starts with $(D delimiter), then the part of $(D str) following
$(D delimiter) is returned. If it $(D str) does $(I not) start with
$(D delimiter), then it is returned unchanged.
+/
C1[] chompPrefix(C1, C2)(C1[] str, C2[] delimiter) @safe pure
if (isSomeChar!C1 && isSomeChar!C2)
{
static if (is(Unqual!C1 == Unqual!C2))
{
import std.algorithm : startsWith;
if (str.startsWith(delimiter))
return str[delimiter.length .. $];
return str;
}
else
{
import std.utf : decode;
auto orig = str;
size_t index = 0;
foreach (dchar c; delimiter)
{
if (index >= str.length || decode(str, index) != c)
return orig;
}
return str[index .. $];
}
}
///
@safe pure unittest
{
assert(chompPrefix("hello world", "he") == "llo world");
assert(chompPrefix("hello world", "hello w") == "orld");
assert(chompPrefix("hello world", " world") == "hello world");
assert(chompPrefix("", "hello") == "");
}
/* @safe */ pure unittest
{
import std.conv : to;
import std.algorithm : equal;
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
foreach (T; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(equal(chompPrefix(to!S("abcdefgh"), to!T("abcde")), "fgh"));
assert(equal(chompPrefix(to!S("abcde"), to!T("abcdefgh")), "abcde"));
assert(equal(chompPrefix(to!S("\uFF28el\uFF4co"), to!T("\uFF28el\uFF4co")), ""));
assert(equal(chompPrefix(to!S("\uFF28el\uFF4co"), to!T("\uFF28el")), "\uFF4co"));
assert(equal(chompPrefix(to!S("\uFF28el"), to!T("\uFF28el\uFF4co")), "\uFF28el"));
}();
}
});
}
/++
Returns $(D str) without its last character, if there is one. If $(D str)
ends with $(D "\r\n"), then both are removed. If $(D str) is empty, then
then it is returned unchanged.
+/
S chop(S)(S str) @safe pure
if (isSomeString!S)
{
if (str.empty)
return str;
if (str.length >= 2 && str[$ - 1] == '\n' && str[$ - 2] == '\r')
return str[0 .. $ - 2];
str.popBack();
return str;
}
///
@safe pure unittest
{
assert(chop("hello world") == "hello worl");
assert(chop("hello world\n") == "hello world");
assert(chop("hello world\r") == "hello world");
assert(chop("hello world\n\r") == "hello world\n");
assert(chop("hello world\r\n") == "hello world");
assert(chop("Walter Bright") == "Walter Brigh");
assert(chop("") == "");
}
unittest
{
import std.conv : to;
import std.algorithm : equal;
debug(string) trustedPrintf("string.chop.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
assert(chop(cast(S) null) is null);
assert(equal(chop(to!S("hello")), "hell"));
assert(equal(chop(to!S("hello\r\n")), "hello"));
assert(equal(chop(to!S("hello\n\r")), "hello\n"));
assert(equal(chop(to!S("Verité")), "Verit"));
assert(equal(chop(to!S(`さいごの果実`)), "さいごの果"));
assert(equal(chop(to!S(`ミツバチと科学者`)), "ミツバチと科学"));
}
});
}
/++
Left justify $(D s) in a field $(D width) characters wide. $(D fillChar)
is the character that will be used to fill up the space in the field that
$(D s) doesn't fill.
+/
S leftJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
if (isSomeString!S)
{
import std.utf : canSearchInCodeUnits;
import std.conv : to;
alias C = ElementEncodingType!S;
if (canSearchInCodeUnits!C(fillChar))
{
immutable len = s.walkLength();
if (len >= width)
return s;
auto retval = new Unqual!(C)[width - len + s.length];
retval[0 .. s.length] = s[];
retval[s.length .. $] = cast(C)fillChar;
return cast(S)retval;
}
else
{
auto dstr = to!dstring(s);
if (dstr.length >= width)
return s;
auto retval = new dchar[](width);
retval[0 .. dstr.length] = dstr[];
retval[dstr.length .. $] = fillChar;
return to!S(retval);
}
}
/++
Right justify $(D s) in a field $(D width) characters wide. $(D fillChar)
is the character that will be used to fill up the space in the field that
$(D s) doesn't fill.
+/
S rightJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
if (isSomeString!S)
{
import std.utf : canSearchInCodeUnits;
import std.conv : to;
alias C = ElementEncodingType!S;
if (canSearchInCodeUnits!C(fillChar))
{
immutable len = s.walkLength();
if (len >= width)
return s;
auto retval = new Unqual!C[width - len + s.length];
retval[0 .. $ - s.length] = cast(C)fillChar;
retval[$ - s.length .. $] = s[];
return cast(S)retval;
}
else
{
auto dstr = to!dstring(s);
if (dstr.length >= width)
return s;
auto retval = new dchar[](width);
retval[0 .. $ - dstr.length] = fillChar;
retval[$ - dstr.length .. $] = dstr[];
return to!S(retval);
}
}
/++
Center $(D s) in a field $(D width) characters wide. $(D fillChar)
is the character that will be used to fill up the space in the field that
$(D s) doesn't fill.
+/
S center(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
if (isSomeString!S)
{
import std.utf : canSearchInCodeUnits;
import std.conv : to;
alias C = ElementEncodingType!S;
if (canSearchInCodeUnits!C(fillChar))
{
immutable len = s.walkLength();
if (len >= width)
return s;
auto retval = new Unqual!C[width - len + s.length];
immutable left = (retval.length - s.length) / 2;
retval[0 .. left] = cast(C)fillChar;
retval[left .. left + s.length] = s[];
retval[left + s.length .. $] = cast(C)fillChar;
return to!S(retval);
}
else
{
auto dstr = to!dstring(s);
if (dstr.length >= width)
return s;
auto retval = new dchar[](width);
immutable left = (retval.length - dstr.length) / 2;
retval[0 .. left] = fillChar;
retval[left .. left + dstr.length] = dstr[];
retval[left + dstr.length .. $] = fillChar;
return to!S(retval);
}
}
@trusted pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.justify.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
S s = to!S("hello");
assert(leftJustify(s, 2) == "hello");
assert(rightJustify(s, 2) == "hello");
assert(center(s, 2) == "hello");
assert(leftJustify(s, 7) == "hello ");
assert(rightJustify(s, 7) == " hello");
assert(center(s, 7) == " hello ");
assert(leftJustify(s, 8) == "hello ");
assert(rightJustify(s, 8) == " hello");
assert(center(s, 8) == " hello ");
assert(leftJustify(s, 8, '\u0100') == "hello\u0100\u0100\u0100");
assert(rightJustify(s, 8, '\u0100') == "\u0100\u0100\u0100hello");
assert(center(s, 8, '\u0100') == "\u0100hello\u0100\u0100");
assert(leftJustify(s, 8, 'ö') == "helloööö");
assert(rightJustify(s, 8, 'ö') == "öööhello");
assert(center(s, 8, 'ö') == "öhelloöö");
}
});
}
/++
Replace each tab character in $(D s) with the number of spaces necessary
to align the following character at the next tab stop where $(D tabSize)
is the distance between tab stops.
+/
S detab(S)(S s, size_t tabSize = 8) @trusted pure
if (isSomeString!S)
{
import std.utf : encode;
import std.uni : lineSep, paraSep;
assert(tabSize > 0);
alias C = Unqual!(typeof(s[0]));
bool changes = false;
C[] result;
int column;
size_t nspaces;
foreach (size_t i, dchar c; s)
{
switch (c)
{
case '\t':
nspaces = tabSize - (column % tabSize);
if (!changes)
{
changes = true;
result = null;
result.length = s.length + nspaces - 1;
result.length = i + nspaces;
result[0 .. i] = s[0 .. i];
result[i .. i + nspaces] = ' ';
}
else
{
ptrdiff_t j = result.length;
result.length = j + nspaces;
result[j .. j + nspaces] = ' ';
}
column += nspaces;
break;
case '\r':
case '\n':
case paraSep:
case lineSep:
column = 0;
goto L1;
default:
column++;
L1:
if (changes)
{
std.utf.encode(result, c);
}
break;
}
}
return changes ? cast(S) result : s;
}
@trusted pure unittest
{
import std.conv : to;
import std.algorithm : cmp;
debug(string) trustedPrintf("string.detab.unittest\n");
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
{
S s = to!S("This \tis\t a fofof\tof list");
assert(cmp(detab(s), "This is a fofof of list") == 0);
assert(detab(cast(S)null) is null);
assert(detab("").empty);
assert(detab("a") == "a");
assert(detab("\t") == " ");
assert(detab("\t", 3) == " ");
assert(detab("\t", 9) == " ");
assert(detab( " ab\t asdf ") == " ab asdf ");
assert(detab( " \U00010000b\tasdf ") == " \U00010000b asdf ");
}
});
}
/++
Replaces spaces in $(D s) with the optimal number of tabs.
All spaces and tabs at the end of a line are removed.
Params:
s = String to convert.
tabSize = Tab columns are $(D tabSize) spaces apart.
+/
S entab(S)(S s, size_t tabSize = 8) @trusted pure
if (isSomeString!S)
{
import std.utf : encode;
import std.uni : lineSep, paraSep;
import std.exception : assumeUnique;
bool changes = false;
alias C = Unqual!(typeof(s[0]));
C[] result;
int nspaces = 0;
int nwhite = 0;
size_t column = 0; // column number
foreach (size_t i, dchar c; s)
{
void change()
{
changes = true;
result = null;
result.length = s.length;
result.length = i;
result[0 .. i] = s[0 .. i];
}
switch (c)
{
case '\t':
nwhite++;
if (nspaces)
{
if (!changes)
change();
ptrdiff_t j = result.length - nspaces;
auto ntabs = (((column - nspaces) % tabSize) + nspaces) / tabSize;
result.length = j + ntabs;
result[j .. j + ntabs] = '\t';
nwhite += ntabs - nspaces;
nspaces = 0;
}
column = (column + tabSize) / tabSize * tabSize;
break;
case '\r':
case '\n':
case paraSep:
case lineSep:
// Truncate any trailing spaces or tabs
if (nwhite)
{
if (!changes)
change();
result = result[0 .. result.length - nwhite];
}
break;
default:
if (nspaces >= 2 && (column % tabSize) == 0)
{
if (!changes)
change();
auto j = result.length - nspaces;
auto ntabs = (nspaces + tabSize - 1) / tabSize;
result.length = j + ntabs;
result[j .. j + ntabs] = '\t';
nwhite += ntabs - nspaces;
nspaces = 0;
}
if (c == ' ')
{ nwhite++;
nspaces++;
}
else
{ nwhite = 0;
nspaces = 0;
}
column++;
break;
}
if (changes)
{
std.utf.encode(result, c);
}
}
// Truncate any trailing spaces or tabs
if (nwhite)
{
if (changes)
result = result[0 .. result.length - nwhite];
else
s = s[0 .. s.length - nwhite];
}
return changes ? assumeUnique(result) : s;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.entab.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(entab(cast(string) null) is null);
assert(entab("").empty);
assert(entab("a") == "a");
assert(entab(" ") == "");
assert(entab(" x") == "\tx");
assert(entab(" ab asdf ") == " ab\tasdf");
assert(entab(" ab asdf ") == " ab\t asdf");
assert(entab(" ab \t asdf ") == " ab\t asdf");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\ta");
assert(entab("1234567 \ta") == "1234567\t\t\ta");
assert(entab("a ") == "a");
assert(entab("a\v") == "a\v");
assert(entab("a\f") == "a\f");
assert(entab("a\n") == "a\n");
assert(entab("a\n\r") == "a\n\r");
assert(entab("a\r\n") == "a\r\n");
assert(entab("a\u2028") == "a\u2028");
assert(entab("a\u2029") == "a\u2029");
assert(entab("a ") == "a");
assert(entab("a\t") == "a");
assert(entab("\uFF28\uFF45\uFF4C\uFF4C567 \t\uFF4F \t") ==
"\uFF28\uFF45\uFF4C\uFF4C567\t\t\uFF4F");
});
}
/++
Replaces the characters in $(D str) which are keys in $(D transTable) with
their corresponding values in $(D transTable). $(D transTable) is an AA
where its keys are $(D dchar) and its values are either $(D dchar) or some
type of string. Also, if $(D toRemove) is given, the characters in it are
removed from $(D str) prior to translation. $(D str) itself is unaltered.
A copy with the changes is returned.
See_Also:
$(LREF tr)
$(XREF array, replace)
Params:
str = The original string.
transTable = The AA indicating which characters to replace and what to
replace them with.
toRemove = The characters to remove from the string.
+/
C1[] translate(C1, C2 = immutable char)(C1[] str,
in dchar[dchar] transTable,
const(C2)[] toRemove = null) @safe pure
if (isSomeChar!C1 && isSomeChar!C2)
{
import std.array : appender;
auto buffer = appender!(C1[])();
translateImpl(str, transTable, toRemove, buffer);
return buffer.data;
}
///
@safe pure unittest
{
dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q'];
assert(translate("hello world", transTable1) == "h5ll7 w7rld");
assert(translate("hello world", transTable1, "low") == "h5 rd");
string[dchar] transTable2 = ['e' : "5", 'o' : "orange"];
assert(translate("hello world", transTable2) == "h5llorange worangerld");
}
@safe pure unittest // issue 13018
{
immutable dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q'];
assert(translate("hello world", transTable1) == "h5ll7 w7rld");
assert(translate("hello world", transTable1, "low") == "h5 rd");
immutable string[dchar] transTable2 = ['e' : "5", 'o' : "orange"];
assert(translate("hello world", transTable2) == "h5llorange worangerld");
}
@trusted pure unittest
{
import std.conv : to;
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!( char[], const( char)[], immutable( char)[],
wchar[], const(wchar)[], immutable(wchar)[],
dchar[], const(dchar)[], immutable(dchar)[]))
{
assert(translate(to!S("hello world"), cast(dchar[dchar])['h' : 'q', 'l' : '5']) ==
to!S("qe55o wor5d"));
assert(translate(to!S("hello world"), cast(dchar[dchar])['o' : 'l', 'l' : '\U00010143']) ==
to!S("he\U00010143\U00010143l wlr\U00010143d"));
assert(translate(to!S("hello \U00010143 world"), cast(dchar[dchar])['h' : 'q', 'l': '5']) ==
to!S("qe55o \U00010143 wor5d"));
assert(translate(to!S("hello \U00010143 world"), cast(dchar[dchar])['o' : '0', '\U00010143' : 'o']) ==
to!S("hell0 o w0rld"));
assert(translate(to!S("hello world"), cast(dchar[dchar])null) == to!S("hello world"));
foreach (T; TypeTuple!( char[], const( char)[], immutable( char)[],
wchar[], const(wchar)[], immutable(wchar)[],
dchar[], const(dchar)[], immutable(dchar)[]))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
foreach(R; TypeTuple!(dchar[dchar], const dchar[dchar],
immutable dchar[dchar]))
{
R tt = ['h' : 'q', 'l' : '5'];
assert(translate(to!S("hello world"), tt, to!T("r"))
== to!S("qe55o wo5d"));
assert(translate(to!S("hello world"), tt, to!T("helo"))
== to!S(" wrd"));
assert(translate(to!S("hello world"), tt, to!T("q5"))
== to!S("qe55o wor5d"));
}
}();
auto s = to!S("hello world");
dchar[dchar] transTable = ['h' : 'q', 'l' : '5'];
static assert(is(typeof(s) == typeof(translate(s, transTable))));
}
});
}
/++ Ditto +/
C1[] translate(C1, S, C2 = immutable char)(C1[] str,
in S[dchar] transTable,
const(C2)[] toRemove = null) @safe pure
if (isSomeChar!C1 && isSomeString!S && isSomeChar!C2)
{
import std.array : appender;
auto buffer = appender!(C1[])();
translateImpl(str, transTable, toRemove, buffer);
return buffer.data;
}
@trusted pure unittest
{
import std.conv : to;
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!( char[], const( char)[], immutable( char)[],
wchar[], const(wchar)[], immutable(wchar)[],
dchar[], const(dchar)[], immutable(dchar)[]))
{
assert(translate(to!S("hello world"), ['h' : "yellow", 'l' : "42"]) ==
to!S("yellowe4242o wor42d"));
assert(translate(to!S("hello world"), ['o' : "owl", 'l' : "\U00010143\U00010143"]) ==
to!S("he\U00010143\U00010143\U00010143\U00010143owl wowlr\U00010143\U00010143d"));
assert(translate(to!S("hello \U00010143 world"), ['h' : "yellow", 'l' : "42"]) ==
to!S("yellowe4242o \U00010143 wor42d"));
assert(translate(to!S("hello \U00010143 world"), ['o' : "owl", 'l' : "\U00010143\U00010143"]) ==
to!S("he\U00010143\U00010143\U00010143\U00010143owl \U00010143 wowlr\U00010143\U00010143d"));
assert(translate(to!S("hello \U00010143 world"), ['h' : ""]) ==
to!S("ello \U00010143 world"));
assert(translate(to!S("hello \U00010143 world"), ['\U00010143' : ""]) ==
to!S("hello world"));
assert(translate(to!S("hello world"), cast(string[dchar])null) == to!S("hello world"));
foreach (T; TypeTuple!( char[], const( char)[], immutable( char)[],
wchar[], const(wchar)[], immutable(wchar)[],
dchar[], const(dchar)[], immutable(dchar)[]))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
foreach(R; TypeTuple!(string[dchar], const string[dchar],
immutable string[dchar]))
{
R tt = ['h' : "yellow", 'l' : "42"];
assert(translate(to!S("hello world"), tt, to!T("r")) ==
to!S("yellowe4242o wo42d"));
assert(translate(to!S("hello world"), tt, to!T("helo")) ==
to!S(" wrd"));
assert(translate(to!S("hello world"), tt, to!T("y42")) ==
to!S("yellowe4242o wor42d"));
assert(translate(to!S("hello world"), tt, to!T("hello world")) ==
to!S(""));
assert(translate(to!S("hello world"), tt, to!T("42")) ==
to!S("yellowe4242o wor42d"));
}
}();
auto s = to!S("hello world");
string[dchar] transTable = ['h' : "silly", 'l' : "putty"];
static assert(is(typeof(s) == typeof(translate(s, transTable))));
}
});
}
/++
This is an overload of $(D translate) which takes an existing buffer to write the contents to.
Params:
str = The original string.
transTable = The AA indicating which characters to replace and what to
replace them with.
toRemove = The characters to remove from the string.
buffer = An output range to write the contents to.
+/
void translate(C1, C2 = immutable char, Buffer)(C1[] str,
in dchar[dchar] transTable,
const(C2)[] toRemove,
Buffer buffer)
if (isSomeChar!C1 && isSomeChar!C2 && isOutputRange!(Buffer, C1))
{
translateImpl(str, transTable, toRemove, buffer);
}
///
@safe pure unittest
{
import std.array : appender;
dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q'];
auto buffer = appender!(dchar[])();
translate("hello world", transTable1, null, buffer);
assert(buffer.data == "h5ll7 w7rld");
buffer.clear();
translate("hello world", transTable1, "low", buffer);
assert(buffer.data == "h5 rd");
buffer.clear();
string[dchar] transTable2 = ['e' : "5", 'o' : "orange"];
translate("hello world", transTable2, null, buffer);
assert(buffer.data == "h5llorange worangerld");
}
@safe pure unittest // issue 13018
{
import std.array : appender;
immutable dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q'];
auto buffer = appender!(dchar[])();
translate("hello world", transTable1, null, buffer);
assert(buffer.data == "h5ll7 w7rld");
buffer.clear();
translate("hello world", transTable1, "low", buffer);
assert(buffer.data == "h5 rd");
buffer.clear();
immutable string[dchar] transTable2 = ['e' : "5", 'o' : "orange"];
translate("hello world", transTable2, null, buffer);
assert(buffer.data == "h5llorange worangerld");
}
/++ Ditto +/
void translate(C1, S, C2 = immutable char, Buffer)(C1[] str,
in S[dchar] transTable,
const(C2)[] toRemove,
Buffer buffer)
if (isSomeChar!C1 && isSomeString!S && isSomeChar!C2 && isOutputRange!(Buffer, S))
{
translateImpl(str, transTable, toRemove, buffer);
}
private void translateImpl(C1, T, C2, Buffer)(C1[] str,
T transTable,
const(C2)[] toRemove,
Buffer buffer)
{
bool[dchar] removeTable;
foreach (dchar c; toRemove)
removeTable[c] = true;
foreach (dchar c; str)
{
if (c in removeTable)
continue;
auto newC = c in transTable;
if (newC)
put(buffer, *newC);
else
put(buffer, c);
}
}
/++
This is an $(I $(RED ASCII-only)) overload of $(LREF _translate). It
will $(I not) work with Unicode. It exists as an optimization for the
cases where Unicode processing is not necessary.
Unlike the other overloads of $(LREF _translate), this one does not take
an AA. Rather, it takes a $(D string) generated by $(LREF makeTrans).
The array generated by $(D makeTrans) is $(D 256) elements long such that
the index is equal to the ASCII character being replaced and the value is
equal to the character that it's being replaced with. Note that translate
does not decode any of the characters, so you can actually pass it Extended
ASCII characters if you want to (ASCII only actually uses $(D 128)
characters), but be warned that Extended ASCII characters are not valid
Unicode and therefore will result in a $(D UTFException) being thrown from
most other Phobos functions.
Also, because no decoding occurs, it is possible to use this overload to
translate ASCII characters within a proper UTF-8 string without altering the
other, non-ASCII characters. It's replacing any code unit greater than
$(D 127) with another code unit or replacing any code unit with another code
unit greater than $(D 127) which will cause UTF validation issues.
See_Also:
$(LREF tr)
$(XREF array, replace)
Params:
str = The original string.
transTable = The string indicating which characters to replace and what
to replace them with. It is generated by $(LREF makeTrans).
toRemove = The characters to remove from the string.
+/
C[] translate(C = immutable char)(in char[] str, in char[] transTable, in char[] toRemove = null) @trusted pure nothrow
if (is(Unqual!C == char))
in
{
assert(transTable.length == 256);
}
body
{
bool[256] remTable = false;
foreach (char c; toRemove)
remTable[c] = true;
size_t count = 0;
foreach (char c; str)
{
if (!remTable[c])
++count;
}
auto buffer = new char[count];
translateImplAscii(str, transTable, remTable, buffer, toRemove);
return cast(C[])(buffer);
}
/++ Ditto +/
string makeTrans(in char[] from, in char[] to) @trusted pure nothrow
in
{
import std.ascii : isASCII;
assert(from.length == to.length);
assert(from.length <= 256);
foreach (char c; from)
assert(std.ascii.isASCII(c));
foreach (char c; to)
assert(std.ascii.isASCII(c));
}
body
{
import std.exception : assumeUnique;
char[] transTable = new char[256];
foreach (i; 0 .. transTable.length)
transTable[i] = cast(char)i;
foreach (i; 0 .. from.length)
transTable[from[i]] = to[i];
return assumeUnique(transTable);
}
///
@safe pure nothrow unittest
{
auto transTable1 = makeTrans("eo5", "57q");
assert(translate("hello world", transTable1) == "h5ll7 w7rld");
assert(translate("hello world", transTable1, "low") == "h5 rd");
}
@safe pure unittest
{
import std.conv : to;
import std.exception;
assertCTFEable!(
{
foreach (C; TypeTuple!(char, const char, immutable char))
{
assert(translate!C("hello world", makeTrans("hl", "q5")) == to!(C[])("qe55o wor5d"));
auto s = to!(C[])("hello world");
auto transTable = makeTrans("hl", "q5");
static assert(is(typeof(s) == typeof(translate!C(s, transTable))));
}
foreach (S; TypeTuple!(char[], const(char)[], immutable(char)[]))
{
assert(translate(to!S("hello world"), makeTrans("hl", "q5")) == to!S("qe55o wor5d"));
assert(translate(to!S("hello \U00010143 world"), makeTrans("hl", "q5")) ==
to!S("qe55o \U00010143 wor5d"));
assert(translate(to!S("hello world"), makeTrans("ol", "1o")) == to!S("heoo1 w1rod"));
assert(translate(to!S("hello world"), makeTrans("", "")) == to!S("hello world"));
assert(translate(to!S("hello world"), makeTrans("12345", "67890")) == to!S("hello world"));
assert(translate(to!S("hello \U00010143 world"), makeTrans("12345", "67890")) ==
to!S("hello \U00010143 world"));
foreach (T; TypeTuple!(char[], const(char)[], immutable(char)[]))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(translate(to!S("hello world"), makeTrans("hl", "q5"), to!T("r")) ==
to!S("qe55o wo5d"));
assert(translate(to!S("hello \U00010143 world"), makeTrans("hl", "q5"), to!T("r")) ==
to!S("qe55o \U00010143 wo5d"));
assert(translate(to!S("hello world"), makeTrans("hl", "q5"), to!T("helo")) ==
to!S(" wrd"));
assert(translate(to!S("hello world"), makeTrans("hl", "q5"), to!T("q5")) ==
to!S("qe55o wor5d"));
}();
}
});
}
/++
This is an $(I $(RED ASCII-only)) overload of $(D translate) which takes an existing buffer to write the contents to.
Params:
str = The original string.
transTable = The string indicating which characters to replace and what
to replace them with. It is generated by $(LREF makeTrans).
toRemove = The characters to remove from the string.
buffer = An output range to write the contents to.
+/
void translate(C = immutable char, Buffer)(in char[] str, in char[] transTable,
in char[] toRemove, Buffer buffer) @trusted pure
if (is(Unqual!C == char) && isOutputRange!(Buffer, char))
in
{
assert(transTable.length == 256);
}
body
{
bool[256] remTable = false;
foreach (char c; toRemove)
remTable[c] = true;
translateImplAscii(str, transTable, remTable, buffer, toRemove);
}
///
@safe pure unittest
{
import std.array : appender;
auto buffer = appender!(char[])();
auto transTable1 = makeTrans("eo5", "57q");
translate("hello world", transTable1, null, buffer);
assert(buffer.data == "h5ll7 w7rld");
buffer.clear();
translate("hello world", transTable1, "low", buffer);
assert(buffer.data == "h5 rd");
}
private void translateImplAscii(C = immutable char, Buffer)(in char[] str,
in char[] transTable, ref bool[256] remTable, Buffer buffer,
in char[] toRemove = null) @trusted pure
{
static if (isOutputRange!(Buffer, char))
{
foreach (char c; str)
{
if (!remTable[c])
put(buffer, transTable[c]);
}
}
else
{
size_t i = 0;
foreach (char c; str)
{
if (!remTable[c])
buffer[i++] = transTable[c];
}
}
}
/***********************************************
* See if character c is in the pattern.
* Patterns:
*
* A <i>pattern</i> is an array of characters much like a <i>character
* class</i> in regular expressions. A sequence of characters
* can be given, such as "abcde". The '-' can represent a range
* of characters, as "a-e" represents the same pattern as "abcde".
* "a-fA-F0-9" represents all the hex characters.
* If the first character of a pattern is '^', then the pattern
* is negated, i.e. "^0-9" means any character except a digit.
* The functions inPattern, <b>countchars</b>, <b>removeschars</b>,
* and <b>squeeze</b>
* use patterns.
*
* Note: In the future, the pattern syntax may be improved
* to be more like regular expression character classes.
*/
bool inPattern(S)(dchar c, in S pattern) @safe pure @nogc if (isSomeString!S)
{
bool result = false;
int range = 0;
dchar lastc;
foreach (size_t i, dchar p; pattern)
{
if (p == '^' && i == 0)
{
result = true;
if (i + 1 == pattern.length)
return (c == p); // or should this be an error?
}
else if (range)
{
range = 0;
if (lastc <= c && c <= p || c == p)
return !result;
}
else if (p == '-' && i > result && i + 1 < pattern.length)
{
range = 1;
continue;
}
else if (c == p)
return !result;
lastc = p;
}
return result;
}
@safe pure @nogc unittest
{
import std.conv : to;
debug(string) trustedPrintf("std.string.inPattern.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(inPattern('x', "x") == 1);
assert(inPattern('x', "y") == 0);
assert(inPattern('x', string.init) == 0);
assert(inPattern('x', "^y") == 1);
assert(inPattern('x', "yxxy") == 1);
assert(inPattern('x', "^yxxy") == 0);
assert(inPattern('x', "^abcd") == 1);
assert(inPattern('^', "^^") == 0);
assert(inPattern('^', "^") == 1);
assert(inPattern('^', "a^") == 1);
assert(inPattern('x', "a-z") == 1);
assert(inPattern('x', "A-Z") == 0);
assert(inPattern('x', "^a-z") == 0);
assert(inPattern('x', "^A-Z") == 1);
assert(inPattern('-', "a-") == 1);
assert(inPattern('-', "^A-") == 0);
assert(inPattern('a', "z-a") == 1);
assert(inPattern('z', "z-a") == 1);
assert(inPattern('x', "z-a") == 0);
});
}
/***********************************************
* See if character c is in the intersection of the patterns.
*/
bool inPattern(S)(dchar c, S[] patterns) @safe pure @nogc if (isSomeString!S)
{
foreach (string pattern; patterns)
{
if (!inPattern(c, pattern))
{
return false;
}
}
return true;
}
/********************************************
* Count characters in s that match pattern.
*/
size_t countchars(S, S1)(S s, in S1 pattern) @safe pure @nogc if (isSomeString!S && isSomeString!S1)
{
size_t count;
foreach (dchar c; s)
{
count += inPattern(c, pattern);
}
return count;
}
@safe pure @nogc unittest
{
import std.conv : to;
debug(string) trustedPrintf("std.string.count.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(countchars("abc", "a-c") == 3);
assert(countchars("hello world", "or") == 3);
});
}
/********************************************
* Return string that is s with all characters removed that match pattern.
*/
S removechars(S)(S s, in S pattern) @safe pure if (isSomeString!S)
{
import std.utf : encode;
Unqual!(typeof(s[0]))[] r;
bool changed = false;
foreach (size_t i, dchar c; s)
{
if (inPattern(c, pattern))
{
if (!changed)
{
changed = true;
r = s[0 .. i].dup;
}
continue;
}
if (changed)
{
std.utf.encode(r, c);
}
}
if (changed)
return r;
else
return s;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("std.string.removechars.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(removechars("abc", "a-c").length == 0);
assert(removechars("hello world", "or") == "hell wld");
assert(removechars("hello world", "d") == "hello worl");
assert(removechars("hah", "h") == "a");
});
}
/***************************************************
* Return string where sequences of a character in s[] from pattern[]
* are replaced with a single instance of that character.
* If pattern is null, it defaults to all characters.
*/
S squeeze(S)(S s, in S pattern = null)
{
import std.utf : encode;
Unqual!(typeof(s[0]))[] r;
dchar lastc;
size_t lasti;
int run;
bool changed;
foreach (size_t i, dchar c; s)
{
if (run && lastc == c)
{
changed = true;
}
else if (pattern is null || inPattern(c, pattern))
{
run = 1;
if (changed)
{
if (r is null)
r = s[0 .. lasti].dup;
std.utf.encode(r, c);
}
else
lasti = i + std.utf.stride(s, i);
lastc = c;
}
else
{
run = 0;
if (changed)
{
if (r is null)
r = s[0 .. lasti].dup;
std.utf.encode(r, c);
}
}
}
return changed ? ((r is null) ? s[0 .. lasti] : cast(S) r) : s;
}
@trusted pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("std.string.squeeze.unittest\n");
import std.exception;
assertCTFEable!(
{
string s;
assert(squeeze("hello") == "helo");
s = "abcd";
assert(squeeze(s) is s);
s = "xyzz";
assert(squeeze(s).ptr == s.ptr); // should just be a slice
assert(squeeze("hello goodbyee", "oe") == "hello godbye");
});
}
/***************************************************************
Finds the position $(D_PARAM pos) of the first character in $(D_PARAM
s) that does not match $(D_PARAM pattern) (in the terminology used by
$(LINK2 std_string.html,inPattern)). Updates $(D_PARAM s =
s[pos..$]). Returns the slice from the beginning of the original
(before update) string up to, and excluding, $(D_PARAM pos).
The $(D_PARAM munch) function is mostly convenient for skipping
certain category of characters (e.g. whitespace) when parsing
strings. (In such cases, the return value is not used.)
*/
S1 munch(S1, S2)(ref S1 s, S2 pattern) @safe pure @nogc
{
size_t j = s.length;
foreach (i, dchar c; s)
{
if (!inPattern(c, pattern))
{
j = i;
break;
}
}
scope(exit) s = s[j .. $];
return s[0 .. j];
}
///
@safe pure @nogc unittest
{
string s = "123abc";
string t = munch(s, "0123456789");
assert(t == "123" && s == "abc");
t = munch(s, "0123456789");
assert(t == "" && s == "abc");
}
@safe pure @nogc unittest
{
string s = "123€abc";
string t = munch(s, "0123456789");
assert(t == "123" && s == "€abc");
t = munch(s, "0123456789");
assert(t == "" && s == "€abc");
t = munch(s, "£$€¥");
assert(t == "€" && s == "abc");
}
/**********************************************
* Return string that is the 'successor' to s[].
* If the rightmost character is a-zA-Z0-9, it is incremented within
* its case or digits. If it generates a carry, the process is
* repeated with the one to its immediate left.
*/
S succ(S)(S s) @safe pure if (isSomeString!S)
{
import std.ascii : isAlphaNum;
if (s.length && std.ascii.isAlphaNum(s[$ - 1]))
{
auto r = s.dup;
size_t i = r.length - 1;
while (1)
{
dchar c = s[i];
dchar carry;
switch (c)
{
case '9':
c = '0';
carry = '1';
goto Lcarry;
case 'z':
case 'Z':
c -= 'Z' - 'A';
carry = c;
Lcarry:
r[i] = cast(char)c;
if (i == 0)
{
auto t = new typeof(r[0])[r.length + 1];
t[0] = cast(char) carry;
t[1 .. $] = r[];
return t;
}
i--;
break;
default:
if (std.ascii.isAlphaNum(c))
r[i]++;
return r;
}
}
}
return s;
}
///
@safe pure unittest
{
assert(succ("1") == "2");
assert(succ("9") == "10");
assert(succ("999") == "1000");
assert(succ("zz99") == "aaa00");
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("std.string.succ.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(succ(string.init) is null);
assert(succ("!@#$%") == "!@#$%");
assert(succ("1") == "2");
assert(succ("9") == "10");
assert(succ("999") == "1000");
assert(succ("zz99") == "aaa00");
});
}
/++
Replaces the characters in $(D str) which are in $(D from) with the
the corresponding characters in $(D to) and returns the resulting string.
$(D tr) is based on
$(WEB pubs.opengroup.org/onlinepubs/9699919799/utilities/_tr.html, Posix's tr),
though it doesn't do everything that the Posix utility does.
Params:
str = The original string.
from = The characters to replace.
to = The characters to replace with.
modifiers = String containing modifiers.
Modifiers:
$(BOOKTABLE,
$(TR $(TD Modifier) $(TD Description))
$(TR $(TD $(D 'c')) $(TD Complement the list of characters in $(D from)))
$(TR $(TD $(D 'd')) $(TD Removes matching characters with no corresponding
replacement in $(D to)))
$(TR $(TD $(D 's')) $(TD Removes adjacent duplicates in the replaced
characters))
)
If the modifier $(D 'd') is present, then the number of characters in
$(D to) may be only $(D 0) or $(D 1).
If the modifier $(D 'd') is $(I not) present, and $(D to) is empty, then
$(D to) is taken to be the same as $(D from).
If the modifier $(D 'd') is $(I not) present, and $(D to) is shorter than
$(D from), then $(D to) is extended by replicating the last character in
$(D to).
Both $(D from) and $(D to) may contain ranges using the $(D '-') character
(e.g. $(D "a-d") is synonymous with $(D "abcd").) Neither accept a leading
$(D '^') as meaning the complement of the string (use the $(D 'c') modifier
for that).
+/
C1[] tr(C1, C2, C3, C4 = immutable char)
(C1[] str, const(C2)[] from, const(C3)[] to, const(C4)[] modifiers = null)
{
import std.conv : conv_to = to;
import std.utf : decode;
import std.array : appender;
bool mod_c;
bool mod_d;
bool mod_s;
foreach (char c; modifiers)
{
switch (c)
{
case 'c': mod_c = 1; break; // complement
case 'd': mod_d = 1; break; // delete unreplaced chars
case 's': mod_s = 1; break; // squeeze duplicated replaced chars
default: assert(0);
}
}
if (to.empty && !mod_d)
to = conv_to!(typeof(to))(from);
auto result = appender!(C1[])();
bool modified;
dchar lastc;
foreach (dchar c; str)
{
dchar lastf;
dchar lastt;
dchar newc;
int n = 0;
for (size_t i = 0; i < from.length; )
{
dchar f = std.utf.decode(from, i);
if (f == '-' && lastf != dchar.init && i < from.length)
{
dchar nextf = std.utf.decode(from, i);
if (lastf <= c && c <= nextf)
{
n += c - lastf - 1;
if (mod_c)
goto Lnotfound;
goto Lfound;
}
n += nextf - lastf;
lastf = lastf.init;
continue;
}
if (c == f)
{ if (mod_c)
goto Lnotfound;
goto Lfound;
}
lastf = f;
n++;
}
if (!mod_c)
goto Lnotfound;
n = 0; // consider it 'found' at position 0
Lfound:
// Find the nth character in to[]
dchar nextt;
for (size_t i = 0; i < to.length; )
{ dchar t = std.utf.decode(to, i);
if (t == '-' && lastt != dchar.init && i < to.length)
{
nextt = std.utf.decode(to, i);
n -= nextt - lastt;
if (n < 0)
{
newc = nextt + n + 1;
goto Lnewc;
}
lastt = dchar.init;
continue;
}
if (n == 0)
{ newc = t;
goto Lnewc;
}
lastt = t;
nextt = t;
n--;
}
if (mod_d)
continue;
newc = nextt;
Lnewc:
if (mod_s && modified && newc == lastc)
continue;
result.put(newc);
assert(newc != dchar.init);
modified = true;
lastc = newc;
continue;
Lnotfound:
result.put(c);
lastc = c;
modified = false;
}
return result.data;
}
unittest
{
import std.conv : to;
debug(string) trustedPrintf("std.string.tr.unittest\n");
import std.algorithm : equal;
// Complete list of test types; too slow to test'em all
// alias TestTypes = TypeTuple!(
// char[], const( char)[], immutable( char)[],
// wchar[], const(wchar)[], immutable(wchar)[],
// dchar[], const(dchar)[], immutable(dchar)[]);
// Reduced list of test types
alias TestTypes = TypeTuple!(char[], const(wchar)[], immutable(dchar)[]);
import std.exception;
assertCTFEable!(
{
foreach (S; TestTypes)
{
foreach (T; TestTypes)
{
foreach (U; TestTypes)
{
assert(equal(tr(to!S("abcdef"), to!T("cd"), to!U("CD")), "abCDef"));
assert(equal(tr(to!S("abcdef"), to!T("b-d"), to!U("B-D")), "aBCDef"));
assert(equal(tr(to!S("abcdefgh"), to!T("b-dh"), to!U("B-Dx")), "aBCDefgx"));
assert(equal(tr(to!S("abcdefgh"), to!T("b-dh"), to!U("B-CDx")), "aBCDefgx"));
assert(equal(tr(to!S("abcdefgh"), to!T("b-dh"), to!U("B-BCDx")), "aBCDefgx"));
assert(equal(tr(to!S("abcdef"), to!T("ef"), to!U("*"), to!S("c")), "****ef"));
assert(equal(tr(to!S("abcdef"), to!T("ef"), to!U(""), to!T("d")), "abcd"));
assert(equal(tr(to!S("hello goodbye"), to!T("lo"), to!U(""), to!U("s")), "helo godbye"));
assert(equal(tr(to!S("hello goodbye"), to!T("lo"), to!U("x"), "s"), "hex gxdbye"));
assert(equal(tr(to!S("14-Jul-87"), to!T("a-zA-Z"), to!U(" "), "cs"), " Jul "));
assert(equal(tr(to!S("Abc"), to!T("AAA"), to!U("XYZ")), "Xbc"));
}
}
auto s = to!S("hello world");
static assert(is(typeof(s) == typeof(tr(s, "he", "if"))));
}
});
}
/* ************************************************
* Version : v0.3
* Author : David L. 'SpottedTiger' Davis
* Date Created : 31.May.05 Compiled and Tested with dmd v0.125
* Date Modified : 01.Jun.05 Modified the function to handle the
* : imaginary and complex float-point
* : datatypes.
* :
* Licence : Public Domain / Contributed to Digital Mars
*/
/**
* [in] string s can be formatted in the following ways:
*
* Integer Whole Number:
* (for byte, ubyte, short, ushort, int, uint, long, and ulong)
* ['+'|'-']digit(s)[U|L|UL]
*
* examples: 123, 123UL, 123L, +123U, -123L
*
* Floating-Point Number:
* (for float, double, real, ifloat, idouble, and ireal)
* ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]]
* or [nan|nani|inf|-inf]
*
* examples: +123., -123.01, 123.3e-10f, 123.3e-10fi, 123.3e-10L
*
* (for cfloat, cdouble, and creal)
* ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][+]
* [digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]]
* or [nan|nani|nan+nani|inf|-inf]
*
* examples: nan, -123e-1+456.9e-10Li, +123e+10+456i, 123+456
*
* [in] bool bAllowSep
* False by default, but when set to true it will accept the
* separator characters $(D ',') and $(D '__') within the string, but these
* characters should be stripped from the string before using any
* of the conversion functions like toInt(), toFloat(), and etc
* else an error will occur.
*
* Also please note, that no spaces are allowed within the string
* anywhere whether it's a leading, trailing, or embedded space(s),
* thus they too must be stripped from the string before using this
* function, or any of the conversion functions.
*/
bool isNumeric(const(char)[] s, in bool bAllowSep = false) @safe pure
{
import std.algorithm : among;
immutable iLen = s.length;
if (iLen == 0)
return false;
// Check for NaN (Not a Number) and for Infinity
if (s.among!((a, b) => icmp(a, b) == 0)
("nan", "nani", "nan+nani", "inf", "-inf"))
return true;
immutable j = s[0].among!('-', '+')() != 0;
bool bDecimalPoint, bExponent, bComplex, sawDigits;
for (size_t i = j; i < iLen; i++)
{
immutable c = s[i];
// Digits are good, continue checking
// with the popFront character... ;)
if (c >= '0' && c <= '9')
{
sawDigits = true;
continue;
}
// Check for the complex type, and if found
// reset the flags for checking the 2nd number.
if (c == '+')
{
if (!i)
return false;
bDecimalPoint = false;
bExponent = false;
bComplex = true;
sawDigits = false;
continue;
}
// Allow only one exponent per number
if (c.among!('e', 'E')())
{
// A 2nd exponent found, return not a number
if (bExponent || i + 1 >= iLen)
return false;
// Look forward for the sign, and if
// missing then this is not a number.
if (!s[i + 1].among!('-', '+')())
return false;
bExponent = true;
i++;
continue;
}
// Allow only one decimal point per number to be used
if (c == '.' )
{
// A 2nd decimal point found, return not a number
if (bDecimalPoint)
return false;
bDecimalPoint = true;
continue;
}
// Check for ending literal characters: "f,u,l,i,ul,fi,li",
// and whether they're being used with the correct datatype.
if (i == iLen - 2)
{
if (!sawDigits)
return false;
// Integer Whole Number
if (icmp(s[i..iLen], "ul") == 0 &&
(!bDecimalPoint && !bExponent && !bComplex))
return true;
// Floating-Point Number
if (s[i..iLen].among!((a, b) => icmp(a, b) == 0)("fi", "li") &&
(bDecimalPoint || bExponent || bComplex))
return true;
if (icmp(s[i..iLen], "ul") == 0 &&
(bDecimalPoint || bExponent || bComplex))
return false;
// Could be a Integer or a Float, thus
// all these suffixes are valid for both
return s[i..iLen].among!((a, b) => icmp(a, b) == 0)
("ul", "fi", "li") != 0;
}
if (i == iLen - 1)
{
if (!sawDigits)
return false;
// Integer Whole Number
if (c.among!('u', 'l', 'U', 'L')() &&
(!bDecimalPoint && !bExponent && !bComplex))
return true;
// Check to see if the last character in the string
// is the required 'i' character
if (bComplex)
return c.among!('i', 'I')() != 0;
// Floating-Point Number
return c.among!('l', 'L', 'f', 'F', 'i', 'I')() != 0;
}
// Check if separators are allowed to be in the numeric string
if (!bAllowSep || !c.among!('_', ',')())
return false;
}
return sawDigits;
}
@safe pure unittest
{
assert(!isNumeric("F"));
assert(!isNumeric("L"));
assert(!isNumeric("U"));
assert(!isNumeric("i"));
assert(!isNumeric("fi"));
assert(!isNumeric("ul"));
assert(!isNumeric("li"));
assert(!isNumeric("."));
assert(!isNumeric("-"));
assert(!isNumeric("+"));
assert(!isNumeric("e-"));
assert(!isNumeric("e+"));
assert(!isNumeric(".f"));
assert(!isNumeric("e+f"));
}
@trusted unittest
{
import std.conv : to;
debug(string) trustedPrintf("isNumeric(in string, bool = false).unittest\n");
import std.exception;
assertCTFEable!(
{
// Test the isNumeric(in string) function
assert(isNumeric("1") == true );
assert(isNumeric("1.0") == true );
assert(isNumeric("1e-1") == true );
assert(isNumeric("12345xxxx890") == false );
assert(isNumeric("567L") == true );
assert(isNumeric("23UL") == true );
assert(isNumeric("-123..56f") == false );
assert(isNumeric("12.3.5.6") == false );
assert(isNumeric(" 12.356") == false );
assert(isNumeric("123 5.6") == false );
assert(isNumeric("1233E-1+1.0e-1i") == true );
assert(isNumeric("123.00E-5+1234.45E-12Li") == true);
assert(isNumeric("123.00e-5+1234.45E-12iL") == false);
assert(isNumeric("123.00e-5+1234.45e-12uL") == false);
assert(isNumeric("123.00E-5+1234.45e-12lu") == false);
assert(isNumeric("123fi") == true);
assert(isNumeric("123li") == true);
assert(isNumeric("--123L") == false);
assert(isNumeric("+123.5UL") == false);
assert(isNumeric("123f") == true);
assert(isNumeric("123.u") == false);
// @@@BUG@@ to!string(float) is not CTFEable.
// Related: formatValue(T) if (is(FloatingPointTypeOf!T))
if (!__ctfe)
{
assert(isNumeric(to!string(real.nan)) == true);
assert(isNumeric(to!string(-real.infinity)) == true);
assert(isNumeric(to!string(123e+2+1234.78Li)) == true);
}
string s = "$250.99-";
assert(isNumeric(s[1..s.length - 2]) == true);
assert(isNumeric(s) == false);
assert(isNumeric(s[0..s.length - 1]) == false);
});
assert(!isNumeric("-"));
assert(!isNumeric("+"));
}
/*****************************
* Soundex algorithm.
*
* The Soundex algorithm converts a word into 4 characters
* based on how the word sounds phonetically. The idea is that
* two spellings that sound alike will have the same Soundex
* value, which means that Soundex can be used for fuzzy matching
* of names.
*
* Params:
* string = String to convert to Soundex representation.
* buffer = Optional 4 char array to put the resulting Soundex
* characters into. If null, the return value
* buffer will be allocated on the heap.
* Returns:
* The four character array with the Soundex result in it.
* Returns null if there is no Soundex representation for the string.
*
* See_Also:
* $(LINK2 http://en.wikipedia.org/wiki/Soundex, Wikipedia),
* $(LUCKY The Soundex Indexing System)
*
* Bugs:
* Only works well with English names.
* There are other arguably better Soundex algorithms,
* but this one is the standard one.
*/
char[] soundex(const(char)[] string, char[] buffer = null)
@safe pure nothrow
in
{
assert(!buffer.ptr || buffer.length >= 4);
}
out (result)
{
if (result.ptr)
{
assert(result.length == 4);
assert(result[0] >= 'A' && result[0] <= 'Z');
foreach (char c; result[1 .. 4])
assert(c >= '0' && c <= '6');
}
}
body
{
static immutable dex =
// ABCDEFGHIJKLMNOPQRSTUVWXYZ
"01230120022455012623010202";
int b = 0;
char lastc;
foreach (char cs; string)
{ auto c = cs; // necessary because cs is final
if (c >= 'a' && c <= 'z')
c -= 'a' - 'A';
else if (c >= 'A' && c <= 'Z')
{
}
else
{
lastc = lastc.init;
continue;
}
if (b == 0)
{
if (!buffer.ptr)
buffer = new char[4];
buffer[0] = c;
b++;
lastc = dex[c - 'A'];
}
else
{
if (c == 'H' || c == 'W')
continue;
if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
lastc = lastc.init;
c = dex[c - 'A'];
if (c != '0' && c != lastc)
{
buffer[b] = c;
b++;
lastc = c;
}
}
if (b == 4)
goto Lret;
}
if (b == 0)
buffer = null;
else
buffer[b .. 4] = '0';
Lret:
return buffer;
}
@safe pure nothrow unittest
{
import std.exception;
assertCTFEable!(
{
char[4] buffer;
assert(soundex(null) == null);
assert(soundex("") == null);
assert(soundex("0123^&^^**&^") == null);
assert(soundex("Euler") == "E460");
assert(soundex(" Ellery ") == "E460");
assert(soundex("Gauss") == "G200");
assert(soundex("Ghosh") == "G200");
assert(soundex("Hilbert") == "H416");
assert(soundex("Heilbronn") == "H416");
assert(soundex("Knuth") == "K530");
assert(soundex("Kant", buffer) == "K530");
assert(soundex("Lloyd") == "L300");
assert(soundex("Ladd") == "L300");
assert(soundex("Lukasiewicz", buffer) == "L222");
assert(soundex("Lissajous") == "L222");
assert(soundex("Robert") == "R163");
assert(soundex("Rupert") == "R163");
assert(soundex("Rubin") == "R150");
assert(soundex("Washington") == "W252");
assert(soundex("Lee") == "L000");
assert(soundex("Gutierrez") == "G362");
assert(soundex("Pfister") == "P236");
assert(soundex("Jackson") == "J250");
assert(soundex("Tymczak") == "T522");
assert(soundex("Ashcraft") == "A261");
assert(soundex("Woo") == "W000");
assert(soundex("Pilgrim") == "P426");
assert(soundex("Flingjingwaller") == "F452");
assert(soundex("PEARSE") == "P620");
assert(soundex("PIERCE") == "P620");
assert(soundex("Price") == "P620");
assert(soundex("CATHY") == "C300");
assert(soundex("KATHY") == "K300");
assert(soundex("Jones") == "J520");
assert(soundex("johnsons") == "J525");
assert(soundex("Hardin") == "H635");
assert(soundex("Martinez") == "M635");
});
}
/***************************************************
* Construct an associative array consisting of all
* abbreviations that uniquely map to the strings in values.
*
* This is useful in cases where the user is expected to type
* in one of a known set of strings, and the program will helpfully
* autocomplete the string once sufficient characters have been
* entered that uniquely identify it.
* Example:
* ---
* import std.stdio;
* import std.string;
*
* void main()
* {
* static string[] list = [ "food", "foxy" ];
*
* auto abbrevs = std.string.abbrev(list);
*
* foreach (key, value; abbrevs)
* {
* writefln("%s => %s", key, value);
* }
* }
* ---
* produces the output:
* <pre>
* fox => foxy
* food => food
* foxy => foxy
* foo => food
* </pre>
*/
string[string] abbrev(string[] values) @safe pure
{
import std.algorithm : sort;
string[string] result;
// Make a copy when sorting so we follow COW principles.
values = values.dup;
sort(values);
size_t values_length = values.length;
size_t lasti = values_length;
size_t nexti;
string nv;
string lv;
for (size_t i = 0; i < values_length; i = nexti)
{
string value = values[i];
// Skip dups
for (nexti = i + 1; nexti < values_length; nexti++)
{
nv = values[nexti];
if (value != values[nexti])
break;
}
for (size_t j = 0; j < value.length; j += std.utf.stride(value, j))
{
string v = value[0 .. j];
if ((nexti == values_length || j > nv.length || v != nv[0 .. j]) &&
(lasti == values_length || j > lv.length || v != lv[0 .. j]))
{
result[v] = value;
}
}
result[value] = value;
lasti = i;
lv = value;
}
return result;
}
@trusted pure unittest
{
import std.conv : to;
import std.algorithm : sort;
debug(string) trustedPrintf("string.abbrev.unittest\n");
import std.exception;
assertCTFEable!(
{
string[] values;
values ~= "hello";
values ~= "hello";
values ~= "he";
string[string] r;
r = abbrev(values);
auto keys = r.keys.dup;
sort(keys);
assert(keys.length == 4);
assert(keys[0] == "he");
assert(keys[1] == "hel");
assert(keys[2] == "hell");
assert(keys[3] == "hello");
assert(r[keys[0]] == "he");
assert(r[keys[1]] == "hello");
assert(r[keys[2]] == "hello");
assert(r[keys[3]] == "hello");
});
}
/******************************************
* Compute _column number at the end of the printed form of the string,
* assuming the string starts in the leftmost _column, which is numbered
* starting from 0.
*
* Tab characters are expanded into enough spaces to bring the _column number
* to the next multiple of tabsize.
* If there are multiple lines in the string, the _column number of the last
* line is returned.
*
* Params:
* str = string or InputRange to be analyzed
* tabsize = number of columns a tab character represents
*
* Returns:
* column number
*/
size_t column(Range)(Range str, in size_t tabsize = 8)
if (isSomeString!Range ||
isInputRange!Range && isSomeChar!(Unqual!(ElementEncodingType!Range)))
{
static if (is(Unqual!(ElementEncodingType!Range) == char))
{
// decoding needed for chars
import std.utf: byDchar;
return str.byDchar.column(tabsize);
}
else
{
// decoding not needed for wchars and dchars
import std.uni : lineSep, paraSep, nelSep;
size_t column;
foreach (const c; str)
{
switch (c)
{
case '\t':
column = (column + tabsize) / tabsize * tabsize;
break;
case '\r':
case '\n':
case paraSep:
case lineSep:
case nelSep:
column = 0;
break;
default:
column++;
break;
}
}
return column;
}
}
///
unittest
{
import std.utf : byChar, byWchar, byDchar;
assert(column("1234 ") == 5);
assert(column("1234 "w) == 5);
assert(column("1234 "d) == 5);
assert(column("1234 ".byChar()) == 5);
assert(column("1234 "w.byWchar()) == 5);
assert(column("1234 "d.byDchar()) == 5);
// Tab stops are set at 8 spaces by default; tab characters insert enough
// spaces to bring the column position to the next multiple of 8.
assert(column("\t") == 8);
assert(column("1\t") == 8);
assert(column("\t1") == 9);
assert(column("123\t") == 8);
// Other tab widths are possible by specifying it explicitly:
assert(column("\t", 4) == 4);
assert(column("1\t", 4) == 4);
assert(column("\t1", 4) == 5);
assert(column("123\t", 4) == 4);
// New lines reset the column number.
assert(column("abc\n") == 0);
assert(column("abc\n1") == 1);
assert(column("abcdefg\r1234") == 4);
assert(column("abc\u20281") == 1);
assert(column("abc\u20291") == 1);
assert(column("abc\u00851") == 1);
assert(column("abc\u00861") == 5);
}
@safe @nogc unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.column.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(column(string.init) == 0);
assert(column("") == 0);
assert(column("\t") == 8);
assert(column("abc\t") == 8);
assert(column("12345678\t") == 16);
});
}
/******************************************
* Wrap text into a paragraph.
*
* The input text string s is formed into a paragraph
* by breaking it up into a sequence of lines, delineated
* by \n, such that the number of columns is not exceeded
* on each line.
* The last line is terminated with a \n.
* Params:
* s = text string to be wrapped
* columns = maximum number of _columns in the paragraph
* firstindent = string used to _indent first line of the paragraph
* indent = string to use to _indent following lines of the paragraph
* tabsize = column spacing of tabs in firstindent[] and indent[]
* Returns:
* resulting paragraph as an allocated string
*/
S wrap(S)(S s, in size_t columns = 80, S firstindent = null,
S indent = null, in size_t tabsize = 8) @safe pure if (isSomeString!S)
{
typeof(s.dup) result;
bool inword;
bool first = true;
size_t wordstart;
const indentcol = column(indent, tabsize);
result.length = firstindent.length + s.length;
result.length = firstindent.length;
result[] = firstindent[];
auto col = column(firstindent, tabsize);
foreach (size_t i, dchar c; s)
{
if (std.uni.isWhite(c))
{
if (inword)
{
if (first)
{
}
else if (col + 1 + (i - wordstart) > columns)
{
result ~= '\n';
result ~= indent;
col = indentcol;
}
else
{
result ~= ' ';
col += 1;
}
result ~= s[wordstart .. i];
col += i - wordstart;
inword = false;
first = false;
}
}
else
{
if (!inword)
{
wordstart = i;
inword = true;
}
}
}
if (inword)
{
if (col + 1 + (s.length - wordstart) >= columns)
{
result ~= '\n';
result ~= indent;
}
else if (result.length != firstindent.length)
result ~= ' ';
result ~= s[wordstart .. s.length];
}
result ~= '\n';
return result;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.wrap.unittest\n");
import std.exception;
assertCTFEable!(
{
assert(wrap(string.init) == "\n");
assert(wrap(" a b df ") == "a b df\n");
assert(wrap(" a b df ", 3) == "a b\ndf\n");
assert(wrap(" a bc df ", 3) == "a\nbc\ndf\n");
assert(wrap(" abcd df ", 3) == "abcd\ndf\n");
assert(wrap("x") == "x\n");
assert(wrap("u u") == "u u\n");
assert(wrap("abcd", 3) == "\nabcd\n");
assert(wrap("a de", 10, "\t", " ", 8) == "\ta\n de\n");
});
}
/******************************************
* Removes one level of indentation from a multi-line string.
*
* This uniformly outdents the text as much as possible.
* Whitespace-only lines are always converted to blank lines.
*
* Does not allocate memory if it does not throw.
*
* Params:
* str = multi-line string
*
* Returns:
* outdented string
*
* Throws:
* StringException if indentation is done with different sequences
* of whitespace characters.
*/
S outdent(S)(S str) @safe pure if(isSomeString!S)
{
return str.splitLines(KeepTerminator.yes).outdent().join();
}
///
@safe pure unittest
{
enum pretty = q{
import std.stdio;
void main() {
writeln("Hello");
}
}.outdent();
enum ugly = q{
import std.stdio;
void main() {
writeln("Hello");
}
};
assert(pretty == ugly);
}
/******************************************
* Removes one level of indentation from an array of single-line strings.
*
* This uniformly outdents the text as much as possible.
* Whitespace-only lines are always converted to blank lines.
*
* Params:
* lines = array of single-line strings
*
* Returns:
* lines[] is rewritten in place with outdented lines
*
* Throws:
* StringException if indentation is done with different sequences
* of whitespace characters.
*/
S[] outdent(S)(S[] lines) @safe pure if(isSomeString!S)
{
import std.algorithm : startsWith;
if (lines.empty)
{
return null;
}
static S leadingWhiteOf(S str)
{
return str[ 0 .. $ - stripLeft(str).length ];
}
S shortestIndent;
foreach (ref line; lines)
{
auto stripped = line.stripLeft();
if (stripped.empty)
{
line = line[line.chomp().length .. $];
}
else
{
auto indent = leadingWhiteOf(line);
// Comparing number of code units instead of code points is OK here
// because this function throws upon inconsistent indentation.
if (shortestIndent is null || indent.length < shortestIndent.length)
{
if (indent.empty)
return lines;
shortestIndent = indent;
}
}
}
foreach (ref line; lines)
{
auto stripped = line.stripLeft();
if (stripped.empty)
{
// Do nothing
}
else if (line.startsWith(shortestIndent))
{
line = line[shortestIndent.length .. $];
}
else
{
throw new StringException("outdent: Inconsistent indentation");
}
}
return lines;
}
@safe pure unittest
{
import std.conv : to;
debug(string) trustedPrintf("string.outdent.unittest\n");
template outdent_testStr(S)
{
enum S outdent_testStr =
"
\t\tX
\t\U00010143X
\t\t
\t\t\tX
\t ";
}
template outdent_expected(S)
{
enum S outdent_expected =
"
\tX
\U00010143X
\t\tX
";
}
import std.exception;
assertCTFEable!(
{
foreach (S; TypeTuple!(string, wstring, dstring))
{
enum S blank = "";
assert(blank.outdent() == blank);
static assert(blank.outdent() == blank);
enum S testStr1 = " \n \t\n ";
enum S expected1 = "\n\n";
assert(testStr1.outdent() == expected1);
static assert(testStr1.outdent() == expected1);
assert(testStr1[0..$-1].outdent() == expected1);
static assert(testStr1[0..$-1].outdent() == expected1);
enum S testStr2 = "a\n \t\nb";
assert(testStr2.outdent() == testStr2);
static assert(testStr2.outdent() == testStr2);
enum S testStr3 =
"
\t\tX
\t\U00010143X
\t\t
\t\t\tX
\t ";
enum S expected3 =
"
\tX
\U00010143X
\t\tX
";
assert(testStr3.outdent() == expected3);
static assert(testStr3.outdent() == expected3);
enum testStr4 = " X\r X\n X\r\n X\u2028 X\u2029 X";
enum expected4 = "X\rX\nX\r\nX\u2028X\u2029X";
assert(testStr4.outdent() == expected4);
static assert(testStr4.outdent() == expected4);
enum testStr5 = testStr4[0..$-1];
enum expected5 = expected4[0..$-1];
assert(testStr5.outdent() == expected5);
static assert(testStr5.outdent() == expected5);
enum testStr6 = " \r \n \r\n \u2028 \u2029";
enum expected6 = "\r\n\r\n\u2028\u2029";
assert(testStr6.outdent() == expected6);
static assert(testStr6.outdent() == expected6);
enum testStr7 = " a \n b ";
enum expected7 = "a \nb ";
assert(testStr7.outdent() == expected7);
static assert(testStr7.outdent() == expected7);
}
});
}
/** Assume the given array of integers $(D arr) is a well-formed UTF string and
return it typed as a UTF string.
$(D ubyte) becomes $(D char), $(D ushort) becomes $(D wchar) and $(D uint)
becomes $(D dchar). Type qualifiers are preserved.
Params:
arr = array of bytes, ubytes, shorts, ushorts, ints, or uints
Returns:
arr retyped as an array of chars, wchars, or dchars
See_Also: $(LREF representation)
*/
auto assumeUTF(T)(T[] arr) pure
if(staticIndexOf!(Unqual!T, ubyte, ushort, uint) != -1)
{
import std.utf : validate;
alias ToUTFType(U) = TypeTuple!(char, wchar, dchar)[U.sizeof / 2];
auto asUTF = cast(ModifyTypePreservingSTC!(ToUTFType, T)[])arr;
debug validate(asUTF);
return asUTF;
}
///
@safe pure unittest
{
string a = "Hölo World";
immutable(ubyte)[] b = a.representation;
string c = b.assumeUTF;
assert(a == c);
}
pure unittest
{
import std.algorithm : equal;
foreach(T; TypeTuple!(char[], wchar[], dchar[]))
{
immutable T jti = "Hello World";
T jt = jti.dup;
static if(is(T == char[]))
{
auto gt = cast(ubyte[])jt;
auto gtc = cast(const(ubyte)[])jt;
auto gti = cast(immutable(ubyte)[])jt;
}
else static if(is(T == wchar[]))
{
auto gt = cast(ushort[])jt;
auto gtc = cast(const(ushort)[])jt;
auto gti = cast(immutable(ushort)[])jt;
}
else static if(is(T == dchar[]))
{
auto gt = cast(uint[])jt;
auto gtc = cast(const(uint)[])jt;
auto gti = cast(immutable(uint)[])jt;
}
auto ht = assumeUTF(gt);
auto htc = assumeUTF(gtc);
auto hti = assumeUTF(gti);
assert(equal(jt, ht));
assert(equal(jt, htc));
assert(equal(jt, hti));
}
}
| D |
PLONG PLAT ED95 KD LOMAGAGE HIMAGAGE SLAT SLONG RESULTNO DP DM ROCKTYPE
4.0999999 81 13.5 21 7 8 36 -106.300003 303 11.3999996 11.3999996 extrusives, basalts
4.5 80.5 11.8999996 29 8 9 35.7000008 -106.5 304 14.1999998 14.1999998 extrusives, basalts, rhyolites
147.699997 51 22 18 7 8 36.2000008 -106.199997 408 14.3000002 25.1000004 extrusives, basalts
83.5 79.8000031 17.2000008 8.80000019 15 17 30.7000008 -84.9000015 6882 11.8000002 20.2000008 sediments
275.5 83.5999985 0 0 0 20 46.7999992 -90.6999969 5904 3.4000001 3.4000001 sediments
45.2999992 81.0999985 12.8999996 51.9000015 14 17 45.2999992 -110.800003 5975 13.5 18.6000004 sediments
| D |
import weka.DE.DE: RM, SM;
| D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.