code
stringlengths
3
10M
language
stringclasses
31 values
/Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/Build/Intermediates/BasedLearningDemo.build/Debug-iphonesimulator/BasedLearningDemo.build/Objects-normal/x86_64/AppDelegate.o : /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTextViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengButtonViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTextFieldViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengActionSheetViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengMKMapViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengImageViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengCollectionViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/ViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengAlertViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengLabelViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTableViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengGrammarViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengScrollViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/AppDelegate.swift /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/SwiftOnoneSupport.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/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/CoreLocation.swiftmodule /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/Build/Intermediates/BasedLearningDemo.build/Debug-iphonesimulator/BasedLearningDemo.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule : /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTextViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengButtonViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTextFieldViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengActionSheetViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengMKMapViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengImageViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengCollectionViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/ViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengAlertViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengLabelViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTableViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengGrammarViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengScrollViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/AppDelegate.swift /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/SwiftOnoneSupport.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/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/CoreLocation.swiftmodule /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/Build/Intermediates/BasedLearningDemo.build/Debug-iphonesimulator/BasedLearningDemo.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc : /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTextViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengButtonViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTextFieldViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengActionSheetViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengMKMapViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengImageViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengCollectionViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/ViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengAlertViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengLabelViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengTableViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengGrammarViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/FengScrollViewViewController.swift /Users/fengshaohui/Desktop/swift/iOS/BasedLearningDemo/BasedLearningDemo/AppDelegate.swift /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/SwiftOnoneSupport.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/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/CoreLocation.swiftmodule
D
/Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/Objects-normal/x86_64/SwiftyJSON.o : /Users/apple-1/Downloads/HouseKeeping/Pods/SwiftyJSON/Source/SwiftyJSON.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Pods/Target\ Support\ Files/SwiftyJSON/SwiftyJSON-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/Objects-normal/x86_64/SwiftyJSON~partial.swiftmodule : /Users/apple-1/Downloads/HouseKeeping/Pods/SwiftyJSON/Source/SwiftyJSON.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Pods/Target\ Support\ Files/SwiftyJSON/SwiftyJSON-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/Objects-normal/x86_64/SwiftyJSON~partial.swiftdoc : /Users/apple-1/Downloads/HouseKeeping/Pods/SwiftyJSON/Source/SwiftyJSON.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Pods/Target\ Support\ Files/SwiftyJSON/SwiftyJSON-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule
D
module az.gui; public import az.gui.render; public import az.gui.view; public import az.gui.views; public import az.gui.action; public import az.gui.actiongroup; public import az.gui.layout;
D
INSTANCE Info_Mod_Samuel_Hi (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_Hi_Condition; information = Info_Mod_Samuel_Hi_Info; permanent = 0; important = 0; description = "Wer bist du?"; }; FUNC INT Info_Mod_Samuel_Hi_Condition() { return 1; }; FUNC VOID Info_Mod_Samuel_Hi_Info() { B_Say (hero, self, "$WHOAREYOU"); AI_Output(self, hero, "Info_Mod_Samuel_Hi_14_01"); //Ich bin Samuel. Nimm erstmal nen ordentlichen Schluck Grog. B_GiveInvItems (self, hero, ItFo_Addon_Grog, 1); B_UseItem (hero, ItFo_Addon_Grog); AI_Output(self, hero, "Info_Mod_Samuel_Hi_14_02"); //Wenn du mehr willst, dann geh zu Skip, ich bring mein Zeug meistens zu ihm. Ich hab nicht viel, aber wenn du willst, kann ich dir auch etwas verkaufen. Log_CreateTopic (TOPIC_MOD_HAENDLER_PIRATEN, LOG_NOTE); B_LogEntry (TOPIC_MOD_HAENDLER_PIRATEN, "Samuel hat ein wenig Grog, den er mir verkaufen könnte."); }; INSTANCE Info_Mod_Samuel_Auftrag (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_Auftrag_Condition; information = Info_Mod_Samuel_Auftrag_Info; permanent = 0; important = 0; description = "Greg schickt mich"; }; FUNC INT Info_Mod_Samuel_Auftrag_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_Hi)) && (Npc_KnowsInfo(hero, Info_Mod_Greg_Karte)) { return 1; }; }; FUNC VOID Info_Mod_Samuel_Auftrag_Info() { AI_Output(hero, self, "Info_Mod_Samuel_Auftrag_15_00"); //Greg schickt mich. Ich soll mich nützlich machen, weil er in See stechen will. AI_Output(self, hero, "Info_Mod_Samuel_Auftrag_14_01"); //Sehr gut, ich brauch jemanden der mir die Zutaten für nen ordentlichen Rum beschafft. AI_Output(self, hero, "Info_Mod_Samuel_Auftrag_14_02"); //Bring mir 10 Gläser Melasse und 20 Flaschen Wasser. AI_Output(hero, self, "Info_Mod_Samuel_Auftrag_15_03"); //Lasse? AI_Output(self, hero, "Info_Mod_Samuel_Auftrag_14_04"); //Melasse! Sowas ähnliches wie Honig. AI_Output(self, hero, "Info_Mod_Samuel_Auftrag_14_05"); //Daraus lässt sich ein anständiger rum brauen, sag ich dir! AI_Output(hero, self, "Info_Mod_Samuel_Auftrag_15_06"); //Und woher krieg ich Melasse? AI_Output(self, hero, "Info_Mod_Samuel_Auftrag_14_07"); //Aus der Stadt. Entweder am Markt oder im Hafenviertel. Log_CreateTopic (TOPIC_MOD_SAMUEL_RUM, LOG_MISSION); B_SetTopicStatus (TOPIC_MOD_SAMUEL_RUM, LOG_RUNNING); B_LogEntry (TOPIC_MOD_SAMUEL_RUM, "Ich soll in der Stadt Khorinis 10 Gläser Melasse und 20 Flaschen Wasser besorgen."); }; INSTANCE Info_Mod_Samuel_HabZeug (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_HabZeug_Condition; information = Info_Mod_Samuel_HabZeug_Info; permanent = 0; important = 0; description = "Ich hab das Zeug."; }; FUNC INT Info_Mod_Samuel_HabZeug_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_Auftrag)) && (Npc_HasItems(hero, ItFo_Water) > 19) && (Npc_HasItems(hero, ItFo_Melasse) > 9) { return 1; }; }; FUNC VOID Info_Mod_Samuel_HabZeug_Info() { AI_Output(hero, self, "Info_Mod_Samuel_HabZeug_15_00"); //Ich hab das Zeug. Npc_RemoveInvItems (hero, ItFo_Water, 20); Npc_RemoveInvItems (hero, ItFo_Melasse, 20); B_ShowGivenThings ("20 Wasser und 20 Melasse gegeben"); AI_Output(self, hero, "Info_Mod_Samuel_HabZeug_14_01"); //Gut, dann haben wir unseren Rumvorrat gesichert. AI_Output(self, hero, "Info_Mod_Samuel_HabZeug_14_02"); //Hier ist dein Gold. B_GiveInvItems (self, hero, ItMi_Gold, 400); B_GivePlayerXP (200); Mod_PiratenVorbereitungen += 1; B_Göttergefallen(2, 1); B_SetTopicStatus (TOPIC_MOD_SAMUEL_RUM, LOG_SUCCESS); B_LogEntry (TOPIC_MOD_PIRATEN_SCHATZSUCHE, "Ich habe Samuel geholfen den Rumvorrat zu sichern."); }; INSTANCE Info_Mod_Samuel_SkipFleisch (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_SkipFleisch_Condition; information = Info_Mod_Samuel_SkipFleisch_Info; permanent = 0; important = 0; description = "Hallo! Hab hier 'nen Haufen Fleisch."; }; FUNC INT Info_Mod_Samuel_SkipFleisch_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Skip_Fleisch)) && (Npc_HasItems(hero, ItFo_MuttonRaw) >= 30) { return 1; }; }; FUNC VOID Info_Mod_Samuel_SkipFleisch_Info() { AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch_15_00"); //Hallo! Hab hier 'nen Haufen Fleisch. Du sollst es pökeln. Und dich beeilen. B_GiveInvItems (hero, self, ItFo_MuttonRaw, 30); AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch_14_01"); //Pökeln? Will Greg auslaufen? AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch_15_02"); //Gewiss. Er hat da eine Schatzkarte ... AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch_14_03"); //Das ist mal was Neues. Morgen ist das Fleisch fertig. B_LogEntry (TOPIC_MOD_SKIP_VORRÄTE, "Samuel wird das Fleisch morgen fertig haben. Ich sollte mich solange um die anderen kümmern ..."); Mod_PIR_Samuel_Poekelfleisch = Wld_GetDay(); }; INSTANCE Info_Mod_Samuel_SkipFleisch2 (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_SkipFleisch2_Condition; information = Info_Mod_Samuel_SkipFleisch2_Info; permanent = 0; important = 0; description = "Bist du fertig?"; }; FUNC INT Info_Mod_Samuel_SkipFleisch2_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_SkipFleisch)) && (Wld_GetDay() > Mod_PIR_Samuel_Poekelfleisch) { return 1; }; }; FUNC VOID Info_Mod_Samuel_SkipFleisch2_Info() { AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch2_15_00"); //Bist du fertig? AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch2_14_01"); //Leider nicht. Mir ist das Salz ausgegangen. AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch2_15_02"); //Und wo kriegst du neues her? AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch2_14_03"); //Das ist das Problem. Sonst hab ich es hinten in der Höhle geschlagen. AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch2_14_04"); //Aber da nisten seit kurzem Minecrawler drin. Da bringt mich keiner mehr rein. AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch2_15_05"); //Dann muss ich mich wohl um das Salz kümmern. AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch2_14_06"); //So ist es. Ich brauche mindest dreis Brocken. AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch2_15_07"); //Immer auf die Kleinen ... B_LogEntry (TOPIC_MOD_SKIP_VORRÄTE, "Leider ist Samuel mit dem Fleisch noch nicht fertig, da ihm das Salz ausgegangen ist. In der Höhle am Nordstrand ist eine Salzader, doch dort sind seit kurzem einige Minecrawler. Aber ich habe wohl keine Wahl ..."); Wld_InsertNpc (Minecrawler, "ADW_PIRATECAMP_CAVE3_04"); Wld_InsertNpc (Minecrawler, "ADW_PIRATECAMP_CAVE3_04"); Wld_InsertNpc (MinecrawlerWarrior, "ADW_PIRATECAMP_CAVE3_04"); }; INSTANCE Info_Mod_Samuel_SkipFleisch3 (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_SkipFleisch3_Condition; information = Info_Mod_Samuel_SkipFleisch3_Info; permanent = 0; important = 0; description = "Hier, dein Salz."; }; FUNC INT Info_Mod_Samuel_SkipFleisch3_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_SkipFleisch2)) && (Npc_HasItems(hero, ItMi_Salznugget) >= 3) { return 1; }; }; FUNC VOID Info_Mod_Samuel_SkipFleisch3_Info() { AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch3_15_00"); //Hier, dein Salz. B_GiveInvItems (hero, self, ItMi_Salznugget, 3); AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch3_15_01"); //Die paar Crawler hättest du aber selbst ... AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch3_14_02"); //Wo denkst du hin? Ich bin Gelehrter, kein Schlächter. AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch3_15_03"); //Also gut. Wann kann ich ... AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch3_14_04"); //Das Fleisch muss über Nacht reifen. AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch3_15_05"); //Also morgen? AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch3_14_06"); //Genau. B_LogEntry (TOPIC_MOD_SKIP_VORRÄTE, "Morgen sollte das Fleisch dann fertig sein."); Mod_PIR_Samuel_Poekelfleisch = Wld_GetDay(); }; INSTANCE Info_Mod_Samuel_SkipFleisch4 (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_SkipFleisch4_Condition; information = Info_Mod_Samuel_SkipFleisch4_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Samuel_SkipFleisch4_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_SkipFleisch3)) && (Wld_GetDay() > Mod_PIR_Samuel_Poekelfleisch) { return 1; }; }; FUNC VOID Info_Mod_Samuel_SkipFleisch4_Info() { AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch4_14_00"); //Du kommst genau richtig. Das Fleisch ist fertig. B_GiveInvItems (self, hero, ItFo_Poekelfleisch_Skip, 30); AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch4_15_01"); //Ich kann's also Skip bringen? AI_Output(self, hero, "Info_Mod_Samuel_SkipFleisch4_14_02"); //Ja. Sag ihm, er soll's noch zum Trocknen auslegen oder -hängen. AI_Output(hero, self, "Info_Mod_Samuel_SkipFleisch4_15_03"); //Mach ich. B_LogEntry (TOPIC_MOD_SKIP_VORRÄTE, "Ich hab das gepökelte Fleisch. Jetzt auf zu Skip ..."); }; INSTANCE Info_Mod_Samuel_Kompass (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_Kompass_Condition; information = Info_Mod_Samuel_Kompass_Info; permanent = 0; important = 0; description = "Greg glaubt, du hast einlge Eisspruchrollen. Kann ich die haben?"; }; FUNC INT Info_Mod_Samuel_Kompass_Condition() { if (Mod_VorbereitungenFertig == 4) { return 1; }; }; FUNC VOID Info_Mod_Samuel_Kompass_Info() { AI_Output(hero, self, "Info_Mod_Samuel_Kompass_15_00"); //Greg glaubt, du hast einlge Eisspruchrollen. Kann ich die haben? AI_Output(self, hero, "Info_Mod_Samuel_Kompass_14_01"); //Hm ... Ungern. Ich brauch manchmal Eis für meine Tränke. AI_Output(self, hero, "Info_Mod_Samuel_Kompass_14_02"); //UndSkip kommt öfters und holt sich welches. Er meint, Rum auf Eis schmecke besser als ohne. AI_Output(hero, self, "Info_Mod_Samuel_Kompass_15_03"); //Ich muss rüber zum anderen Strand, da sind wahrscheinlich Feuerwarane. Da kann ich die Rollen gut gebrauchen. AI_Output(hero, self, "Info_Mod_Samuel_Kompass_15_04"); //Ich besorg dir auch später wieder welche. Versprochen. AI_Output(self, hero, "Info_Mod_Samuel_Kompass_14_05"); //Nun gut. Hier hast du drei Stück. B_GiveInvItems (self, hero, ItSc_IceCube, 3); AI_Output(hero, self, "Info_Mod_Samuel_Kompass_15_06"); //Danke. }; INSTANCE Info_Mod_Samuel_SkipToDead (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_SkipToDead_Condition; information = Info_Mod_Samuel_SkipToDead_Info; permanent = 0; important = 0; description = "Samuel, du musst mir unbedingt helfen."; }; FUNC INT Info_Mod_Samuel_SkipToDead_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_Hi)) && (Npc_KnowsInfo(hero, Info_Mod_Skip_Befreiung)) { return 1; }; }; FUNC VOID Info_Mod_Samuel_SkipToDead_Info() { AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_00"); //Samuel, du musst mir unbedingt helfen. AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_01"); //Was ist denn los? AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_02"); //Skip wurde während des großen Kampfes schwer verwundet und wird ohne die richtige Medizin sicher bald sterben. AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_03"); //Was hat er denn? AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_04"); //Er wurde von einem Feuerball getroffen. AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_05"); //Da gibt es tatsächlich einen Trank dagegen. Er nennt sich "Adanos Wohltat". AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_06"); //In den alten Schriften hier in Jharkendar habe ich einst das Rezept dazu gefunden. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_07"); //Kannst du mir diesen Trank geben. AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_08"); //Leider konnte ich ihn nie brauen, weil ich die Zutaten dafür nicht hatte. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_09"); //Was für Zutaten brauchst du denn? AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_10"); //Insgesamt sind es drei wichtige Sachen, die ich benötige. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_11"); //Welche sind das? AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_12"); //Zuerst brauche ich eine Rune der leichten Wundheilung. Ein Stück des Runensteins ist notwendig für die Wirkung des Trankes. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_13"); //Wo finde ich eine solche Rune? AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_14"); //Frag mal diesen Myxir, vielleicht hat er eine. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_15"); //Was brauchst du noch? AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_16"); //Als Zweites benötige ich eine Trollkirsche. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_17"); //Wo kann ich eine Trollkirsche bekommen? AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_18"); //Am südlichen Strand müsste ein Troll rumlungern. In den Exkrementen der Trolle kannst du solche Früchte finden. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_19"); //Und als Letztes? AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_20"); //Es fehlen noch ein paar Kräuter. Ein Kronstöckl, vier Heilpflanzen und fünf Feuernesseln. AI_Output(self, hero, "Info_Mod_Samuel_SkipToDead_14_21"); //Die findest du eigentlich überall, nur beim Kronstöckl musst du etwas suchen. AI_Output(hero, self, "Info_Mod_Samuel_SkipToDead_15_22"); //Gut, ich mach mich sofort auf den Weg. B_LogEntry (TOPIC_MOD_BEL_PIRSKIP, "Samuel kennt das Rezept für einen Heiltrank, der Skip retten kann, doch die Liste mit benötigten Zutaten ist lang. Neben einer Rune der leichten Wundheilung, die ich mit etwas Glück bei Myxir bekommen kann, brauche ich auch noch eine Trollkirsche, die in den Exkrementen von Trollen zu finden sein soll, einen Kronstöckl, vier Heilpflanzen und fünf Feuernesseln. Ein Troll soll sich zur Zeit beim südlichen Strand befinden, den Rest muss ich wohl suchen."); B_TeachPlayerTalentAlchemy (self, hero, POTION_AdanosWohltat); Wld_InsertNpc (Troll, "FP_ROAM_LONEBEACH_11"); Wld_InsertItem (ItPl_Trollkirsche, "FP_ITEM_TROLLKIRSCHE_01"); Wld_InsertItem (ItPl_Trollkirsche, "FP_ITEM_TROLLKIRSCHE_02"); Wld_InsertItem (ItPl_Perm_Herb, "FP_ITEM_KRONSTOECKL_01"); }; INSTANCE Info_Mod_Samuel_AdanosWohltat (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_AdanosWohltat_Condition; information = Info_Mod_Samuel_AdanosWohltat_Info; permanent = 0; important = 0; description = "Ich habe alle Sachen."; }; FUNC INT Info_Mod_Samuel_AdanosWohltat_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_SkipToDead)) && (Npc_HasItems(hero, ItRu_LightHeal) >= 1) && (Npc_HasItems(hero, ItPl_Trollkirsche) >= 1) && (Npc_HasItems(hero, ItPl_Perm_Herb) >= 1) && (Npc_HasItems(hero, ItPl_Mana_Herb_01) >= 5) && (Npc_HasItems(hero, ItPl_Health_Herb_01) >= 4) && (!Npc_KnowsInfo(hero, Info_Mod_Skip_Befreiung2)) { return 1; }; }; FUNC VOID Info_Mod_Samuel_AdanosWohltat_Info() { AI_Output(hero, self, "Info_Mod_Samuel_AdanosWohltat_15_00"); //Ich habe alle Sachen, die du benötgst, gefunden. B_ShowGivenThings ("Gegenstände gegeben"); Npc_RemoveInvItems (hero, ItRu_LightHeal, 1); Npc_RemoveInvItems (hero, ItPl_Trollkirsche, 1); Npc_RemoveInvItems (hero, ItPl_Perm_Herb, 1); Npc_RemoveInvItems (hero, ItPl_Mana_Herb_01, 5); Npc_RemoveInvItems (hero, ItPl_Health_Herb_01, 4); AI_Output(self, hero, "Info_Mod_Samuel_AdanosWohltat_14_01"); //Sehr gut. Ich habe bis morgen sicher den Trank fertig. Komme dann wieder. AI_Output(hero, self, "Info_Mod_Samuel_AdanosWohltat_15_02"); //Ok. B_LogEntry (TOPIC_MOD_BEL_PIRSKIP, "Ich habe Samuel die Zutaten gebracht. Bis morgen wird er den Trank fertig haben."); Mod_SamuelSkipsTrank = Wld_GetDay(); B_GivePlayerXP (250); }; INSTANCE Info_Mod_Samuel_AdanosWohltat2 (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_AdanosWohltat2_Condition; information = Info_Mod_Samuel_AdanosWohltat2_Info; permanent = 0; important = 0; description = "Und?"; }; FUNC INT Info_Mod_Samuel_AdanosWohltat2_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_AdanosWohltat)) && (Wld_GetDay() > Mod_SamuelSkipsTrank) { return 1; }; }; FUNC VOID Info_Mod_Samuel_AdanosWohltat2_Info() { AI_Output(hero, self, "Info_Mod_Samuel_AdanosWohltat2_15_00"); //Und? AI_Output(self, hero, "Info_Mod_Samuel_AdanosWohltat2_14_01"); //Es hat lange gedauert, aber hier ist der Trank. Bring' ihn schleunigst zu Skip. B_GiveInvItems (self, hero, ItPo_AdanosWohltat, 1); AI_Output(hero, self, "Info_Mod_Samuel_AdanosWohltat2_15_02"); //Verstanden. B_LogEntry (TOPIC_MOD_BEL_PIRSKIP, "Samuel hat mir den Trank gegeben. Jetzt sollte ich schnell zu Skip."); B_GivePlayerXP (100); }; INSTANCE Info_Mod_Samuel_Trade (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_Trade_Condition; information = Info_Mod_Samuel_Trade_Info; permanent = 1; important = 0; trade = 1; description = DIALOG_TRADE; }; FUNC INT Info_Mod_Samuel_Trade_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Samuel_Hi)) { return 1; }; }; FUNC VOID Info_Mod_Samuel_Trade_Info() { Backup_Questitems(); B_GiveTradeInv (self); B_Say (hero, self, "$TRADE_1"); }; INSTANCE Info_Mod_Samuel_Pickpocket (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_Pickpocket_Condition; information = Info_Mod_Samuel_Pickpocket_Info; permanent = 1; important = 0; description = Pickpocket_90; }; FUNC INT Info_Mod_Samuel_Pickpocket_Condition() { C_Beklauen (84, ItFo_Addon_Rum, 19); }; FUNC VOID Info_Mod_Samuel_Pickpocket_Info() { Info_ClearChoices (Info_Mod_Samuel_Pickpocket); Info_AddChoice (Info_Mod_Samuel_Pickpocket, DIALOG_BACK, Info_Mod_Samuel_Pickpocket_BACK); Info_AddChoice (Info_Mod_Samuel_Pickpocket, DIALOG_PICKPOCKET, Info_Mod_Samuel_Pickpocket_DoIt); }; FUNC VOID Info_Mod_Samuel_Pickpocket_BACK() { Info_ClearChoices (Info_Mod_Samuel_Pickpocket); }; FUNC VOID Info_Mod_Samuel_Pickpocket_DoIt() { if (B_Beklauen() == TRUE) { Info_ClearChoices (Info_Mod_Samuel_Pickpocket); } else { Info_ClearChoices (Info_Mod_Samuel_Pickpocket); Info_AddChoice (Info_Mod_Samuel_Pickpocket, DIALOG_PP_BESCHIMPFEN, Info_Mod_Samuel_Pickpocket_Beschimpfen); Info_AddChoice (Info_Mod_Samuel_Pickpocket, DIALOG_PP_BESTECHUNG, Info_Mod_Samuel_Pickpocket_Bestechung); Info_AddChoice (Info_Mod_Samuel_Pickpocket, DIALOG_PP_HERAUSREDEN, Info_Mod_Samuel_Pickpocket_Herausreden); }; }; FUNC VOID Info_Mod_Samuel_Pickpocket_Beschimpfen() { B_Say (hero, self, "$PICKPOCKET_BESCHIMPFEN"); B_Say (self, hero, "$DIRTYTHIEF"); Info_ClearChoices (Info_Mod_Samuel_Pickpocket); AI_StopProcessInfos (self); B_Attack (self, hero, AR_Theft, 1); }; FUNC VOID Info_Mod_Samuel_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_Samuel_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_Samuel_Pickpocket); AI_StopProcessInfos (self); }; }; FUNC VOID Info_Mod_Samuel_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_Samuel_Pickpocket); } else { B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_02"); }; }; INSTANCE Info_Mod_Samuel_EXIT (C_INFO) { npc = Mod_940_PIR_Samuel_AW; nr = 1; condition = Info_Mod_Samuel_EXIT_Condition; information = Info_Mod_Samuel_EXIT_Info; permanent = 1; important = 0; description = DIALOG_ENDE; }; FUNC INT Info_Mod_Samuel_EXIT_Condition() { return 1; }; FUNC VOID Info_Mod_Samuel_EXIT_Info() { AI_StopProcessInfos (self); };
D
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ module flow.engine.impl.cmd.RemoveEventConsumerCommand; import flow.common.api.FlowableIllegalArgumentException; import flow.common.interceptor.Command; import flow.common.interceptor.CommandContext; import flow.engine.impl.util.CommandContextUtil; import flow.event.registry.api.EventRegistryEventConsumer; import hunt.Object; class RemoveEventConsumerCommand : Command!Void { protected EventRegistryEventConsumer eventConsumer; this(EventRegistryEventConsumer eventConsumer) { this.eventConsumer = eventConsumer; } override public Void execute(CommandContext commandContext) { if (eventConsumer is null) { throw new FlowableIllegalArgumentException("event consumer is null."); } CommandContextUtil.getEventRegistry().removeFlowableEventRegistryEventConsumer(eventConsumer); return null; } }
D
# FIXED third_party/exosite/exosite_meta.obj: C:/ti/TivaWare_C_Series-2.1.4.178/third_party/exosite/exosite_meta.c third_party/exosite/exosite_meta.obj: C:/ti/TivaWare_C_Series-2.1.4.178/third_party/exosite/exosite_meta.h third_party/exosite/exosite_meta.obj: C:/ti/TivaWare_C_Series-2.1.4.178/examples/boards/ek-tm4c1294xl-boostxl-senshub/drivers/exosite_hal_lwip.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdint.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/stdint.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/cdefs.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_types.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_types.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_stdint.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_stdint.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdbool.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/string.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/_ti_config.h third_party/exosite/exosite_meta.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/linkage.h C:/ti/TivaWare_C_Series-2.1.4.178/third_party/exosite/exosite_meta.c: C:/ti/TivaWare_C_Series-2.1.4.178/third_party/exosite/exosite_meta.h: C:/ti/TivaWare_C_Series-2.1.4.178/examples/boards/ek-tm4c1294xl-boostxl-senshub/drivers/exosite_hal_lwip.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/cdefs.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_types.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_types.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdbool.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/string.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/_ti_config.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/linkage.h:
D
module abagames.util.gl; import std.stdio; version(BindBC) { import bindbc.opengl; } import abagames.util.conv; import abagames.util.math; import abagames.util.vector; static class GL { alias Matrix = float[16]; static const Matrix Identity = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, ]; enum MatrixMode { ModelView, Projection, } static void normalize(ref float[3] v) { float r; r = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); if (r == 0.0) return; v[0] /= r; v[1] /= r; v[2] /= r; } static void cross(float[3] v1, float[3] v2, out float[3] result) { result[0] = v1[1]*v2[2] - v1[2]*v2[1]; result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[2] = v1[0]*v2[1] - v1[1]*v2[0]; } version(GL_AllowDeprecated) { static void init() {} static void matrixMode(MatrixMode mode) { if (mode == MatrixMode.Projection) { glMatrixMode(GL.PROJECTION); } else if (mode == MatrixMode.ModelView) { glMatrixMode(GL.MODELVIEW); } } static void loadIdentity() { glLoadIdentity(); } static void pushMatrix() { glPushMatrix(); } static void popMatrix() { glPopMatrix(); } static void multMatrix(Matrix m) { glMultMatrixf(m.ptr); } static void translate(float x, float y, float z) { glTranslatef(x, y, z); } static void translate(Vector3 v) { translate(v.x, v.y, v.z); } static void rotate(float angle, float x, float y, float z) { glRotatef(angle, x, y, z); } static void scale(float x, float y, float z) { glScalef(x, y, z); } static void ortho(float left, float right, float bottom, float top, float near, float far) { glOrtho(left, right, bottom, top, near, far); } static void frustum(float left, float right, float bottom, float top, float near, float far) { glFrustum(left, right, bottom, top, near, far); } static void lookAt(float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) { int i; float[3] forward, side, up; forward[0] = centerx - eyex; forward[1] = centery - eyey; forward[2] = centerz - eyez; up[0] = upx; up[1] = upy; up[2] = upz; normalize(forward); /* Side = forward x up */ cross(forward, up, side); normalize(side); /* Recompute up as: up = side x forward */ cross(side, forward, up); Matrix m = Identity[]; m[0+4*0] = side[0]; m[0+4*1] = side[1]; m[0+4*2] = side[2]; m[1+4*0] = up[0]; m[1+4*1] = up[1]; m[1+4*2] = up[2]; m[2+4*0] = -forward[0]; m[2+4*1] = -forward[1]; m[2+4*2] = -forward[2]; GL.multMatrix(m); GL.translate(-eyex, -eyey, -eyez); } static void vertex(float x, float y, float z) { glVertex3f(x, y, z); } static void vertex(Vector3 v) { vertex(v.x, v.y, v.z); } static void color(float r, float g, float b, float a) { glColor4f(r, g, b, a); } static void viewport(int left, int right, int width, int height) { glViewport(left, right, width, height); } static void clearColor(float r, float g, float b, float a) { glClearColor(r, g, b, a); } static void clear(uint flag) { glClear(flag); } static void blendFunc(uint src, uint dest) { glBlendFunc(src, dest); } static void enable(uint flag) { glEnable(flag); } static void disable(uint flag) { glDisable(flag); } static void lineWidth(float w) { glLineWidth(w); } static void frameStart() {} static void frameEnd() {} static void begin(int primitiveType) { glBegin(primitiveType); } static void end() { glEnd(); } static const int QUADS = GL.QUADS; } else { enum : ubyte { FALSE = 0, TRUE = 1, } enum : uint { DEPTH_BUFFER_BIT = 0x00000100, STENCIL_BUFFER_BIT = 0x00000400, COLOR_BUFFER_BIT = 0x00004000, POINTS = 0x0000, LINES = 0x0001, LINE_LOOP = 0x0002, LINE_STRIP = 0x0003, TRIANGLES = 0x0004, TRIANGLE_STRIP = 0x0005, TRIANGLE_FAN = 0x0006, QUADS = 0x0007, NEVER = 0x0200, LESS = 0x0201, EQUAL = 0x0202, LEQUAL = 0x0203, GREATER = 0x0204, NOTEQUAL = 0x0205, GEQUAL = 0x0206, ALWAYS = 0x0207, ZERO = 0, ONE = 1, SRC_COLOR = 0x0300, ONE_MINUS_SRC_COLOR = 0x0301, SRC_ALPHA = 0x0302, ONE_MINUS_SRC_ALPHA = 0x0303, DST_ALPHA = 0x0304, ONE_MINUS_DST_ALPHA = 0x0305, DST_COLOR = 0x0306, ONE_MINUS_DST_COLOR = 0x0307, SRC_ALPHA_SATURATE = 0x0308, NONE = 0, FRONT_LEFT = 0x0400, FRONT_RIGHT = 0x0401, BACK_LEFT = 0x0402, BACK_RIGHT = 0x0403, FRONT = 0x0404, BACK = 0x0405, LEFT = 0x0406, RIGHT = 0x0407, FRONT_AND_BACK = 0x0408, NO_ERROR = 0, INVALID_ENUM = 0x0500, INVALID_VALUE = 0x0501, INVALID_OPERATION = 0x0502, OUT_OF_MEMORY = 0x0505, CW = 0x0900, CCW = 0x0901, POINT_SIZE = 0x0B11, POINT_SIZE_RANGE = 0x0B12, POINT_SIZE_GRANULARITY = 0x0B13, LINE_SMOOTH = 0x0B20, LINE_WIDTH = 0x0B21, LINE_WIDTH_RANGE = 0x0B22, LINE_WIDTH_GRANULARITY = 0x0B23, POLYGON_MODE = 0x0B40, POLYGON_SMOOTH = 0x0B41, CULL_FACE = 0x0B44, CULL_FACE_MODE = 0x0B45, FRONT_FACE = 0x0B46, DEPTH_RANGE = 0x0B70, DEPTH_TEST = 0x0B71, DEPTH_WRITEMASK = 0x0B72, DEPTH_CLEAR_VALUE = 0x0B73, DEPTH_FUNC = 0x0B74, STENCIL_TEST = 0x0B90, STENCIL_CLEAR_VALUE = 0x0B91, STENCIL_FUNC = 0x0B92, STENCIL_VALUE_MASK = 0x0B93, STENCIL_FAIL = 0x0B94, STENCIL_PASS_DEPTH_FAIL = 0x0B95, STENCIL_PASS_DEPTH_PASS = 0x0B96, STENCIL_REF = 0x0B97, STENCIL_WRITEMASK = 0x0B98, VIEWPORT = 0x0BA2, DITHER = 0x0BD0, BLEND_DST = 0x0BE0, BLEND_SRC = 0x0BE1, BLEND = 0x0BE2, LOGIC_OP_MODE = 0x0BF0, COLOR_LOGIC_OP = 0x0BF2, DRAW_BUFFER = 0x0C01, READ_BUFFER = 0x0C02, SCISSOR_BOX = 0x0C10, SCISSOR_TEST = 0x0C11, COLOR_CLEAR_VALUE = 0x0C22, COLOR_WRITEMASK = 0x0C23, DOUBLEBUFFER = 0x0C32, STEREO = 0x0C33, LINE_SMOOTH_HINT = 0x0C52, POLYGON_SMOOTH_HINT = 0x0C53, UNPACK_SWAP_BYTES = 0x0CF0, UNPACK_LSB_FIRST = 0x0CF1, UNPACK_ROW_LENGTH = 0x0CF2, UNPACK_SKIP_ROWS = 0x0CF3, UNPACK_SKIP_PIXELS = 0x0CF4, UNPACK_ALIGNMENT = 0x0CF5, PACK_SWAP_BYTES = 0x0D00, PACK_LSB_FIRST = 0x0D01, PACK_ROW_LENGTH = 0x0D02, PACK_SKIP_ROWS = 0x0D03, PACK_SKIP_PIXELS = 0x0D04, PACK_ALIGNMENT = 0x0D05, MAX_TEXTURE_SIZE = 0x0D33, MAX_VIEWPORT_DIMS = 0x0D3A, SUBPIXEL_BITS = 0x0D50, TEXTURE_1D = 0x0DE0, TEXTURE_2D = 0x0DE1, POLYGON_OFFSET_UNITS = 0x2A00, POLYGON_OFFSET_POINT = 0x2A01, POLYGON_OFFSET_LINE = 0x2A02, POLYGON_OFFSET_FILL = 0x8037, POLYGON_OFFSET_FACTOR = 0x8038, TEXTURE_BINDING_1D = 0x8068, TEXTURE_BINDING_2D = 0x8069, TEXTURE_WIDTH = 0x1000, TEXTURE_HEIGHT = 0x1001, TEXTURE_INTERNAL_FORMAT = 0x1003, TEXTURE_BORDER_COLOR = 0x1004, TEXTURE_RED_SIZE = 0x805C, TEXTURE_GREEN_SIZE = 0x805D, TEXTURE_BLUE_SIZE = 0x805E, TEXTURE_ALPHA_SIZE = 0x805F, DONT_CARE = 0x1100, FASTEST = 0x1101, NICEST = 0x1102, BYTE = 0x1400, UNSIGNED_BYTE = 0x1401, SHORT = 0x1402, UNSIGNED_SHORT = 0x1403, INT = 0x1404, UNSIGNED_INT = 0x1405, FLOAT = 0x1406, DOUBLE = 0x140A, CLEAR = 0x1500, AND = 0x1501, AND_REVERSE = 0x1502, COPY = 0x1503, AND_INVERTED = 0x1504, NOOP = 0x1505, XOR = 0x1506, OR = 0x1507, NOR = 0x1508, EQUIV = 0x1509, INVERT = 0x150A, OR_REVERSE = 0x150B, COPY_INVERTED = 0x150C, OR_INVERTED = 0x150D, NAND = 0x150E, SET = 0x150F, TEXTURE = 0x1702, COLOR = 0x1800, DEPTH = 0x1801, STENCIL = 0x1802, STENCIL_INDEX = 0x1901, DEPTH_COMPONENT = 0x1902, RED = 0x1903, GREEN = 0x1904, BLUE = 0x1905, ALPHA = 0x1906, RGB = 0x1907, RGBA = 0x1908, POINT = 0x1B00, LINE = 0x1B01, FILL = 0x1B02, KEEP = 0x1E00, REPLACE = 0x1E01, INCR = 0x1E02, DECR = 0x1E03, VENDOR = 0x1F00, RENDERER = 0x1F01, VERSION = 0x1F02, EXTENSIONS = 0x1F03, NEAREST = 0x2600, LINEAR = 0x2601, NEAREST_MIPMAP_NEAREST = 0x2700, LINEAR_MIPMAP_NEAREST = 0x2701, NEAREST_MIPMAP_LINEAR = 0x2702, LINEAR_MIPMAP_LINEAR = 0x2703, TEXTURE_MAG_FILTER = 0x2800, TEXTURE_MIN_FILTER = 0x2801, TEXTURE_WRAP_S = 0x2802, TEXTURE_WRAP_T = 0x2803, PROXY_TEXTURE_1D = 0x8063, PROXY_TEXTURE_2D = 0x8064, REPEAT = 0x2901, R3_G3_B2 = 0x2A10, RGB4 = 0x804F, RGB5 = 0x8050, RGB8 = 0x8051, RGB10 = 0x8052, RGB12 = 0x8053, RGB16 = 0x8054, RGBA2 = 0x8055, RGBA4 = 0x8056, RGB5_A1 = 0x8057, RGBA8 = 0x8058, RGB10_A2 = 0x8059, RGBA12 = 0x805A, RGBA16 = 0x805B, VERTEX_ARRAY = 0x8074, ARRAY_BUFFER = 0x8892, STREAM_DRAW = 0x88E0, FRAGMENT_SHADER = 0x8B30, VERTEX_SHADER = 0x8B31, COMPILE_STATUS = 0x8B81, LINK_STATUS = 0x8B82, VALIDATE_STATUS = 0x8B83, } private: struct MatrixState { static const int StackDepth = 16; Matrix[StackDepth] stack = [ Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], Identity[], ]; int stackIndex = 0; } static MatrixState[MatrixMode.max + 1] states; static MatrixMode currentMode = MatrixMode.ModelView; struct Vertex { align(1): float x, y, z; float r, g, b, a; } version(GL_Batching) { static const int MaxNumVertices = 32768; } else { static const int MaxNumVertices = 4096; } static uint program; static int vertPositionLocation, vertColorLocation, projectionLocation, modelViewLocation; static int currentPrimitiveType = -1; static float[4] currentColor = [1, 1, 1, 1]; static uint compileProgram(string vsSource, string fsSource) { char[1024] infoLog; int infoLogLength = 0; int status = 0; auto vsIndex = glCreateShader(GL.VERTEX_SHADER); { auto sourcePtr = cast(char*)vsSource.ptr; int sourceLen = vsSource.length; glShaderSource(vsIndex, 1, &sourcePtr, &sourceLen); glCompileShader(vsIndex); glGetShaderiv(vsIndex, GL.COMPILE_STATUS, &status); if (status == 0) { glGetShaderInfoLog(vsIndex, infoLog.length, &infoLogLength, infoLog.ptr); assert(false, infoLog[0..infoLogLength]); } } auto fsIndex = glCreateShader(GL.FRAGMENT_SHADER); { auto sourcePtr = cast(char*)fsSource.ptr; int sourceLen = fsSource.length; glShaderSource(fsIndex, 1, &sourcePtr, &sourceLen); glCompileShader(fsIndex); glGetShaderiv(fsIndex, GL.COMPILE_STATUS, &status); if (status == 0) { glGetShaderInfoLog(fsIndex, infoLog.length, &infoLogLength, infoLog.ptr); assert(false, infoLog[0..infoLogLength]); } } auto progIndex = glCreateProgram(); { glAttachShader(progIndex, vsIndex); glAttachShader(progIndex, fsIndex); glLinkProgram(progIndex); glGetProgramiv(progIndex, GL.LINK_STATUS, &status); if (status == 0) { glGetProgramInfoLog(progIndex, infoLog.length, &infoLogLength, infoLog.ptr); assert(false, infoLog[0..infoLogLength]); } glValidateProgram(progIndex); glGetProgramiv(progIndex, GL.VALIDATE_STATUS, &status); if (status == 0) { glGetProgramInfoLog(progIndex, infoLog.length, &infoLogLength, infoLog.ptr); assert(false, infoLog[0..infoLogLength]); } } return progIndex; } static void createBuffer(ref uint arrayIndex, ref uint bufferIndex, ref Vertex[MaxNumVertices] buffer) { glGenVertexArrays(1, &arrayIndex); glBindVertexArray(arrayIndex); glGenBuffers(1, &bufferIndex); glBindBuffer(GL.ARRAY_BUFFER, bufferIndex); glBufferData(GL.ARRAY_BUFFER, buffer.sizeof, null, GL.STREAM_DRAW); glEnableVertexAttribArray(vertPositionLocation); glVertexAttribPointer(vertPositionLocation, 3, GL.FLOAT, GL.FALSE, 7 * float.sizeof, cast(void*)0); glEnableVertexAttribArray(vertColorLocation); glVertexAttribPointer(vertColorLocation, 4, GL.FLOAT, GL.FALSE, 7 * float.sizeof, cast(void*)(3 * float.sizeof)); glBindVertexArray(0); } static Matrix mult(Matrix m1, Matrix m2) { Matrix r; for(int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { r[j+4*i] = m1[0+4*i] * m2[j+4*0] + m1[1+4*i] * m2[j+4*1] + m1[2+4*i] * m2[j+4*2] + m1[3+4*i] * m2[j+4*3]; } } return r; } public: static void init() { version(WASM) { program = compileProgram( ` precision mediump float; uniform mat4 projection; uniform mat4 modelView; attribute vec3 vertPosition; attribute vec4 vertColor; varying vec4 fragColor; void main() { fragColor = vertColor; gl_Position = projection * modelView * vec4(vertPosition, 1.0); } `, ` precision mediump float; varying vec4 fragColor; void main() { gl_FragColor = fragColor; } ` ); } else { program = compileProgram( ` #version 120 uniform mat4 projection; uniform mat4 modelView; attribute vec3 vertPosition; attribute vec4 vertColor; varying vec4 fragColor; void main() { fragColor = vertColor; gl_Position = projection * modelView * vec4(vertPosition, 1.0); } `, ` #version 120 varying vec4 fragColor; void main() { gl_FragColor = fragColor; } ` ); } projectionLocation = glGetUniformLocation(program, "projection"); modelViewLocation = glGetUniformLocation(program, "modelView"); vertPositionLocation = glGetAttribLocation(program, "vertPosition"); vertColorLocation = glGetAttribLocation(program, "vertColor"); glUseProgram(program); customInit(); } static void matrixMode(MatrixMode mode) { if (currentMode == MatrixMode.ModelView && mode == MatrixMode.Projection) { flush(); } currentMode = mode; } static void loadIdentity() { states[currentMode].stack[states[currentMode].stackIndex] = Identity[]; } static void pushMatrix() { states[currentMode].stackIndex++; states[currentMode].stack[states[currentMode].stackIndex] = states[currentMode].stack[states[currentMode].stackIndex - 1]; assert(states[currentMode].stackIndex < MatrixState.StackDepth); } static void popMatrix() { assert(states[currentMode].stackIndex > 0); states[currentMode].stackIndex--; } static void multMatrix(Matrix m) { states[currentMode].stack[states[currentMode].stackIndex] = mult(m, states[currentMode].stack[states[currentMode].stackIndex]); } static void translate(float x, float y, float z) { multMatrix([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1, ]); } static void translate(Vector3 v) { translate(v.x, v.y, v.z); } static void rotate(float angle, float x, float y, float z) { float angleRad = PI * angle / 180.0f; float sina = sin(angleRad); float cosa = cos(angleRad); float oneMinusCosa = 1.0f - cosa; float nxsq = x * x; float nysq = y * y; float nzsq = z * z; Matrix mat = Identity[]; mat[0] = nxsq + (1.0f - nxsq) * cosa; mat[4] = x * y * oneMinusCosa - z * sina; mat[8] = x * z * oneMinusCosa + y * sina; mat[1] = x * y * oneMinusCosa + z * sina; mat[5] = nysq + (1.0f - nysq) * cosa; mat[9] = y * z * oneMinusCosa - x * sina; mat[2] = x * z * oneMinusCosa - y * sina; mat[6] = y * z * oneMinusCosa + x * sina; mat[10] = nzsq + (1.0f - nzsq) * cosa; multMatrix(mat); } static void scale(float x, float y, float z) { multMatrix([ x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1, ]); } static void ortho(float left, float right, float bottom, float top, float near, float far) { float dx = right - left; float dy = top - bottom; float dz = far - near; float tx = -(right + left) / dx; float ty = -(top + bottom) / dy; float tz = -(far + near) / dz; float sx = 2.0f / dx; float sy = 2.0f / dy; float sz = -2.0f / dz; Matrix mat = Identity[]; mat[0] = sx; mat[5] = sy; mat[10] = sz; mat[12] = tx; mat[13] = ty; mat[14] = tz; multMatrix(mat); } static void frustum(float left, float right, float bottom, float top, float near, float far) { float dx = right - left; float dy = top - bottom; float dz = far - near; float a = (right + left) / dx; float b = (top + bottom) / dy; float c = -(far + near) / dz; float d = -2.0f * far * near / dz; Matrix mat = Identity[]; mat[0] = 2.0f * near / dx; mat[5] = 2.0f * near / dy; mat[8] = a; mat[9] = b; mat[10] = c; mat[11] = -1.0f; mat[14] = d; mat[15] = 0; multMatrix(mat); } static void lookAt(float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) { int i; float[3] forward, side, up; forward[0] = centerx - eyex; forward[1] = centery - eyey; forward[2] = centerz - eyez; up[0] = upx; up[1] = upy; up[2] = upz; normalize(forward); /* Side = forward x up */ cross(forward, up, side); normalize(side); /* Recompute up as: up = side x forward */ cross(side, forward, up); Matrix m = Identity[]; m[0+4*0] = side[0]; m[0+4*1] = side[1]; m[0+4*2] = side[2]; m[1+4*0] = up[0]; m[1+4*1] = up[1]; m[1+4*2] = up[2]; m[2+4*0] = -forward[0]; m[2+4*1] = -forward[1]; m[2+4*2] = -forward[2]; GL.multMatrix(m); GL.translate(-eyex, -eyey, -eyez); } static Matrix getMatrix(MatrixMode mode) { return states[mode].stack[states[mode].stackIndex]; } static Vertex transform(float x, float y, float z) { Matrix c = mult([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1, ], getMatrix(MatrixMode.ModelView)); return Vertex(c[12], c[13], c[14], currentColor[0], currentColor[1], currentColor[2], currentColor[3]); } static void vertex(Vector3 v) { vertex(v.x, v.y, v.z); } static void color(float r, float g, float b, float a) { currentColor = [r, g, b, a]; } static void viewport(int left, int right, int width, int height) { flush(); glViewport(left, right, width, height); } static void clearColor(float r, float g, float b, float a) { glClearColor(r, g, b, a); } static void clear(uint flag) { glClear(flag); } static void blendFunc(uint src, uint dest) { flush(); glBlendFunc(src, dest); } static void enable(uint flag) { flush(); glEnable(flag); } static void disable(uint flag) { flush(); glDisable(flag); } static void lineWidth(float w) { flush(); glLineWidth(w); } version(GL_Batching) { static uint triArrayIndex, triBufferIndex; static uint lineArrayIndex, lineBufferIndex; static Vertex[MaxNumVertices] triangles; static int currentTriCount = 0; static int currentTriStartIndex = 0; static Vertex[MaxNumVertices] lines; static int currentLineCount = 0; static int currentLineStartIndex = 0; static void customInit() { createBuffer(triArrayIndex, triBufferIndex, triangles); createBuffer(lineArrayIndex, lineBufferIndex, lines); } static void frameStart() { } static void frameEnd() { flush(); } static void begin(int primitiveType) { currentPrimitiveType = primitiveType; currentTriStartIndex = currentTriCount; currentLineStartIndex = currentLineCount; } static void pushTriVertex(float x, float y, float z) { assert(currentTriCount < triangles.length, "pushTriVertex(x, y, z): vertex count is " ~ convString(currentTriCount)); triangles[currentTriCount] = transform(x, y, z); currentTriCount++; } static void pushTriVertex(int n) { assert(currentTriCount < triangles.length, "pushTriVertex(n): vertex count is " ~ convString(currentTriCount)); assert(n >= 0 && n < triangles.length, "pushTriVertex(n): invalid index " ~ convString(n)); triangles[currentTriCount] = triangles[n]; currentTriCount++; } static void pushLineVertex(float x, float y, float z) { assert(currentLineCount < lines.length, "pushLineVertex(x, y, z): vertex count is " ~ convString(currentLineCount)); lines[currentLineCount] = transform(x, y, z); currentLineCount++; } static void pushLineVertex(int n) { assert(currentLineCount < lines.length, "pushLineVertex(n): vertex count is " ~ convString(currentLineCount)); assert(n >= 0 && n < lines.length, "pushLineVertex(n): invalid index " ~ convString(n)); lines[currentLineCount] = lines[n]; currentLineCount++; } static void vertex(float x, float y, float z) { assert(currentPrimitiveType != -1); if (currentPrimitiveType == GL.TRIANGLES) { pushTriVertex(x, y, z); } else if (currentPrimitiveType == GL.TRIANGLE_FAN) { int n = currentTriCount; if ((n - currentTriStartIndex) >= 3) { pushTriVertex(currentTriStartIndex); pushTriVertex(n - 1); pushTriVertex(x, y, z); } else { pushTriVertex(x, y, z); } } else if (currentPrimitiveType == GL.TRIANGLE_STRIP) { int n = currentTriCount; if ((n - currentTriStartIndex) >= 3) { if ((n / 3) % 2 == 0) { pushTriVertex(n - 2); pushTriVertex(n - 1); pushTriVertex(x, y, z); } else { pushTriVertex(n - 1); pushTriVertex(n - 2); pushTriVertex(x, y, z); } } else { pushTriVertex(x, y, z); } } else if (currentPrimitiveType == GL.QUADS) { int n = currentTriCount; if (n >= 3 && (n - currentTriStartIndex) % 3 == 0 && (n - currentTriStartIndex) % 6 != 0) { pushTriVertex(n - 3); pushTriVertex(n - 1); pushTriVertex(x, y, z); } else { pushTriVertex(x, y, z); } } else if (currentPrimitiveType == GL.LINES) { pushLineVertex(x, y, z); } else if (currentPrimitiveType == GL.LINE_LOOP || currentPrimitiveType == GL.LINE_STRIP) { int n = currentLineCount; if ((n - currentLineStartIndex) >= 2) { pushLineVertex(n - 1); pushLineVertex(x, y, z); } else { pushLineVertex(x, y, z); } } } static void end() { assert(currentTriCount % 3 == 0, "end(): invalid triangle count " ~ convString(currentTriCount)); assert(currentLineCount % 2 == 0, "end(): invalid line count " ~ convString(currentLineCount)); if (currentPrimitiveType == GL.LINE_LOOP) { pushLineVertex(currentLineCount - 1); pushLineVertex(currentLineStartIndex); } } static void flush() { flushTriangles(); flushLines(); } static void flushTriangles() { if (currentTriCount > 0) { glBindVertexArray(triArrayIndex); glBindBuffer(GL.ARRAY_BUFFER, triBufferIndex); int size = currentTriCount * Vertex.sizeof; glBufferData(GL.ARRAY_BUFFER, size, null, GL.STREAM_DRAW); glBufferData(GL.ARRAY_BUFFER, size, triangles.ptr, GL.STREAM_DRAW); glUniformMatrix4fv(projectionLocation, 1, GL.FALSE, getMatrix(MatrixMode.Projection).ptr); glUniformMatrix4fv(modelViewLocation, 1, GL.FALSE, Identity.ptr); glDrawArrays(GL.TRIANGLES, 0, currentTriCount); glBindVertexArray(0); currentTriCount = 0; } } static void flushLines() { if (currentLineCount > 0) { glBindVertexArray(lineArrayIndex); glBindBuffer(GL.ARRAY_BUFFER, lineBufferIndex); int size = currentLineCount * Vertex.sizeof; glBufferData(GL.ARRAY_BUFFER, size, null, GL.STREAM_DRAW); glBufferData(GL.ARRAY_BUFFER, size, lines.ptr, GL.STREAM_DRAW); glUniformMatrix4fv(projectionLocation, 1, GL.FALSE, getMatrix(MatrixMode.Projection).ptr); glUniformMatrix4fv(modelViewLocation, 1, GL.FALSE, Identity.ptr); glDrawArrays(GL.LINES, 0, currentLineCount); glBindVertexArray(0); currentLineCount = 0; } } } else { static uint vertArrayIndex, vertBufferIndex; static Vertex[MaxNumVertices] vertices; static int currentVertexCount = 0; static void customInit() { createBuffer(vertArrayIndex, vertBufferIndex, vertices); } static void frameStart() {} static void frameEnd() {} static void flush() {} static void begin(int primitiveType) { currentPrimitiveType = primitiveType; } static void vertex(float x, float y, float z) { vertices[currentVertexCount] = Vertex(x, y, z, currentColor[0], currentColor[1], currentColor[2], currentColor[3]); currentVertexCount++; } static void end() { assert(currentPrimitiveType != -1); if (currentVertexCount > 0) { glBindVertexArray(vertArrayIndex); glBindBuffer(GL.ARRAY_BUFFER, vertBufferIndex); int size = currentVertexCount * Vertex.sizeof; glBufferData(GL.ARRAY_BUFFER, size, null, GL.STREAM_DRAW); glBufferData(GL.ARRAY_BUFFER, size, vertices.ptr, GL.STREAM_DRAW); glUniformMatrix4fv(projectionLocation, 1, GL.FALSE, getMatrix(MatrixMode.Projection).ptr); glUniformMatrix4fv(modelViewLocation, 1, GL.FALSE, getMatrix(MatrixMode.ModelView).ptr); glDrawArrays(currentPrimitiveType, 0, currentVertexCount); glBindVertexArray(0); currentVertexCount = 0; } } } } } version(WASM) { extern (C) { version(X86) { int glGetAttribLocation(uint, const(char)*) { return 0; } int glGetUniformLocation(uint, const(char)*) { return 0; } uint glCreateProgram() { return 0; } uint glCreateShader(uint) { return 0; } void glAttachShader(uint, uint) {} void glBindBuffer(uint, uint) {} void glBindVertexArray(uint) {} void glBlendFunc(uint, uint) {} void glBufferData(uint, int, const(void)*, uint) {} void glClear(uint) {} void glClearColor(float, float, float, float) {} void glCompileShader(uint) {} void glDisable(uint) {} void glDrawArrays(uint, int, int) {} void glEnable(uint) {} void glEnableVertexAttribArray(int) {} void glGenBuffers(int, uint*) {} void glGenVertexArrays(int, uint*) {} void glGetProgramInfoLog(uint, int, int* n, char*) { *n = 0; } void glGetProgramiv(uint, uint, int* v) { *v = 1; } void glGetShaderInfoLog(uint, int, int* n, char*) { *n = 0; } void glGetShaderiv(uint, uint, int* v) { *v = 1; } void glLineWidth(float) {} void glLinkProgram(uint) {} void glShaderSource(uint, int, const(char*)*, const(int)*) {} void glUniformMatrix4fv(int, int, ubyte, const(float)*) {} void glUseProgram(uint) {} void glValidateProgram(uint) {} void glVertexAttribPointer(uint, int, uint, ubyte, int, const(void)*) {} void glViewport(int, int, int, int) {} } else { int glGetAttribLocationWithLen(uint, const(char*), uint); int glGetAttribLocation(uint p, string n) { return glGetAttribLocationWithLen(p, n.ptr, n.length); } int glGetUniformLocationWithLen(uint, const(char*), uint); int glGetUniformLocation(uint p, string n) { return glGetUniformLocationWithLen(p, n.ptr, n.length); } uint glCreateProgram(); uint glCreateShader(uint); void glAttachShader(uint, uint); void glBindBuffer(uint, uint); void glBindVertexArray(uint); void glBlendFunc(uint, uint); void glBufferData(uint, int, const(void)*, uint); void glClear(uint); void glClearColor(float, float, float, float); void glCompileShader(uint); void glDisable(uint); void glDrawArrays(uint, int, int); void glEnable(uint); void glEnableVertexAttribArray(int); void glGenBuffers(int, uint*); void glGenVertexArrays(int, uint*); void glGetProgramInfoLog(uint, int, int*, char*); void glGetProgramiv(uint, uint, int*); void glGetShaderInfoLog(uint, int, int*, char*); void glGetShaderiv(uint, uint, int*); void glLineWidth(float); void glLinkProgram(uint); void glShaderSource(uint, int, const(char*)*, const(int)*); void glUniformMatrix4fv(int, int, ubyte, const(float)*); void glUseProgram(uint); void glValidateProgram(uint); void glVertexAttribPointer(uint, int, uint, ubyte, int, const(void)*); void glViewport(int, int, int, int); } } }
D
/home/ukasha/Desktop/Quarter-1_3.30-6.30/week_10_29th-September,2019/part4/target/debug/part4: /home/ukasha/Desktop/Quarter-1_3.30-6.30/week_10_29th-September,2019/part4/src/main.rs
D
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/SMTP.build/Objects-normal/x86_64/NSUUID+SMTPMessageID.o : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSUUID+SMTPMessageID.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSDate+SMTP.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Send.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPAuthMethod.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Convenience.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddressRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachmentRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBodyRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress+StringLiteralConvertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Authorize.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPGreeting.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPCredential.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Email.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/EHLOExtension.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClientError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Transmit.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachment.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBody.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Reply.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sockets.framework/Modules/Sockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Transport.framework/Modules/Transport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/SMTP.build/Objects-normal/x86_64/NSUUID+SMTPMessageID~partial.swiftmodule : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSUUID+SMTPMessageID.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSDate+SMTP.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Send.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPAuthMethod.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Convenience.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddressRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachmentRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBodyRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress+StringLiteralConvertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Authorize.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPGreeting.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPCredential.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Email.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/EHLOExtension.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClientError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Transmit.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachment.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBody.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Reply.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sockets.framework/Modules/Sockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Transport.framework/Modules/Transport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/SMTP.build/Objects-normal/x86_64/NSUUID+SMTPMessageID~partial.swiftdoc : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSUUID+SMTPMessageID.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSDate+SMTP.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Send.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPAuthMethod.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Convenience.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddressRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachmentRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBodyRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress+StringLiteralConvertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Authorize.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPGreeting.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPCredential.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Email.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/EHLOExtension.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClientError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Transmit.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachment.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBody.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Reply.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sockets.framework/Modules/Sockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Transport.framework/Modules/Transport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
module physics.model; /* * Everything from the physics collected in one class, according to MVC. * * Does not manage the replay. Whenever you want to advance physics, cut off * from the replay the correct hunk, and feed it one-by-one to the model. * * To do automated replay checking, don't use a model directly! Make a nurse, * and have her check the replay! */ import std.algorithm; import std.array; import std.conv; import std.range; import basics.help; // len import net.repdata; import hardware.tharsis; import file.replay; import graphic.gadget; import graphic.torbit; import hardware.sound; import level.level; import lix; import net.permu; import physics.effect; import physics.physdraw; import physics.state; import physics.statinit; import physics.tribe; import tile.phymap; class GameModel { private: GameState _cs; // owned (current state) PhysicsDrawer _physicsDrawer; // owned EffectSink _effect; // not owned, never null. May be the NullEffectSink. public: // The replay data comes with player information (PlNr). // Physics only work with tribe information (Style). // To preserve database normal form, we shouldn't put the Style in the // replay's ReplayData, but still must ask the caller of advance(), // which is the Nurse, to associate ReplayData to Style via this struct. struct ColoredData { ReplayData replayData; Style style; alias replayData this; } // Add players to the replay before you pass the replay to Nurse.ctor! // This remembers the effect manager, but not anything else. // We don't own the effect manager. this(in Level level, in Style[] tribesToMake, in Permu permu, EffectSink ef) in { assert (tribesToMake.len >= 1); } body { _effect = ef; _cs = newZeroState(level, tribesToMake, permu); _physicsDrawer = new PhysicsDrawer(_cs.land, _cs.lookup); finalizePhyuAnimateGadgets(); } // Should be accsessible by the Nurse. Shouldn't be accessed straight from // the game, but it's the Nurse's task to hide that information. @property inout(GameState) cs() inout { return _cs; } void takeOwnershipOf(GameState s) { _cs = s; _physicsDrawer.rebind(_cs.land, _cs.lookup); finalizePhyuAnimateGadgets(); } void applyChangesToLand() { _physicsDrawer.applyChangesToLand(_cs.update); } void advance(R)(R range) if (isInputRange!R && is (ElementType!R : const(ColoredData))) { ++_cs.update; range.each!(cd => applyReplayData(cd)); updateNuke(); // sets lixHatch = 0, thus affects spawnLixxiesFromHatch spawnLixxiesFromHatches(); updateLixxies(); finalizePhyuAnimateGadgets(); if (_cs.overtimeRunning && _cs.multiplayer) { _effect.announceOvertime(_cs.update, _cs.overtimeAtStartInPhyus); } } void dispose() { if (_physicsDrawer) _physicsDrawer.dispose(); _physicsDrawer = null; } private: lix.OutsideWorld makeGypsyWagon(in Passport pa) pure nothrow @nogc { return OutsideWorld(_cs, _physicsDrawer, _effect, pa); } void applyReplayData(in ColoredData i) { immutable upd = _cs.update; assert (i.update == upd, "increase update manually before applying replay data"); auto tribe = i.style in _cs.tribes; if (! tribe) // Ignore bogus data that can come from anywhere return; if (tribe.nukePressed || _cs.nuking) // Game rule: After you call for the nuke, you may not assign // other things, nuke again, or do whatever we allow in the future. // During the nuke, nobody can assign or save lixes. return; immutable Passport pa = Passport(i.style, i.toWhichLix); if (i.isSomeAssignment) { // never assert based on the content in ReplayData, which may have // been a maleficious attack from a third party, carrying a lix ID // that is not valid. If bogus data comes, do nothing. if (i.toWhichLix < 0 || i.toWhichLix >= tribe.lixlen) return; Lixxie lixxie = tribe.lixvec[i.toWhichLix]; assert (lixxie); if (lixxie.priorityForNewAc(i.skill) <= 1 || tribe.skills[i.skill] == 0 || (lixxie.facingLeft && i.action == RepAc.ASSIGN_RIGHT) || (lixxie.facingRight && i.action == RepAc.ASSIGN_LEFT)) return; // Physics ++(tribe.skillsUsed); if (tribe.skills[i.skill] != lix.skillInfinity) --(tribe.skills[i.skill]); OutsideWorld ow = makeGypsyWagon(pa); lixxie.assignManually(&ow, i.skill); _effect.addSound(upd, pa, Sound.ASSIGN); _effect.addArrow(upd, pa, lixxie.foot, i.skill); } else if (i.action == RepAc.NUKE) { tribe.nukePressedSince = upd; _effect.addSound(upd, pa, Sound.NUKE); } } void spawnLixxiesFromHatches() { foreach (int teamNumber, Tribe tribe; _cs.tribes) { if (tribe.lixHatch == 0 || _cs.update < _cs.updateFirstSpawn || _cs.update < tribe.updatePreviousSpawn + tribe.spawnint) continue; // the only interesting part of OutsideWorld right now is the // lookupmap inside the current state. Everything else will be // passed anew when the lix are updated. auto ow = makeGypsyWagon(Passport(tribe.style, tribe.lixlen)); tribe.spawnLixxie(&ow); } } void updateNuke() { if (! _cs.nuking) return; foreach (tribe; _cs.tribes) { tribe.lixHatch = 0; foreach (int lixID, lix; tribe.lixvec.enumerate!int) { if (! lix.healthy || lix.ploderTimer > 0) continue; OutsideWorld ow = makeGypsyWagon(Passport(tribe.style, lixID)); lix.assignManually(&ow, Ac.exploder); break; // only one lix per tribe is hit by the nuke per update } } } void updateLixxies() { version (tharsisprofiling) Zone zone = Zone(profiler, "PhysSeq updateLixxies()"); bool anyFlingers = false; /* Refactoring idea: * Put this sorting into State, and do it only once at the beginning * of a game. Encapsulate (Tribe[Style] tribes) and offer methods that * provide the mutable tribe, but don't allow to rewrite the array. */ auto sortedTribes = _cs.tribes.byValue.array.sort!"a.style < b.style"; void foreachLix(void delegate(Tribe, in int, Lixxie) func) { foreach (tribe; sortedTribes) foreach (int lixID, lixxie; tribe.lixvec.enumerate!int) func(tribe, lixID, lixxie); } void performFlingersUnmarkOthers() { foreachLix((Tribe tribe, in int lixID, Lixxie lixxie) { lixxie.setNoEncountersNoBlockerFlags(); if (lixxie.ploderTimer != 0) { auto ow = makeGypsyWagon(Passport(tribe.style, lixID)); handlePloderTimer(lixxie, &ow); } if (lixxie.updateOrder == PhyuOrder.flinger) { lixxie.marked = true; anyFlingers = true; auto ow = makeGypsyWagon(Passport(tribe.style, lixID)); lixxie.perform(&ow); } else lixxie.marked = false; }); } void applyFlinging() { if (! anyFlingers) return; foreachLix((Tribe tribe, in int lixID, Lixxie lixxie) { auto ow = makeGypsyWagon(Passport(tribe.style, lixID)); lixxie.applyFlingXY(&ow); }); } void performUnmarked(PhyuOrder uo) { foreachLix((Tribe tribe, in int lixID, Lixxie lixxie) { if (! lixxie.marked && lixxie.updateOrder == uo) { lixxie.marked = true; auto ow = makeGypsyWagon(Passport(tribe.style, lixID)); lixxie.perform(&ow); } }); } performFlingersUnmarkOthers(); applyFlinging(); _physicsDrawer.applyChangesToPhymap(); performUnmarked(PhyuOrder.blocker); performUnmarked(PhyuOrder.remover); _physicsDrawer.applyChangesToPhymap(); performUnmarked(PhyuOrder.adder); _physicsDrawer.applyChangesToPhymap(); performUnmarked(PhyuOrder.peaceful); } void finalizePhyuAnimateGadgets() { // Animate after we had the traps eat lixes. Eating a lix sets a flag // in the trap to run through the animation, showing the first killing // frame after this next perform() call. Physics depend on this anim! _cs.foreachGadget((Gadget g) { g.perform(_cs.update, _effect); }); } }
D
the process whereby a person concentrates on some features of the environment to the (relative) exclusion of others the act of being present (at a meeting or event etc.) be present at (meetings, church services, university), etc. take charge of or deal with to accompany as a circumstance or follow as a result work for or be a servant to give heed (to
D
/* Copyright (c) 2019-2020 Timur Gafarov Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ module dagon.graphics.compressedimage; import std.stdio; import dlib.core.memory; import dlib.image.color; import dlib.image.image; enum CompressedImageFormat { S3TC_RGB_DXT1, S3TC_RGBA_DXT3, S3TC_RGBA_DXT5, RGTC1_R, RGTC1_R_S, RGTC2_RG, RGTC2_RG_S, BPTC_RGBA_UNORM, BPTC_SRGBA_UNORM, BPTC_RGB_SF, BPTC_RGB_UF, RGBAF32, RGBAF16 } class CompressedImage: SuperImage { uint _width; uint _height; CompressedImageFormat _compressedImageFormat; uint _mipMapLevels; size_t _bufferSize; ubyte[] _data; this(uint w, uint h, CompressedImageFormat format, uint mipmaps, size_t bufferSize) { _width = w; _height = h; _compressedImageFormat = format; _mipMapLevels = mipmaps; _bufferSize = bufferSize; _data = New!(ubyte[])(_bufferSize); } ~this() { if (data.length) Delete(_data); } void free() { Delete(this); } @property uint width() { return _width; } @property uint height() { return _height; } @property uint bitDepth() { return 0; } @property uint channels() { return 0; } @property uint pixelSize() { return 0; } @property uint pixelFormat() { return IntegerPixelFormat.RGBA8; } @property CompressedImageFormat compressedFormat() { return _compressedImageFormat; } @property uint mipMapLevels() { return _mipMapLevels; } @property ubyte[] data() { return _data; } @property SuperImage dup() { auto res = New!CompressedImage(_width, _height, _compressedImageFormat, _mipMapLevels, _bufferSize); res.data[] = data[]; return res; } SuperImage createSameFormat(uint w, uint h) { return null; } Color4f opIndex(int x, int y) { return Color4f(0.0f, 0.0f, 0.0f, 0.0f); } Color4f opIndexAssign(Color4f c, int x, int y) { return Color4f(0.0f, 0.0f, 0.0f, 0.0f); } }
D
process or manner of functioning or operating perform as expected when applied serve a purpose, role, or function perform duties attached to a particular office or place or function performing or able to perform its regular function
D
instance DIA_Peck_EXIT(C_Info) { npc = MIL_324_Peck; nr = 999; condition = DIA_Peck_EXIT_Condition; information = DIA_Peck_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Peck_EXIT_Condition() { return TRUE; }; func void DIA_Peck_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Peck_HEY(C_Info) { npc = MIL_324_Peck; nr = 2; condition = DIA_Peck_HEY_Condition; information = DIA_Peck_HEY_Info; permanent = TRUE; description = "Эй, ты что делаешь тут?"; }; func int DIA_Peck_HEY_Condition() { if((MIS_Andre_Peck != LOG_Running) && (Npc_GetDistToWP(self,"NW_CITY_HABOUR_PUFF_PECK") <= 500)) { return TRUE; }; }; func void DIA_Peck_HEY_Info() { AI_Output(other,self,"DIA_Peck_HEY_15_00"); //Эй, ты что делаешь тут? AI_Output(self,other,"DIA_Peck_HEY_12_01"); //Послушай, я занят. Оставь меня в покое. AI_StopProcessInfos(self); }; instance DIA_Peck_FOUND_PECK(C_Info) { npc = MIL_324_Peck; nr = 2; condition = DIA_Peck_FOUND_PECK_Condition; information = DIA_Peck_FOUND_PECK_Info; permanent = FALSE; description = "Эй, тебе пора возвращаться назад."; }; func int DIA_Peck_FOUND_PECK_Condition() { if((MIS_Andre_Peck == LOG_Running) && (Npc_GetDistToWP(self,"NW_CITY_HABOUR_PUFF_PECK") <= 500)) { return TRUE; }; }; func void DIA_Peck_FOUND_PECK_Info() { AI_Output(other,self,"DIA_Peck_FOUND_PECK_15_00"); //Эй, тебе пора возвращаться назад. AI_Output(self,other,"DIA_Peck_FOUND_PECK_12_01"); //Что тебе нужно? Ты разве не видишь, я занят? AI_Output(other,self,"DIA_Peck_FOUND_PECK_15_02"); //Мне нужно оружие, так что возвращайся в казармы. AI_Output(self,other,"DIA_Peck_FOUND_PECK_12_03"); //Черт, твое оружие может подождать. AI_Output(other,self,"DIA_Peck_FOUND_PECK_15_04"); //Пошли, Андрэ уже тоже ищет тебя. AI_Output(self,other,"DIA_Peck_FOUND_PECK_12_05"); //Хм-м-м... черт. Ладно, я уже иду - но когда будешь докладывать Андрэ, не говори ему, что я был здесь. self.aivar[AIV_IgnoresFakeGuild] = FALSE; self.aivar[AIV_ToughGuy] = FALSE; self.aivar[AIV_ToughGuyNewsOverride] = FALSE; self.aivar[AIV_IGNORE_Murder] = FALSE; self.aivar[AIV_IGNORE_Theft] = FALSE; self.aivar[AIV_IGNORE_Sheepkiller] = FALSE; AI_StopProcessInfos(self); Npc_ExchangeRoutine(self,"STORAGE"); Npc_ExchangeRoutine(Vanja,"ALONE"); }; var int DIA_Peck_WEAPON_perm; var int DIA_Peck_WEAPON2_perm; func void B_GetWeaponFromPeckCh3() { AI_Output(self,other,"DIA_Peck_Add_12_03"); //Хорошо, что ты спросил. Нам досталось несколько очень хороших клинков от наемников Онара. AI_Output(self,other,"DIA_Peck_Add_12_04"); //Они им больше не понадобятся. (грязный смех) AI_Output(self,other,"DIA_Peck_Add_12_05"); //Вот, возьми. if(MIS_Andre_Peck == LOG_FAILED) { B_GiveInvItems(self,other,ItMw_Schwert2,1); } else { B_GiveInvItems(self,other,ItMw_Rubinklinge,1); }; DIA_Peck_WEAPON_perm = TRUE; DIA_Peck_WEAPON2_perm = TRUE; }; func int C_PeckIsInBarracks() { if(Npc_GetDistToWP(self,"NW_CITY_ARMORY_PECK") <= 1000) { return TRUE; }; if(Npc_GetDistToWP(self,"NW_CITY_BARRACK02_BED_PECK") <= 2000) { return TRUE; }; return FALSE; }; instance DIA_Peck_WEAPON(C_Info) { npc = MIL_324_Peck; nr = 2; condition = DIA_Peck_WEAPON_Condition; information = DIA_Peck_WEAPON_Info; permanent = TRUE; description = "Я пришел за оружием."; }; func int DIA_Peck_WEAPON_Condition() { if((other.guild == GIL_MIL) && (DIA_Peck_WEAPON_perm == FALSE)) { if(C_PeckIsInBarracks()) { return TRUE; }; }; }; func void DIA_Peck_WEAPON_Info() { AI_Output(other,self,"DIA_Peck_WEAPON_15_00"); //Я пришел за оружием. if(MIS_Andre_Peck == LOG_Running) { AI_Output(self,other,"DIA_Peck_WEAPON_12_01"); //Сходи сначала к Андрэ и доложи ему. } else if(MIS_Andre_Peck == LOG_OBSOLETE) { AI_Output(self,other,"DIA_Peck_WEAPON_12_02"); //Посмотрите, кто пришел. Наш новый друг. И ему нужен меч. AI_Output(self,other,"DIA_Peck_WEAPON_12_03"); //Ты не сказал Андрэ, что я был в Красном Фонаре. Похоже, ты нормальный парень. Вот, держи твой меч. AI_Output(self,other,"DIA_Peck_Add_12_00"); //Это лучшее, что у меня есть. B_GiveInvItems(self,other,ItMw_Schwert1,1); DIA_Peck_WEAPON_perm = TRUE; } else if(MIS_Andre_Peck == LOG_SUCCESS) { AI_Output(self,other,"DIA_Peck_WEAPON_12_04"); //Я не забуду тебе этого. Кто сказал Андрэ, что я был в Красном Фонаре, а? AI_Output(self,other,"DIA_Peck_WEAPON_12_05"); //И теперь ты хочешь получить от меня меч... хорошо, ты получишь меч. Вот. А теперь пошел к черту! B_GiveInvItems(self,other,ItMw_1h_MISC_Sword,1); DIA_Peck_WEAPON_perm = TRUE; } else if(Kapitel >= 3) { B_GetWeaponFromPeckCh3(); }; AI_StopProcessInfos(self); }; func void B_Peck_LeckMich() { AI_Output(self,other,"DIA_Peck_Add_12_07"); //Поцелуй мою задницу! }; instance DIA_Peck_WEAPON2(C_Info) { npc = MIL_324_Peck; nr = 2; condition = DIA_Peck_WEAPON2_Condition; information = DIA_Peck_WEAPON2_Info; permanent = TRUE; description = "У тебя нет оружия получше для меня?"; }; func int DIA_Peck_WEAPON2_Condition() { if((other.guild == GIL_MIL) && (DIA_Peck_WEAPON_perm == TRUE) && (DIA_Peck_WEAPON2_perm == FALSE)) { if(C_PeckIsInBarracks()) { return TRUE; }; }; }; func void DIA_Peck_WEAPON2_Info() { AI_Output(other,self,"DIA_Peck_Add_15_01"); //У тебя нет оружия получше для меня? if(MIS_Andre_Peck == LOG_SUCCESS) { AI_Output(self,other,"DIA_Peck_Add_12_06"); //Я не забыл, что ты донес на меня лорду Андрэ. B_Peck_LeckMich(); } else if(Kapitel < 3) { AI_Output(self,other,"DIA_Peck_Add_12_02"); //Пока нет... AI_Output(self,other,"DIA_Peck_WEAPON_12_06"); //Если тебе нужно оружие получше, иди к торговцам на рынке. } else { B_GetWeaponFromPeckCh3(); }; }; func int C_PeckCanSellArmor() { if(MIS_Addon_Andre_MissingPeople == LOG_SUCCESS) { return TRUE; } else if(MIS_OLDWORLD == LOG_SUCCESS) { return TRUE; }; return FALSE; }; func int B_GetPeckArmorPrice() { var int value; value = 4500; if(MIS_Andre_Peck == LOG_SUCCESS) { value += 500; }; if((MIS_Andre_WAREHOUSE == LOG_SUCCESS) && (MIS_Andre_REDLIGHT == LOG_SUCCESS) && Npc_KnowsInfo(other,DIA_Andre_LOBART_SUCCESS)) { value -= 500; }; if(Rengaru_Ausgeliefert == TRUE) { value -= 100; }; if(Halvor_Ausgeliefert == TRUE) { value -= 100; }; if(Nagur_Ausgeliefert == TRUE) { value -= 100; }; if(Sarah_Ausgeliefert == TRUE) { value -= 100; }; if(Canthar_Ausgeliefert == TRUE) { value -= 100; }; if(Fernando_ImKnast == TRUE) { value -= 100; }; if(Andre_Knows_MartinEmpfehlung == TRUE) { value -= 100; }; if(MIS_Andre_GuildOfThieves == LOG_SUCCESS) { value -= 1000; } else if(Andre_FoundThieves_Reported == TRUE) { value -= 500; }; return value; }; instance DIA_Peck_ARMOR(C_Info) { npc = MIL_324_Peck; nr = 3; condition = DIA_Peck_ARMOR_Condition; information = DIA_Peck_ARMOR_Info; permanent = TRUE; description = "А как насчет доспехов получше?"; }; func int DIA_Peck_ARMOR_Condition() { if((other.guild == GIL_MIL) && (DIA_MIL_ARMOR_M_perm == FALSE)) { if(C_PeckIsInBarracks()) { return TRUE; }; }; }; func void DIA_Peck_ARMOR_Info() { DIA_Common_WhatAboutBetterArmor(); if(MIS_Andre_Peck == LOG_Running) { AI_Output(self,other,"DIA_Peck_WEAPON_12_01"); //Сходи сначала к Андрэ и доложи ему. } else if(B_GetGreatestPetzCrime(self) != CRIME_NONE) { B_Say(self,other,"$CITY_CRIME"); } else { if(C_PeckCanSellArmor()) { if(MIS_Andre_Peck == LOG_SUCCESS) { AI_Output(self,other,"DIA_Addon_BDT_10014_Thorus_Rein_12_01"); //Хорошо. } else { AI_Output(self,other,"DIA_Peck_Add_12_00"); //Это лучшее, что у меня есть. }; Info_ClearChoices(DIA_Peck_ARMOR); Info_AddChoice(DIA_Peck_ARMOR,Dialog_Back,DIA_Peck_ARMOR_Back); Info_AddChoice(DIA_Peck_ARMOR,B_BuildPriceString("Купить тяжелые доспехи ополчения. Защита: 70/70/10/10.",B_GetPeckArmorPrice()),DIA_Peck_ARMOR_BUY); } else { if(MIS_Andre_Peck == LOG_SUCCESS) { AI_Output(self,other,"DIA_Addon_Thorus_Add_12_05"); //(твердо) Нет! AI_StopProcessInfos(self); } else { AI_Output(self,other,"DIA_Peck_Add_12_02"); //Пока нет... }; }; }; }; func void DIA_Peck_ARMOR_Back() { Info_ClearChoices(DIA_Peck_ARMOR); }; func void DIA_Peck_ARMOR_BUY() { DIA_Common_GiveMeThatArmor(); if(B_GiveInvItems(other,self,ItMi_Gold,B_GetPeckArmorPrice())) { AI_Output(self,other,"DIA_Peck_Add_12_05"); //Вот, возьми. B_GiveArmor(ITAR_MIL_M); DIA_MIL_ARMOR_M_perm = TRUE; } else { AI_Output(self,other,"DIA_Mika_UEBERLEGT_12_02"); //(сердито) Возвращайся, когда у тебя будут деньги. }; Info_ClearChoices(DIA_Peck_ARMOR); }; /*instance DIA_Peck_TRADE(C_Info) { npc = MIL_324_Peck; nr = 4; condition = DIA_Peck_TRADE_Condition; information = DIA_Peck_TRADE_Info; permanent = TRUE; description = "У тебя есть что-нибудь для меня?"; }; func int DIA_Peck_TRADE_Condition() { if((other.guild == GIL_MIL) && (DIA_Peck_ARMOR_perm == FALSE)) { if(C_PeckIsInBarracks()) { return TRUE; }; }; return FALSE; }; func void DIA_Peck_TRADE_Info() { //AI_Output(other,self,"DIA_Parlan_Bibliothek_15_00"); //У тебя есть что-нибудь для меня? };*/ instance DIA_Peck_PERM(C_Info) { npc = MIL_324_Peck; nr = 800; condition = DIA_Peck_PERM_Condition; information = DIA_Peck_PERM_Info; permanent = TRUE; description = "С тобой все в порядке?"; }; func int DIA_Peck_PERM_Condition() { if(C_PeckIsInBarracks()) { return TRUE; }; }; func void DIA_Peck_PERM_Info() { AI_Output(other,self,"DIA_Peck_PERM_15_00"); //С тобой все в порядке? if(MIS_Andre_Peck == LOG_SUCCESS) { B_Peck_LeckMich(); } else if(Kapitel != 3) { AI_Output(self,other,"DIA_Peck_PERM_12_01"); //Да, а с тобой? } else if(Kapitel == 3) { if(MIS_RescueBennet != LOG_SUCCESS) { if((hero.guild == GIL_MIL) || (hero.guild == GIL_PAL)) { AI_Output(self,other,"DIA_Peck_PERM_12_02"); //Не совсем. Меня волнуют эти наемники. Я хочу сказать, они могут попытаться освободить своего дружка из тюрьмы силой. AI_Output(self,other,"DIA_Peck_PERM_12_03"); //Мне что-то не очень хочется выступать против банды опытных бойцов. } else if(hero.guild == GIL_KDF) { AI_Output(self,other,"DIA_Peck_PERM_12_04"); //Конечно! Мы готовы ко всему. Маги могут быть уверены, что этому заключенному не удастся сбежать. } else { AI_Output(self,other,"DIA_Peck_PERM_12_05"); //Я знаю, что ты задумал, но у тебя не получится уйти вместе с этим заключенным. }; } else { AI_Output(self,other,"DIA_Peck_PERM_12_06"); //Я очень рад, что это дело об убийстве теперь закрыто. AI_Output(other,self,"DIA_Peck_PERM_15_07"); //Почему? AI_Output(self,other,"DIA_Peck_PERM_12_08"); //Наемники просто так не отступили бы. Они бы не стали сидеть сложа руки и спокойно наблюдать за тем, как мы повесим одного из них. AI_Output(self,other,"DIA_Peck_PERM_12_09"); //Они даже могли напасть на город. Я даже думать не хочу о том, к чему это могло привести. }; }; };
D
/home/raab/ESGI/PSR-Rust/Projet/Rust_projet_PPM/use_ppm_library/target/debug/deps/cty-7a721b14473f303a.rmeta: /home/raab/.cargo/registry/src/github.com-1ecc6299db9ec823/cty-0.2.1/src/lib.rs /home/raab/ESGI/PSR-Rust/Projet/Rust_projet_PPM/use_ppm_library/target/debug/deps/cty-7a721b14473f303a.d: /home/raab/.cargo/registry/src/github.com-1ecc6299db9ec823/cty-0.2.1/src/lib.rs /home/raab/.cargo/registry/src/github.com-1ecc6299db9ec823/cty-0.2.1/src/lib.rs:
D
import LD32; void main() { new LD32().run(); }
D
module storage; /// Large array storage. static struct Large(E, bool useGCallocation) { E* ptr; size_t length; static if (useGCallocation) { import core.memory : GC; } else { import core.memory : malloc = pureMalloc, realloc = pureRealloc; } pure nothrow: static if (useGCallocation) { this(size_t n) { length = n; ptr = cast(E*)GC.malloc(E.sizeof * length); } void resize(size_t n) { length = n; ptr = cast(E*)GC.realloc(ptr, E.sizeof * length); } void clear() { GC.free(ptr); debug ptr = null; } } else { @nogc: this(size_t n) { length = n; ptr = cast(E*)malloc(E.sizeof * length); } void resize(size_t n) { length = n; ptr = cast(E*)realloc(ptr, E.sizeof * length); } void clear() { import qcmeman : free; free(ptr); debug ptr = null; } } } /// Small array storage. alias Small(E, size_t n) = E[n]; /// Small-size-optimized (SSO) array store. static struct Store(E, bool useGCallocation = false) { /** Fixed number elements that fit into small variant storage. */ enum smallLength = Large!(E, useGCallocation).sizeof / E.sizeof; /** Maximum number elements that fit into large variant storage. */ enum maxLargeLength = size_t.max >> 8; /// Destruct. ~this() nothrow @trusted { if (isLarge) { large.clear; } } /// Get currently length at `ptr`. size_t length() const @trusted pure nothrow @nogc { return isLarge ? large.length : smallLength; } /// Returns: `true` iff is small packed. bool isSmall() const @safe pure nothrow @nogc { return !isLarge; } private: /// Reserve length to `n` elements starting at `ptr`. void reserve(size_t n) pure nothrow @trusted { if (isLarge) // currently large { if (n > smallLength) // large => large { large.resize(n); } else // large => small { // large => tmp // temporary storage for small debug { typeof(small) tmp; } else { typeof(small) tmp = void; } tmp[0 .. n] = large.ptr[0 .. n]; // large to temporary tmp[n .. $] = 0; // zero remaining // empty large large.clear(); // tmp => small small[] = tmp[0 .. smallLength]; isLarge = false; } } else // currently small { if (n > smallLength) // small => large { typeof(small) tmp = small; // temporary storage for small import std.conv : emplace; emplace(&large, n); large.ptr[0 .. length] = tmp[0 .. length]; // temporary to large isLarge = true; // tag as large } else {} // small => small } } /// Get pointer. auto ptr() pure nothrow @nogc { import container_traits : ContainerElementType; alias ET = ContainerElementType!(typeof(this), E); return isLarge ? cast(ET*)large.ptr : cast(ET*)&small; } /// Get slice. auto ref slice() pure nothrow @nogc { return ptr[0 .. length]; } union { Small!(E, smallLength) small; // small variant Large!(E, useGCallocation) large; // large variant } bool isLarge; // TODO make part of union as in rcstring.d } /// Test `Store`. static void storeTester(E, bool useGCallocation)() { Store!(E, useGCallocation) si; assert(si.ptr !is null); assert(si.slice.ptr !is null); assert(si.slice.length != 0); assert(si.length == si.smallLength); si.reserve(si.smallLength); // max small assert(si.length == si.smallLength); assert(si.isSmall); si.reserve(si.smallLength + 1); // small to large assert(si.length == si.smallLength + 1); assert(si.isLarge); si.reserve(si.smallLength * 8); // small to large assert(si.length == si.smallLength * 8); assert(si.isLarge); si.reserve(si.smallLength); // max small assert(si.length == si.smallLength); assert(si.isSmall); si.reserve(0); assert(si.length == si.smallLength); assert(si.isSmall); si.reserve(si.smallLength + 1); assert(si.length == si.smallLength + 1); assert(si.isLarge); si.reserve(si.smallLength); assert(si.length == si.smallLength); assert(si.isSmall); si.reserve(si.smallLength - 1); assert(si.length == si.smallLength); assert(si.isSmall); } version(unittest) { import std.meta : AliasSeq; } pure nothrow @nogc unittest { foreach (E; AliasSeq!(char, byte, short, int)) { storeTester!(E, false); } } pure nothrow unittest { foreach (E; AliasSeq!(char, byte, short, int)) { storeTester!(E, true); } }
D
/*************************************************** CHAPTER 2 ITEMS ***************************************************/ //Items by Sher INSTANCE ItMw_2h_Post (WeaponsMelee) { name = "Mary"; mainflag = ITEM_KAT_NF; flags = ITEM_2HD_SWD|ITEM_MULTI; material = MAT_METAL; value = 1000; damageTotal = 75; damagetype = DAM_EDGE; range = 150; cond_atr[2] = ATR_STRENGTH; cond_value[2] = 60; visual = "ItMw_2H_Sword_Heavy_04.3DS"; description = name; TEXT[2] = NAME_Damage; COUNT[2] = damageTotal; TEXT[3] = NAME_Str_needed; COUNT[3] = cond_value[2]; TEXT[4] = NAME_TwoHanded; TEXT[5] = NAME_Value; COUNT[5] = value; }; /************************** Itemy by Sher ****************************/ var int nikolas_list; INSTANCE debt_list(C_Item) { name = "Lista dłużników"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; visual = "ItWr_Scroll_01.3ds"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = UseDebt_List; description = "Lista dłużników od Nikolasa"; TEXT[0] = "Nikolas spisał na tej kartce"; TEXT[1] = "listę wszystkich dłużników."; }; func void UseDebt_List () { var int nDocID; nDocID = Doc_Create () ; // DocManager Doc_SetPages ( nDocID, 1 ); //wieviel Pages Doc_SetPage ( nDocID, 0, "letters.TGA" , 0 ); Doc_SetFont ( nDocID, -1, "font_10_book.tga" ); // -1 -> all pages Doc_SetMargins ( nDocID, -1, 50, 50, 50, 50, 1 ); // 0 -> margins are in pixels Doc_PrintLine ( nDocID, 0, "Kłamliwe sukinsyny, które wiszą mi rudę:" ); Doc_PrintLine ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "Leaf - 200 bryłek + 50 bryłek odsetek" ); Doc_PrintLine ( nDocID, 0, "Lewy - 150 bryłek + 30 bryłek odsetek" ); Doc_PrintLine ( nDocID, 0, "Prawy - chyba 250 bryłek, bez odsetek" ); Doc_PrintLine ( nDocID, 0, "Aidan - 400 bryłek + 200 bryłek odsetek" ); Doc_PrintLine ( nDocID, 0, "" ); Doc_PrintLine ( nDocID, 0, "Lewy i Prawy to bracia, obozują na szlaku" ); Doc_PrintLines ( nDocID, 0, "z przełęczy. Nieopodal Starego Obozu - to świry uważaj." ); Doc_PrintLine ( nDocID, 0, "Leaf i Aidan to cwaniaki z twojego obozu więc" ); Doc_PrintLine ( nDocID, 0, "nie powinieneś mieć problemu z odzyskaniem" ); Doc_PrintLine ( nDocID, 0, "rudy." ); Doc_PrintLine ( nDocID, 0, "Nie zapomnij o odsetkach!" ); Doc_PrintLine ( nDocID, 0, "Powodzenia." ); Doc_SetMargins ( nDocID, -1, 200, 50, 50, 50, 1 ); // 0 -> margins are in pixels (Position des Textes von den Ränder des TGAs aus Doc_Show ( nDocID ); if (nikolas_list == FALSE) { nikolas_list = TRUE; debt_read = TRUE; B_LogEntry (CH2_TRL_Debt, "Przeczytałem listę dłużników: Leaf 200 bryłek + 50 odsetki, Lewy 150 bryłek + 30 odsetki, Prawy 250 bryłek i Aidan 400 bryłek + 200 odsetki. Ciekawe jak im się spodobają odsetki..."); }; }; var int Know_DrunkmanSecret; /********************** Paczka ziela od Gilberta *************************/ INSTANCE package_stuff (C_Item) { name = "Paczka ziela"; mainflag = ITEM_KAT_NONE; flags = ITEM_MISSION|ITEM_MULTI; value = 500; visual = "ItMi_Packet.3DS"; material = MAT_LEATHER; description = name; text[2] = "Paczka napchana jest"; text[3] = "zielskiem. Aż mi się"; text[4] = "kręci w głowie..."; TEXT[5] = NAME_Value; COUNT[5] = value; }; INSTANCE ItWrPiwoszNote(C_Item) { name = "Notatki Piwosza"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; visual = "ItWr_Scroll_01.3ds"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = ItWrPiwoszNote_List; description = "Notatki Piwosza"; TEXT[0] = "Kto by pomyslał że"; TEXT[1] = "Piwosz potrafi pisać."; }; func void ItWrPiwoszNote_List () { var int nDocID; nDocID = Doc_Create () ; // DocManager Doc_SetPages ( nDocID, 1 ); //wieviel Pages Doc_SetPage ( nDocID, 0, "letters.TGA" , 0 ); Doc_SetFont ( nDocID, -1, "font_10_book.tga" ); // -1 -> all pages Doc_SetMargins ( nDocID, -1, 50, 50, 50, 50, 1 ); // 0 -> margins are in pixels Doc_PrintLine ( nDocID, 0, "..." ); Doc_PrintLines ( nDocID, 0, "Nie wiem, co mnie dziś trafiło, ale wlazłem do opuszczonej jaskini na skraju lasu." ); Doc_PrintLine ( nDocID, 0, "..." ); Doc_PrintLines ( nDocID, 0, "W jaskini musiał mieszkać jakiś alchemik, postanowiłem że to jakoś wykorzystam, użyję jego sprzętu do pędzenia bimbru, he he." ); Doc_PrintLine ( nDocID, 0, "..." ); Doc_PrintLines ( nDocID, 0, "Nie mam pojęcia ile tego napędziłem, ale na pewno od cholery, wezmę część do obozu, resztę zostawię sobie na później."); Doc_PrintLine ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "Próbowałem wrócić po jeszcze kilka sztuk lazurowego trzmiela, ale zrobiło się tam cholernie niebezpiecznie..." ); Doc_SetMargins ( nDocID, -1, 200, 50, 50, 50, 1 ); // 0 -> margins are in pixels (Position des Textes von den Ränder des TGAs aus Doc_Show ( nDocID ); if (Know_DrunkmanSecret == FALSE) { Know_DrunkmanSecret = TRUE; Log_CreateTopic (CH2_RBL_DrunkmanSecret, LOG_MISSION); B_LogSetTopicStatus (CH2_RBL_DrunkmanSecret, LOG_RUNNING); B_LogEntry (CH2_RBL_DrunkmanSecret, "W skrzyni Piwosza znalazłem notatki. Według tego co tam napisano ten pijak produkował alkohol w jakiejś jaskini na skraju lasu."); }; }; /******************************************************************************************/ INSTANCE ItKeLeftChest(C_Item) { name = "Klucz do skrzyni"; mainflag = ITEM_KAT_NONE; flags = 0; value = Value_Schlüssel; visual = "ItKe_Key_01.3ds"; material = MAT_METAL; description = name; TEXT[4] = NAME_Value; COUNT[4] = Value_Schlüssel; }; // INSTANCE ItAt_BlackTroSkin (ItAt_Troll_01) // { // name = "Futro Czarnego Trola"; // // value = 500; // // description = name; // TEXT[4] = NAME_Value; COUNT[4] = value; // }; /******************************************* Katr'akanat *******************************************/ //**********************Inkunabuły********************************* INSTANCE Katrakanat_book(C_Item) { name = "Zmurszały inkunabuł"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; value = 500; visual = "ItWr_Book_02_03.3ds"; material = MAT_LEATHER; scemeName = "MAP"; description = "Stara księga"; TEXT[5] = NAME_Value; COUNT[5] = value; on_state[0] = Use_Katrakanat_book; }; FUNC VOID Use_Katrakanat_book() { var int nDocID; nDocID = Doc_Create () ; // DocManager Doc_SetPages ( nDocID, 2 ); //Ilość stron Doc_SetPage ( nDocID, 0, "Book_Mage_L.tga", 0 ); Doc_SetPage ( nDocID, 1, "Book_Mage_R.tga", 0 ); //1 Strona Doc_SetFont ( nDocID, -1, "font_15_book.tga" ); // -1 -> all pages Doc_SetMargins ( nDocID, 0, 275, 20, 30, 20, 1 ); // 0 -> margins are in pixels Doc_PrintLine ( nDocID, 0, ""); Doc_PrintLine ( nDocID, 0, "(Księga oprawiona jest w... ludzką skórę!)" ); Doc_PrintLine ( nDocID, 0, "(Pod spodem, ktoś napisał coś nierównym pismem)"); Doc_SetFont ( nDocID, -1, "font_10_book.TGA" ); // -1 -> all pages Doc_PrintLine ( nDocID, 0, ""); Doc_PrintLines ( nDocID, 0, "Ten, który zechce wyrzec się ścieżki mroku i podąży drogą światła, pozna prawdziwe źródło pradawnej potęgi. Dane mu będzie użyć jej, aby skruszyć łańcuchy zapomnienia i zgłębić tajemnicę przeklętego imienia, z pierwszych znaków słów spisanych winem życia..."); //2 Strona Doc_SetMargins ( nDocID, -1, 30, 20, 275, 20, 1 ); // 0 -> margins are in pixels (Position des Textes von den Ränder des TGAs aus, links,oben,rechts,unten) Doc_PrintLines ( nDocID, 1, "(ten tekst napisany jest w jakimś nieznanym jezyku)"); Doc_PrintLine ( nDocID, 1, "Ekh'r angh Irr'atis moones seghill derthan got'h..."); Doc_PrintLine ( nDocID, 1, "(reszta napisana jest czerwonym inkaustem, albo krwią)"); Doc_PrintLine ( nDocID, 1, "Khatar'Egh I'omin Urthen'Ghat est Perths Unisath."); Doc_PrintLine ( nDocID, 1, "A'nistur mightr E'night ynerth urthang Mooreth."); Doc_PrintLine ( nDocID, 1, "Tehir Un'Athor Methum iseth Yther klothhs."); Doc_PrintLine ( nDocID, 1, "Regtun Moostern Inass'Arn erst Ethill Minns Prooth's."); Doc_PrintLine ( nDocID, 1, "Anub Is'Artheng Mythn Enis gorth porthal."); Doc_PrintLine ( nDocID, 1, "Kenis Broth Innas meriath Vesierth'Sithen urgath."); Doc_PrintLine ( nDocID, 1, "Anestor Omin'th Erhran Veris Bhorn tylhr Cethl Enis."); Doc_PrintLine ( nDocID, 1, "Nesth Omines Urghat!"); Doc_PrintLine ( nDocID, 1, "Aestor Nethis Verthon Morrthes Illath..."); Doc_PrintLine ( nDocID, 1, "T'henn aris!"); Doc_Show ( nDocID ); // Snd_Play ("FoundRiddler"); if (katar_rytual == FALSE) { Wld_PlayEffect("spellFX_MassDeath_GROUND", self, null, 0, 0, 0, true); if (!open_kart) { Wld_SpawnNpcRange (self, Skeleton,4,800); Wld_SpawnNpcRange (self, SkeletonWarrior, 2, 800); Wld_SpawnNpcRange (self, SkeletonMage, 1, 800); Npc_RemoveInvItems(self, Katrakanat_book,1); } else { self.attribute[ATR_HITPOINTS] -= self.attribute[ATR_HITPOINTS_MAX] / 4; }; }; open_kart = TRUE; }; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INSTANCE KatarMap_Tomb(C_Item) { name = "Mapa do grobowca"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; value = 10; visual = "ItWr_Map_01.3DS"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = UseKatarMap_Tomb; description = "Mapa do grobowca"; TEXT[0] = "Ratford zaznaczył na niej grobowiec."; TEXT[5] = NAME_Value; COUNT[5] = value; }; FUNC VOID UseKatarMap_Tomb() { var int nDocID; nDocID = Doc_CreateMap () ; // DocManager Doc_SetLevel ( nDocID, "WORLD.ZEN" ); Doc_SetPages ( nDocID, 1 ); Doc_SetPage ( nDocID, 0, "MAP_MIS_WORLD_TOMB_KATRAKANAT.tga", 1 ); // 1 -> DO NOT SCALE Doc_Show ( nDocID ); }; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INSTANCE KatarMap(C_Item) { name = "Mapa Katrakanat"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; value = 200; visual = "ItWr_Map_01.3DS"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = UseKatarMap; description = "Mapa Katrakanat"; TEXT[0] = "Mapa wskazująca miejsca ukrycia części Katrakanat."; ////COUNT[0] = ; //TEXT[1] = ""; ////COUNT[1] = ; //TEXT[2] = ""; //COUNT[2] = ; //TEXT[3] = ""; //COUNT[3] = ; //TEXT[4] = ""; ////COUNT[4] = ; TEXT[5] = NAME_Value; COUNT[5] = value; }; FUNC VOID UseKatarMap() { var int nDocID; nDocID = Doc_CreateMap () ; // DocManager Doc_SetLevel ( nDocID, "WORLD.ZEN" ); Doc_SetPages ( nDocID, 1 ); Doc_SetPage ( nDocID, 0, "MAP_MIS_WORLD_KATRAKANAT2.tga", 1 ); // 1 -> DO NOT SCALE Doc_Show ( nDocID ); }; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INSTANCE JackMap1(C_Item) { name = "Mapa Aligatora"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; value = 200; visual = "ItWr_Map_01.3DS"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = UseJackMap1; description = "Mapa Aligatora"; TEXT[0] = "Brakuje dużej części."; ////COUNT[0] = ; //TEXT[1] = ""; ////COUNT[1] = ; //TEXT[2] = ""; //COUNT[2] = ; //TEXT[3] = ""; //COUNT[3] = ; //TEXT[4] = ""; ////COUNT[4] = ; TEXT[5] = NAME_Value; COUNT[5] = value; }; FUNC VOID UseJackMap1() { var int nDocID; nDocID = Doc_CreateMap () ; // DocManager Doc_SetLevel ( nDocID, "WORLD.ZEN" ); Doc_SetPages ( nDocID, 1 ); Doc_SetPage ( nDocID, 0, "MAP_ALIGATOR_1.tga", 1 ); // 1 -> DO NOT SCALE Doc_Show ( nDocID ); }; /***************************** Jakiś model ork trzeba zrobić do tego *****************************/ PROTOTYPE Proto_Katrakanat_piece (C_Item) { name = "Kawałek kamienia"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI; value = Value_Münze; visual = "ItMi_Focus_01.3ds"; material = MAT_METAL; description = name; TEXT[4] = NAME_Value; COUNT[4] = value; }; INSTANCE Katrakanat_piece(Proto_Katrakanat_piece) { visual = "ItMi_Focus_01.3ds"; }; INSTANCE Katrakanat_piece2(Proto_Katrakanat_piece) { visual = "ItMi_Focus_01.3ds"; }; INSTANCE Katrakanat_piece3(Proto_Katrakanat_piece) { visual = "ItMi_Focus_01.3ds"; }; INSTANCE Katrakanat_piece4(Proto_Katrakanat_piece) { visual = "ItMi_Focus_01.3ds"; }; INSTANCE Katrakanat_piece5(Proto_Katrakanat_piece) { visual = "ItMi_Focus_01.3ds"; }; INSTANCE Katrakanat_piece6(Proto_Katrakanat_piece) { visual = "ItMi_Focus_01.3ds"; }; //############################################# // Grog //############################################# INSTANCE ItFo_Innos_Booz(C_Item) { name = "Święcony bimber"; mainflag = ITEM_KAT_FOOD; flags = ITEM_MULTI; value = Value_Grog; visual = "ItMi_Rum_01.3ds"; material = MAT_GLAS; on_state[0] = UseHolybooze; scemeName = "POTIONFAST"; description = "Święcony bimber"; TEXT[1] = NAME_Bonus_HP; COUNT[1] = HP_Grog; TEXT[5] = NAME_Value; COUNT[5] = Value_Grog; }; FUNC VOID UseHolybooze() { Npc_ChangeAttribute (self, ATR_HITPOINTS, HP_Grog); Mdl_ApplyOverlayMdsTimed(self,"HUMANS_DRUNKEN.MDS",90000); if(Npc_IsPlayer(self)) { PutMsg("Ale ten samogon ma kopa!","font_default.tga",RGBAToZColor(255,255,255,255),_TIME_MESSAGE_LOGENTRY,""); }; }; //############################################# INSTANCE ItFo_Lazur(C_Item) { name = "Lazurowy trzmiel"; mainflag = ITEM_KAT_FOOD; flags = ITEM_MULTI; value = 2*Value_Grog; visual = "ItMi_Rum_01.3ds"; material = MAT_GLAS; on_state[0] = UseLazur; scemeName = "POTIONFAST"; description = "Legendarny lazurowy trzmiel"; TEXT[1] = NAME_Bonus_HP; COUNT[1] = (2*HP_Grog); TEXT[5] = NAME_Value; COUNT[5] = (2*Value_Grog); }; FUNC VOID UseLazur() { Npc_ChangeAttribute (self, ATR_HITPOINTS, 2*HP_Grog); }; //******************posążek inosa***************** instance innos_statue(C_ITEM) { name = "Posążek Innosa"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI | ITEM_MISSION; value = 100; visual = "ItMi_InnosStatue.3DS"; material = MAT_METAL; description = name; text[2] = "Pięknie wykonany"; text[3] = "posążek Innosa."; text[5] = NAME_VALUE; count[5] = value; }; //tritiera instance tri_innos_statue(C_ITEM) { name = "Posążek Innosa"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI | ITEM_MISSION; value = 250; visual = "ItMi_InnosStatue.3DS"; material = MAT_METAL; description = name; text[2] = "Pięknie wykonany"; text[3] = "posążek Innosa,"; text[4] = "boga ognia."; text[5] = NAME_VALUE; count[5] = value; }; instance tri_adan_statue(C_ITEM) { name = "Posążek Adanosa"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI | ITEM_MISSION; value = 250; visual = "ItMi_InnosStatue.3DS"; material = MAT_METAL; description = name; text[2] = "Elegancko zdobiony"; text[3] = "posążek Adanosa,"; text[4] = "boga równowagi."; text[5] = NAME_VALUE; count[5] = value; }; instance tri_beliar_statue(C_ITEM) { name = "Posążek Beliara"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI | ITEM_MISSION; value = 250; visual = "ItMi_InnosStatue.3DS"; material = MAT_METAL; description = name; text[2] = ""; text[3] = "Posążek Beliara,"; text[4] = "boga ciemności."; text[5] = NAME_VALUE; count[5] = value; }; //--------------------------------------------------------------------- INSTANCE Katrakanat(C_Item) { name = "Katrakanat"; mainflag = ITEM_KAT_NONE; flags = ITEM_MISSION; //hp = 1; //hp_max = 1; // //weight = 1; value = 1; visual = "ItMi_Focus_01.3ds"; material = MAT_STONE; description = name; TEXT[1] = "Katrakanat - mroczny kamień"; TEXT[2] = "z zaklętem jestestwem."; }; INSTANCE GRD_Prl_Swd (WeaponsMelee) { name = "Miecz patrolowca"; mainflag = ITEM_KAT_NF; flags = ITEM_SWD|ITEM_MULTI; material = MAT_METAL; value = 150; damageTotal = 58; damagetype = DAM_EDGE; range = 100; cond_atr[2] = ATR_STRENGTH; cond_value[2] = 40; //12 cond_value[2] = (3*cond_value[2])/2; visual = "ITMW_1H_SWORD_LONG_01.3DS"; description = name; TEXT[2] = NAME_Damage; COUNT[2] = damageTotal; TEXT[3] = NAME_Str_needed; COUNT[3] = cond_value[2]; TEXT[4] = NAME_OneHanded; TEXT[5] = NAME_Value; COUNT[5] = value; }; INSTANCE magpass(C_Item) { name = "Przepustka"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; visual = "ItWr_Scroll_01.3ds"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = Usemagpass; description = "Przepustka do magów"; TEXT[0] = "Papier jest zniszczony ale woskowa"; TEXT[1] = "pieczęć jest w dobrym stanie"; }; func void Usemagpass () { var int nDocID; nDocID = Doc_Create () ; // DocManager Doc_SetPages ( nDocID, 1 ); //wieviel Pages Doc_SetPage ( nDocID, 0, "letters.TGA" , 0 ); Doc_SetFont ( nDocID, -1, "font_10_book.tga" ); // -1 -> all pages Doc_SetMargins ( nDocID, -1, 50, 50, 50, 50, 1 ); // 0 -> margins are in pixels Doc_PrintLines ( nDocID, 0, "(wielka, zalakowana pieczęć i dziwny tekst)" ); Doc_PrintLines ( nDocID, 0, "powtarzaj stare zaklęcia ludzkości bajki i legendy," ); Doc_PrintLines ( nDocID, 0, "bo tak zdobędziesz dobro, którego nie zdobędziesz," ); Doc_PrintLines ( nDocID, 0, "powtarzaj wielkie słowa, powtarzaj je z uporem," ); Doc_PrintLines ( nDocID, 0, "jak ci co szli przez pustynię i ginęli w piasku," ); Doc_PrintLines ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "a nagrodzą cię za to tym, co mają pod ręką" ); Doc_PrintLines ( nDocID, 0, "chłostą śmiechu, zabójstwem na śmietniku," ); Doc_PrintLines ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "idź, bo tylko tak będziesz przyjęty do grona zimnych czaszek," ); Doc_PrintLines ( nDocID, 0, "do grona twoich przodków..." ); Doc_PrintLines ( nDocID, 0, "obrońców królestwa bez kresu i miasta popiołów" ); Doc_PrintLines ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "Bądź wierny, Idź i przejdź! " ); Doc_SetMargins ( nDocID, -1, 200, 50, 50, 50, 1 ); // 0 -> margins are in pixels (Position des Textes von den Ränder des TGAs aus Doc_Show ( nDocID ); }; INSTANCE milten_list(C_Item) { name = "Lista ingrediencji"; mainflag = ITEM_KAT_DOCS; flags = ITEM_MISSION; visual = "ItWr_Scroll_01.3ds"; material = MAT_LEATHER; scemeName = "MAP"; on_state[0] = Usemilten_list; description = "Lista ingrediencji od Miltena"; TEXT[0] = "Na tym pergaminie Milten spisał"; TEXT[1] = "listę roślin, których potrzebuje"; }; func void Usemilten_list () { var int nDocID; nDocID = Doc_Create () ; // DocManager Doc_SetPages ( nDocID, 1 ); //wieviel Pages Doc_SetPage ( nDocID, 0, "letters.TGA" , 0 ); Doc_SetFont ( nDocID, -1, "font_10_book.tga" ); // -1 -> all pages Doc_SetMargins ( nDocID, -1, 50, 50, 50, 50, 1 ); // 0 -> margins are in pixels Doc_PrintLines ( nDocID, 0, "Spis składników niezbędnych do stworzenia eliksirów:" ); Doc_PrintLines ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "- 3 serafisy, nośnik." ); Doc_PrintLines ( nDocID, 0, "- 5 piekielników, wzmacniacz." ); Doc_PrintLines ( nDocID, 0, "- 3 orkowych zielsk, wytłumiacz." ); Doc_PrintLines ( nDocID, 0, "- 5 wilczych kłów, absorben." ); Doc_PrintLines ( nDocID, 0, "- smoczy korzeń, zespalacz." ); Doc_PrintLines ( nDocID, 0, "- czysty alkohol, destylant." ); Doc_PrintLines ( nDocID, 0, "- żądło krwiopijcy, neutralizator." ); Doc_PrintLines ( nDocID, 0, "- 2 krucze ziela, do smaku." ); Doc_PrintLines ( nDocID, 0, "- liść dębu, identyfikator." ); Doc_PrintLines ( nDocID, 0, "- nasienie czerwonego buka, ???" ); Doc_PrintLines ( nDocID, 0, "" ); Doc_PrintLines ( nDocID, 0, "Proszę nie przeżuwać niczego z tej listy!" ); Doc_SetMargins ( nDocID, -1, 200, 50, 50, 50, 1 ); // 0 -> margins are in pixels (Position des Textes von den Ränder des TGAs aus Doc_Show ( nDocID ); if (milten_inged == FALSE) { milten_inged = TRUE; B_LogEntry (CH2_RBL_Plants, "Lista ingrediencji: 3 serafisy, 5 piekielników, 3 orkowe ziela, 5 wilczych kłów, smoczy korzeń, czysty alkohol, żądło krwiopilcy, liść dębu i nasienie czerwonego buka. Lista jest imponująca i gdzie ja do cholery znajdę dąb i czerwony buk?"); }; }; INSTANCE dragon_root(C_Item) { name = "Smoczy korzeń"; mainflag = ITEM_KAT_FOOD; flags = ITEM_MULTI; value = 200; visual = "ItFo_Plants_OrcHerb_01.3ds"; material = MAT_LEATHER; on_state[0] = USE_dragon_root1; scemeName = "FOOD"; description = name; TEXT[1] = NAME_Bonus_Str; COUNT[1] = 1; TEXT[5] = NAME_Value; COUNT[5] = 200; }; FUNC VOID USE_dragon_root1 () { B_AddAttributePoints(self,ATR_STRENGTH,1); }; INSTANCE Mis_Jack_BlackPearl(C_Item) { name = "Czarna perła"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI; value = 1000; visual = "ItMi_DarkPearl.3ds"; material = MAT_LEATHER; description = name; // TEXT[1] = NAME_Bonus_Str; // COUNT[1] = 1; TEXT[5] = NAME_Value; COUNT[5] = 200; }; //--------------------------------------------------------------------- INSTANCE dusk_power (C_Item) { name = "Zorza potęgi"; mainflag = ITEM_KAT_NONE; flags = ITEM_2HD_SWD|ITEM_MISSION; material = MAT_METAL; value = 10; damageTotal = 80; damagetype = DAM_EDGE; range = 140; cond_atr[2] = ATR_STRENGTH; cond_value[2] = 30; visual = "ItMi_SleeperKey_01.3DS"; description = name; TEXT[0] = "Ten miecz należał do zamienionego w ożywieńca"; TEXT[1] = "kapłana orków."; TEXT[2] = "Niestety, po tych wszystkich latach"; TEXT[3] = "nie nadaje się już do użytku!"; TEXT[4] = "Zimne żelazo emanuje mroczną mocą"; TEXT[5] = "i dziwnie pulsuje."; }; instance akw_ring(C_Item) { name = NAME_Ring; mainflag = ITEM_KAT_MAGIC; flags = ITEM_RING; value = 250; visual = "ItRi_Prot_Fire_01.3ds"; visual_skin = 0; material = MAT_METAL; on_equip = Equip_akw_ring; on_unequip = UnEquip_akw_ring; description = "Pierścień z akwamarynem"; //TEXT[0] = ""; //TEXT[1] = ""; ////COUNT[1] = ; TEXT[2] = NAME_Prot_Magic; COUNT[2] = 5; TEXT[3] = NAME_Prot_Fire; COUNT[3] = 10; //TEXT[4] = ""; ////COUNT[4] = ; TEXT[5] = NAME_Value; COUNT[5] = value; }; FUNC VOID Equip_akw_ring() { self.protection [PROT_MAGIC] += 5; self.protection [PROT_FIRE] += 10; }; FUNC VOID UnEquip_akw_ring() { self.protection [PROT_MAGIC] -= 5; self.protection [PROT_FIRE] -= 10; }; instance poor_sack(C_ITEM) { name = "Sakiewka Świstaka"; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI; value = 25; visual = "ItMi_Pocket.3ds"; material = MAT_LEATHER; description = "Sakiewka z rudą należąca do Świstaka."; text[0] = ""; text[1] = ""; text[2] = ""; text[3] = ""; text[4] = ""; text[5] = NAME_VALUE; count[5] = value; }; /******************************************************************************************/ INSTANCE Adan_Ring(C_ITEM) { name = "Pierścień"; mainflag = ITEM_KAT_MAGIC; flags = ITEM_RING; value = 400; visual = "ItRi_Prot_Mage_01.3ds"; visual_skin = 0; material = MAT_METAL; on_equip = Equip_Adan_Ring; on_unequip = UnEquip_Adan_Ring; description = "Pierścień duchowej równowagi"; //TEXT[0] = ""; //TEXT[1] = ""; ////COUNT[1] = ; TEXT[2] = NAME_Prot_Magic; COUNT[2] = 1; //TEXT[3] = ""; ////COUNT[3] = ; //TEXT[4] = ""; ////COUNT[4] = ; TEXT[5] = NAME_Value; COUNT[5] = value; }; FUNC VOID Equip_Adan_Ring() { self.protection [PROT_MAGIC] += 10; }; FUNC VOID UnEquip_Adan_Ring() { self.protection [PROT_MAGIC] -= 10; }; /******************************************************************************************/ INSTANCE Rat_ring(C_Item) { name = NAME_Ring; mainflag = ITEM_KAT_MAGIC; flags = ITEM_RING; value = 300; visual = "ItRi_Dex_Strg_01.3ds"; visual_skin = 0; material = MAT_METAL; on_equip = Equip_Rat_ring; on_unequip = UnEquip_Rat_ring; description = "Pierścień siły wojownika"; //TEXT[0] = ""; //TEXT[1] = ""; ////COUNT[1] = ; TEXT[2] = NAME_Bonus_Str; COUNT[2] = 5; TEXT[3] = NAME_Bonus_Dex; COUNT[3] = 5; //TEXT[4] = ""; ////COUNT[4] = ; TEXT[5] = NAME_Value; COUNT[5] = value; }; FUNC VOID Equip_Rat_ring() { B_ChangeAttribute(self,ATR_STRENGTH, 5); B_ChangeAttribute(self,ATR_DEXTERITY, 5); }; FUNC VOID UnEquip_Rat_ring() { B_ChangeAttribute(self,ATR_STRENGTH,- 5); B_ChangeAttribute(self,ATR_DEXTERITY, -5); };
D
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric; void main() { auto n = readln.chomp.to!int; auto as = readln.split.to!(int[]); sort(as); int i, j = n-1, min_a = int.max, max_a = int.min; while (i < j) { auto s = as[i++] + as[j--]; min_a = min(min_a, s); max_a = max(max_a, s); } writeln(max_a - min_a); }
D
void main() { char[] bug = "Crash"; foreach(char ; bug){} }
D
/** Part of std.xmlp package reimplementation of std.xml (cf.) DOM interface implementation for node base types. Authors: Michael Rynn Licence: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. Distributed under the Boost Software License, Version 1.0. Classes to recode input into a dchar buffer. */ module std.xmlp.charinput; import std.stdint; import core.exception; import std.xmlp.inputencode; import std.xmlp.parseitem; import std.xmlp.error; import std.stdint; import std.utf; import std.stream; import std.string; import std.conv; import std.concurrency, std.socket; import alt.buffer; debug { import std.stdio; } /** A helper class to refill a buffer of InputStringRange */ version (GC_STATS) { import alt.gcstats; } class BufferFill(T) { protected: bool eof_; // Just had LAST FILL! public: this() { eof_ = true; } @property bool isEOF() { return eof_; } bool setEncoding(string encoding) { return false; } bool setBufferSize(uint bsize) { return false; } bool fillData(ref const(T)[] buffer, ref ulong sourceRef) { return false; } } /** Data is provided from any source by the $(D MoreDataDgate). An optional $(I EmptyNotify) delegate is called if the BufferFill!(T) returns false. Data can be pushed back onto an input stack. The input stack is used up first before the primary source. This implementation takes the step of having popFront set the values of both front_ and empty_. The method pumpStart exists to get the stream going for the first time. The empty property will be true unless pumpStart is called. This range is primed by setting arraySource, or dataSource property, and then calling pumpStart. If the input is already exhausted, then empty will still become true after the pumpStart. InputCharRange mostly ignores UTF encoding. */ class InputCharRange(T) { /// Delegate to refill the buffer with data, alias BufferFill!(T) DataFiller; /// Delegate to notify when empty becomes true. alias void delegate() EmptyNotify; version (GC_STATS) { mixin GC_statistics; static this() { setStatsId(typeid(typeof(this)).toString()); } } protected { Buffer!T stack_; // push back bool empty_; T front_; const(T)[] str_; // alias of a buffer to be filled by a delegate size_t nextpos_; // index into string DataFiller df_; // buffer filler EmptyNotify onEmpty_; ulong srcRef_; // original source reference, if any /// push stack character without changing value of front_ void pushInternalStack(T c) { stack_.put(c); } } version(NoGarbageCollection) { ~this() { delete df_; } } /// return empty property of InputRange @property public const final bool empty() { return empty_; } /// return front property of f @property public const final T front() { return front_; } protected { bool FetchMoreData(bool firstPop = false) in { assert(nextpos_ >= str_.length,"FetchMoreData buffer not empty"); } body { if (df_ is null || df_.isEOF()) return false; if (df_.fillData(str_, srcRef_) && str_.length > 0) { empty_ = false; // popFront call is bad, since this was likely called from a popFront. // however, if this is the very first character, called from pumpStart // then have to simulate popFront. if (firstPop) popFront(); else { front_ = str_[0]; nextpos_ = 1; } return true; } return false; } } public: this() { empty_ = true; version(GC_STATS) gcStatsSum.inc(); } ~this() { version(GC_STATS) gcStatsSum.dec(); } /// notifyEmpty read property @property EmptyNotify notifyEmpty() { return onEmpty_; } /// notifyEmpty write property @property void notifyEmpty(EmptyNotify notify) { onEmpty_ = notify; } /// indicate position of datastream in original source @property final ulong sourceReference() { return srcRef_ + nextpos_; } /// Number of bytes per array item @property final uint sourceUnit() { return T.sizeof; } // subtract this from sourceReference to get the position of the buffer start @property final auto sourceOffset() { return nextpos_; } /// After setting this, require call to pumpStart @property void arraySource(T[] data) { str_ = data; empty_ = true; srcRef_ = 0; nextpos_ = 0; } /// After setting this, require call to pumpStart @property void dataSource(DataFiller df) { df_ = df; empty_ = true; srcRef_ = 0; nextpos_ = 0; } /** Only does anything if empty is already set to true, which can be from setting the dataSource property. It will only then reset empty, and try to prime the input with a popFront. Returns !empty. */ bool pumpStart() { if (!empty_) return true; if (df_ !is null) { empty_ = !FetchMoreData(true); } else { empty_ = (str_.length > 0); nextpos_ = 0; if (!empty) popFront(); } return !empty_; } /// Push a single character in front of input stream final void pushFront(T c) { if (!empty_) { stack_.put(front_); } front_ = c; empty_ = false; } /// push a bunch of characters back in front of stream final void pushFront(const(T)[] s) { if (s.length == 0) return; if (!empty_) { // normal case stack_.put(front_); } auto slen = s.length; while (slen-- > 1) stack_.put(s[slen]); front_ = s[0]; empty_ = false; } /// push a bunch of characters back in front of stream final void convertPushFront(U : U[])(const(U)[] s) if (!is(typeof(U) == typeof(T))) { pushFront(to!(const(T)[])(s)); } /** InputRange method to bring the next character to front. Checks internal stack first, and if empty uses primary buffer. */ void popFront() { if (empty_) throw new RangeError("popFront when empty",__LINE__); if (stack_.length > 0) { front_ = stack_.movePopBack(); return; } if (nextpos_ < str_.length) { front_ = str_[nextpos_++]; } else { empty_ = !FetchMoreData(); if (empty_) { front_ = 0; if (onEmpty_) onEmpty_(); } } } /// Return the front character if not empty, no state change final const bool peek(ref T next) { if (!empty_) { next = front_; return true; } return false; } /// Return the front character if not empty, and call popFront final bool pull(ref T next) { if (!empty_) { next = front_; popFront(); return true; } return false; } /** Change the number of characters returned at a time. It may or may not take effect only after refill. For xml documents a small buffer size is used until the encoding has been established. */ final bool setBufferSize(uint bsize) { if (df_ !is null) return df_.setBufferSize(bsize); else return false; } /** Change the character encoding of the underlying datastream. It may or may not take effect only after refill. */ final bool setEncoding(string encoding) { if (df_ !is null) return df_.setEncoding(encoding); else return false; } } /** Can pushFront dchar or dchar[] onto a stack, which is emptied first. popFront is done in constructor, so that empty and front, both mandatory calls, are as fast as possible. Property index points to position of front in data string, only if stack_ was empty on last popFront. */ struct ParseInputRange(T) { const(T)[] data; uintptr_t index_; uintptr_t pos = 0; dchar front; bool empty; Buffer!dchar stack_; // refers to front if stack_ was empty last popFront @property uintptr_t index() { return index_; } // refers to front if stack_ was empty last popFront @property uintptr_t nextIndex() { return pos; } this(const(T)[] s) { data = s; popFront(); } void pushFront(dchar c) { if (!empty) stack_.put(front); else empty = false; front = c; } /// push a bunch of UTF32 characters in front of everything else, in reverse. void pushFront(const(dchar)[] s) { if (s.length == 0) return; if (!empty) stack_.put(front); else empty = false; auto slen = s.length; while (slen-- > 1) stack_.put(s[slen]); front = s[0]; } void popFront() { if (stack_.length > 0) { front = stack_.back(); stack_.popBack(); return; } if (pos < data.length) { index_ = pos; static if (is(T==char) || is(T==wchar)) { front = decode(data,pos); } else { front = data[pos++]; } } else { index_ = pos; empty = true; } } } /** Take as input source a D string */ class SliceFill(T) : BufferFill!(dchar) { protected: const(T)[] src_; size_t usedup_; Buffer!dchar buffer_; enum {INTERNAL_BUF = 1000}; public: version (GC_STATS) { mixin GC_statistics; static this() { setStatsId(typeid(typeof(this)).toString()); } } this() { version(GC_STATS) gcStatsSum.inc(); } ~this() { version(GC_STATS) gcStatsSum.dec(); } this(const(T)[] s) { super(); src_ = s; eof_ = (s.length == 0); version(GC_STATS) gcStatsSum.inc(); } override bool fillData(ref const(dchar)[] data, ref ulong sref) { auto slen = src_.length; if (slen == 0) { eof_ = true; return false; } sref = usedup_; static if (is(T==dchar)) { data = src_; // its a direct transfer usedup_ = slen; src_.length = 0; eof_ = true; return true; } else { size_t pos = 0; if (buffer_.length == 0) { size_t maxlen = (slen < INTERNAL_BUF) ? slen : INTERNAL_BUF; buffer_.reserve(maxlen,true); buffer_.length = buffer_.capacity; } static if (is(T==wchar)) { buffer_.length = decode_wchar(src_, buffer_.toArray, pos); src_ = src_[pos..$]; } else static if (is(T==char)) { buffer_.length = decode_char(src_, buffer_.toArray, pos); src_ = src_[pos..$]; } usedup_ += pos; if (src_.length == 0) eof_ = true; if (buffer_.length > 0) { data = buffer_.peek; return true; } else { data = null; return false; } } } } class StreamFill(T) : BufferFill!(T) { version (GC_STATS) { mixin GC_statistics; static this() { setStatsId(typeid(typeof(this)).toString()); } } Stream s_; // InputStream does not have seek ubyte[] data_; // Standard stream is a bastard with endian swapping. enum { INTERNAL_BUF = 4096 / T.sizeof } override bool fillData(ref const(T)[] fillme, ref ulong refPos) { if (data_ is null) { data_ = new ubyte[INTERNAL_BUF]; } refPos = s_.position / T.sizeof; // reference in character units size_t didRead = s_.read(data_); if (didRead > 0) { fillme = (cast(T*) data_.ptr)[0..didRead / T.sizeof]; return true; } return false; } this(Stream ins) { super(); s_ = ins; eof_ = false; version(GC_STATS) gcStatsSum.inc(); } ~this() { version(GC_STATS) gcStatsSum.dec(); } } /// Connection of raw streams (data buffer fillers) to decoding InputRange alias StreamFill!(char) CharFiller; alias StreamFill!(wchar) WCharFiller; alias StreamFill!(dchar) DCharFiller; alias InputCharRange!(char) CharIR; alias InputCharRange!(wchar) WCharIR; alias InputCharRange!(dchar) DCharIR; alias RecodeChar!(CharIR) Recode8; alias RecodeWChar!(WCharIR) Recode16; alias RecodeDChar!(DCharIR) Recode32; /// Big complicated class to provide a single interface to different kinds of encoded inputs. class XmlStreamFiller : BufferFill!(dchar) { // inherit ParseInput so can use buffer and pointer to member function type Stream rawStream; uint nextBufferSize_; bool checkedBom_; uint selector_; string encoding_; ByteOrderMark bom_; Buffer!dchar buffer_; // only one of these pairs of input ranges and decoders will be selected. CharIR cir_; Recode8.RecodeFunc charDo_; WCharIR wir_; Recode16.RecodeFunc wcharDo_; DCharIR dir_; Recode32.RecodeFunc dcharDo_; enum { SMALL_BUFFER_SIZE = 4, LARGE_BUFFER_SIZE = 1024}; void init() { checkedBom_ = false; eof_ = false; nextBufferSize_ = SMALL_BUFFER_SIZE; selector_ = 0; // input character size } public: this(Stream s) { rawStream = s; init(); } version(NoGarbageCollection) { ~this() { rawStream.close(); if (cir_) delete cir_; if (wir_) delete wir_; if (dir_) delete dir_; } } @property final uint charBytes() { return selector_; } /// passed a buffer from caller override bool fillData(ref const(dchar)[] buffer, ref ulong posRef) { if (!checkedBom_) { checkedBom_ = true; if (!initStream()) return false; // use the decode to fill the buffer } // now get characters. if (buffer_.length != nextBufferSize_) buffer_.length = nextBufferSize_; auto temp = buffer_.toArray; switch(selector_) { case 1: buffer_.length = fillCharData(temp,posRef); break; case 2: buffer_.length = fillWCharData(temp,posRef); break; case 4: buffer_.length = fillDCharData(temp,posRef); break; default: break; } if (eof_) rawStream.close(); if (buffer_.length > 0) { buffer = buffer_.peek; return true; } else { buffer = null; buffer_.forget(); return false; } } /// return the encoding name string getEncoding() { return bom_.key.codeName; } /// Setup the correct conversion function for the encoding, check for source BOM compatibility. override bool setEncoding(string encoding) { if (bom_ !is null) // always true? { string uenc = encoding.toUpper(); // a switch in coding must be compatible with current bom? if (uenc == bom_.key.codeName) { return true; } else { if (bom_ != ByteOrderRegistry.noMark) { throw encodingInvalid(bom_.key.toString(), encoding); } } } switch(selector_) { case 1: { auto test1 = Recode8.getRecodeFunc(encoding); if (test1 is null) throw encodingNotFound(selector_,encoding); charDo_ = test1; } break; case 2: { auto test2 = Recode16.getRecodeFunc(encoding); if (test2 is null) throw encodingNotFound(selector_,encoding); wcharDo_ = test2; } break; case 4: { auto test4 = Recode32.getRecodeFunc(encoding); if (test4 is null) throw encodingNotFound(selector_,encoding); dcharDo_ = test4; } break; default: return false; } return true; } /// when the buffer is next empty, it will adopt the new size. override bool setBufferSize(uint bsize) { nextBufferSize_ = bsize; return true; } private: /** * Start reading the stream, find out BOM and encoding, start decoding * into a stream of dchar. Return true if successful and data exists. **/ bool initStream() { Buffer!ubyte preload; preload.reserve(8); bool eofFlag_ = false; buffer_.reserve(LARGE_BUFFER_SIZE,true); bom_ = readStreamBOM(rawStream, preload, eofFlag_); if (eofFlag_ && (preload.length == 0)) { return false; } encoding_ = bom_.key.toString(); selector_ = bom_.charSize; switch (selector_) { case 1: { CharFiller fill = new CharFiller(rawStream); cir_ = new CharIR(); cir_.dataSource(fill); cir_.pumpStart(); charDo_ = Recode8.getRecodeFunc(encoding_); if (charDo_ is null) return false; const auto pct = preload.length; if (pct > 0) { for(uint k = 0; k < pct; k++) cir_.pushFront(preload[k]); } } break; case 2: { auto wfill = new WCharFiller(rawStream); wir_ = new WCharIR(); wir_.dataSource(wfill); wir_.pumpStart(); wcharDo_ = Recode16.getRecodeFunc(encoding_); if (wcharDo_ is null) return false; if (preload.length > 0) { wchar[] buf; wswapchar sbytes; for(uintptr_t k = 0; k+1 < preload.length; k += 2) { sbytes.c.c0 = preload[k]; sbytes.c.c1 = preload[k+1]; wir_.pushFront(sbytes.w0); } } } break; case 4: { auto dfill = new DCharFiller(rawStream);//DCharDecode dir_ = new DCharIR(); dir_.dataSource(dfill); dir_.pumpStart(); dcharDo_ = Recode32.getRecodeFunc(encoding_); if (dcharDo_ is null) return false; if (preload.length > 0) { dchar[] buf; dswapchar sbytes; for(uintptr_t k = 0; k+3 < preload.length; k += 4) { sbytes.c.c0 = preload[k]; sbytes.c.c1 = preload[k+1]; sbytes.c.c2 = preload[k+2]; sbytes.c.c3 = preload[k+3]; dir_.pushFront(sbytes.d0); } } } break; default: return false; } return true; } uintptr_t fillCharData(dchar[] buffer, ref ulong posRef) { posRef = cir_.sourceReference(); uintptr_t i = 0; try { while(i < buffer.length) { if (!charDo_(cir_,buffer[i])) { if (cir_.empty && (i > 0)) { eof_ = true; } break; } i++; } } catch (CharSequenceError ex) { throw recodeFailed(posRef + i, ex.toString()); } return i; } uintptr_t fillWCharData(dchar[] buffer, ref ulong posRef) { posRef = wir_.sourceReference(); uintptr_t i = 0; while(i < buffer.length) { if (!wcharDo_(wir_ ,buffer[i])) { if (wir_.empty && (i > 0)) { eof_ = true; } break; } i++; } return i; } uintptr_t fillDCharData(dchar[] buffer, ref ulong posRef) { posRef = dir_.sourceReference(); uintptr_t i = 0; while(i < buffer.length) { if (!dcharDo_(dir_,buffer[i])) { if (dir_.empty && (i > 0)) { eof_ = true; } break; } i++; } return i; } } /// This needs to be on a thread (see std.concurrency receive documentation) /// the receive blocks until sent a string. Designed for server based on listener.d example class AsyncFill : BufferFill!(dchar) { Buffer!char source; bool isResidual; ulong ct; Buffer!dchar buffer_; this() { eof_ = false; } bool getMore() { /+ 2.059 compile errors ulong oldCount = ct; receive( (string s) { source.put(s); ct += s.length; } ); return ct > oldCount; +/ return false; } override bool fillData(ref const(dchar)[] buffer, ref ulong posRef) { posRef = ct; for (;;) { if (source.length == 0 || isResidual) { if (!getMore()) { eof_ = true; return false; } } if (buffer_.capacity == 0) { buffer_.reserve(1000,true); } auto minlen = source.length; if (minlen > buffer.capacity) minlen = buffer.capacity; buffer_.length = minlen; auto temp = source.toArray; uintptr_t ix = 0; buffer_.length = decode_char(temp,buffer_.toArray,ix); if (ix > 0) { // source consumed // more residual to front, and reset length if (ix < temp.length) { auto newLength = temp.length-ix; temp[0..newLength] = temp[ix..$]; source.length = newLength; isResidual = true; } else { source.length = 0; isResidual = false; } } buffer = buffer_.toArray; if (buffer.length > 0) return true; } } } /// get whats next available from a socket. Reading from a SocketStream seems an unncessary wrapper class SocketFill : AsyncFill { Socket sock_; this(Socket s) { sock_ = s; } override bool getMore() { ulong oldCount = ct; char[1024] cbuf; intptr_t read = sock_.receive(cbuf); // this blocks if no data if (Socket.ERROR == read) { sock_.close(); // release socket resources now debug writeln("Socket Error closed ", read); throw new ParseError("Socket error", ParseError.error); } else if (0 == read) { eof_ = true; string err_message; try { // if the connection closed due to an error, remoteAddress() could fail err_message = format("Connection from %s closed.", sock_.toString()); } catch (SocketException) { err_message = "Connection closed."; } debug writeln("Socket error: ",err_message); throw new ParseError(err_message, ParseError.error); } else { debug writeln("read: ", cbuf[0..read]); source.put(cbuf[0..read]); ct += read; } return ct > oldCount; } } /// generate ParseError at an input positions Exception recodeFailed(ulong position, string msg) { return new ParseError(text("Recode function failed at position ", position, ". ", msg), ParseError.error); } /// generate ParseError for incompatible encoding Exception encodingIncompatible(string name, uint selector) { return new ParseError(format("Encoding %s is incompatible with source size of %s bytes", name, selector), ParseError.fatal); } /** Failed to find an encoding function for the character size being used. Check for other character sizes, if found, throw incompatible, if not, throw not found. Wrong encoding is not well formed, not known is an error. */ Exception encodingNotFound(uint selector, string name) { string found; if (selector != 1) { auto test1 = Recode8.getRecodeFunc(name); if (test1 != null) { return encodingIncompatible(name,selector); } } if (selector != 2) { auto test2 = Recode16.getRecodeFunc(name); if (test2 != null) { return encodingIncompatible(name,selector); } } if (selector != 4) { auto test4 = Recode32.getRecodeFunc(name); if (test4 != null) { return encodingIncompatible(name,selector); } } return new ParseError(text("Encoding not found ",name, " bytes ",selector), ParseError.error); } /// Encoding is invalid for BOM. Exception encodingInvalid(string bomName, string encName) { return new ParseError(text("Encoding ambiguity with byte order mark ",bomName, " encoding ",encName), ParseError.invalid); }
D
/* * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ module test.quartz.AnnualCalendarTest; // import java.util.Calendar; // import java.util.Locale; // import java.util.TimeZone; import hunt.quartz.impl.calendar.AnnualCalendar; import hunt.time.Constants; import hunt.time.LocalDateTime; import hunt.time.Month; import hunt.time.ZoneId; import hunt.time.ZoneRegion; import hunt.Exceptions; import hunt.logging.ConsoleLogger; import hunt.util.UnitTest; import hunt.Assert; alias assertTrue = Assert.assertTrue; alias assertFalse = Assert.assertFalse; alias assertThat = Assert.assertThat; alias assertEquals = Assert.assertEquals; alias assertNotNull = Assert.assertNotNull; alias assertNull = Assert.assertNull; /** * Unit test for AnnualCalendar serialization backwards compatibility. */ public class AnnualCalendarTest { private enum string[] VERSIONS = ["1.5.1"]; private __gshared ZoneId EST_TIME_ZONE; shared static this() { EST_TIME_ZONE = ZoneRegion.of("America/New_York"); } /** * Get the object to serialize when generating serialized file for future * tests, and against which to validate deserialized object. */ // protected Object getTargetObject() { // AnnualCalendar c = new AnnualCalendar(); // c.setDescription("description"); // LocalDateTime cal = LocalDateTime.of(2005, Month.JANUARY, 20, 10, 5, 15); // c.setDayExcluded(cal, true); // return c; // } /** * Get the Quartz versions for which we should verify * serialization backwards compatibility. */ protected string[] getVersions() { return VERSIONS; } /** * Verify that the target object and the object we just deserialized * match. */ // protected void verifyMatch(Object target, Object deserialized) { // AnnualCalendar targetCalendar = (AnnualCalendar)target; // AnnualCalendar deserializedCalendar = (AnnualCalendar)deserialized; // assertNotNull(deserializedCalendar); // assertEquals(targetCalendar.getDescription(), deserializedCalendar.getDescription()); // assertEquals(targetCalendar.getDaysExcluded(), deserializedCalendar.getDaysExcluded()); // assertNull(deserializedCalendar.getTimeZone()); // } /** * Tests if method <code>setDaysExcluded</code> protects the property daysExcluded against nulling. * See: QUARTZ-590 */ public void testDaysExcluded() { AnnualCalendar annualCalendar = new AnnualCalendar(); annualCalendar.setDaysExcluded(null); assertNotNull("Annual calendar daysExcluded property should have been set to empty ArrayList, not null.", annualCalendar.getDaysExcluded()); } /** * Tests the parameter <code>exclude</code> in a method <code>setDaysExcluded</code> * of class <code>org.quartz.impl.calendar.AnnualCalendar</code> */ public void testExclude() { AnnualCalendar annualCalendar = new AnnualCalendar(); LocalDateTime day = LocalDateTime.now(); day = day.withMonth(10).withDayOfMonth(15); annualCalendar.setDayExcluded(day, false); assertTrue("The day 15 October is not expected to be excluded but it is", !annualCalendar.isDayExcluded(day)); day = day.withMonth(10).withDayOfMonth(15); annualCalendar.setDayExcluded(day, true); day = day.withMonth(11).withDayOfMonth(12); annualCalendar.setDayExcluded(day, true); day = day.withMonth(9).withDayOfMonth(1); annualCalendar.setDayExcluded(day, true); assertTrue("The day 15 October is expected to be excluded but it is not", annualCalendar.isDayExcluded(day)); day = day.withMonth(10).withDayOfMonth(15); annualCalendar.setDayExcluded(day, false); assertTrue("The day 15 October is not expected to be excluded but it is", !annualCalendar.isDayExcluded(day)); } /** * QUARTZ-679 Test if the annualCalendar works over years */ public void testDaysExcludedOverTime() { AnnualCalendar annualCalendar = new AnnualCalendar(); LocalDateTime day = LocalDateTime.now(); day = day.withYear(2005).withMonth(MonthCode.JUNE).withDayOfMonth(23); annualCalendar.setDayExcluded(day, true); day = day.withYear(2008).withMonth(MonthCode.FEBRUARY).withDayOfMonth(1); annualCalendar.setDayExcluded(day, true); assertTrue("The day 1 February is expected to be excluded but it is not", annualCalendar.isDayExcluded(day)); } /** * Part 2 of the tests of QUARTZ-679 */ public void testRemoveInTheFuture() { AnnualCalendar annualCalendar = new AnnualCalendar(); LocalDateTime day = LocalDateTime.now(); day = day.withYear(2005).withMonth(MonthCode.JUNE).withDayOfMonth(23); annualCalendar.setDayExcluded(day, true); // Trying to remove the 23th of June day = day.withYear(2008).withMonth(MonthCode.JUNE).withDayOfMonth(23); annualCalendar.setDayExcluded(day, false); assertTrue("The day 23 June is not expected to be excluded but it is", ! annualCalendar.isDayExcluded(day)); } }
D
/mnt/c/Users/User/documents/cctime/leapyear/target/debug/deps/leapyear-581c6363b9f85db1: src/main.rs /mnt/c/Users/User/documents/cctime/leapyear/target/debug/deps/leapyear-581c6363b9f85db1.d: src/main.rs src/main.rs:
D
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ module flow.engine.impl.history.AbstractHistoryManager; import hunt.time.LocalDateTime; import hunt.collection.List; import flow.bpmn.model.BpmnModel; import flow.bpmn.model.ExtensionElement; import flow.bpmn.model.FlowElement; import flow.bpmn.model.FlowNode; import flow.bpmn.model.Process; import flow.bpmn.model.SequenceFlow; import flow.common.api.scop.ScopeTypes; import flow.common.history.HistoryLevel; //import flow.common.identity.Authentication; //import flow.common.persistence.cache.EntityCache; import flow.engine.impl.cfg.ProcessEngineConfigurationImpl; import flow.engine.impl.persistence.AbstractManager; import flow.engine.impl.persistence.entity.CommentEntity; import flow.engine.impl.persistence.entity.ExecutionEntity; import flow.engine.impl.persistence.entity.HistoricActivityInstanceEntity; import flow.engine.impl.persistence.entity.HistoricActivityInstanceEntityManager; import flow.engine.impl.util.CommandContextUtil; import flow.engine.impl.util.ProcessDefinitionUtil; import flow.engine.repository.ProcessDefinition; import flow.engine.task.Event; import flow.entitylink.service.impl.persistence.entity.EntityLinkEntity; import flow.identitylink.service.impl.persistence.entity.IdentityLinkEntity; import flow.task.service.HistoricTaskService; import flow.task.service.impl.persistence.entity.TaskEntity; import flow.variable.service.impl.persistence.entity.VariableInstanceEntity; import flow.engine.impl.history.HistoryManager; import hunt.Exceptions; abstract class AbstractHistoryManager : AbstractManager , HistoryManager { protected HistoryLevel historyLevel; protected bool enableProcessDefinitionHistoryLevel; protected bool usePrefixId; this(ProcessEngineConfigurationImpl processEngineConfiguration, HistoryLevel historyLevel, bool usePrefixId) { super(processEngineConfiguration); this.historyLevel = historyLevel; this.enableProcessDefinitionHistoryLevel = processEngineConfiguration.isEnableProcessDefinitionHistoryLevel(); this.usePrefixId = usePrefixId; } public bool isHistoryLevelAtLeast(HistoryLevel level) { return isHistoryLevelAtLeast(level, null); } public bool isHistoryLevelAtLeast(HistoryLevel level, string processDefinitionId) { if (enableProcessDefinitionHistoryLevel && processDefinitionId !is null) { HistoryLevel processDefinitionLevel = getProcessDefinitionHistoryLevel(processDefinitionId); if (processDefinitionLevel !is null) { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}, level required: {}", processDefinitionLevel, level); //} return processDefinitionLevel.isAtLeast(level); } else { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}, level required: {}", historyLevel, level); //} return historyLevel.isAtLeast(level); } } else { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}, level required: {}", historyLevel, level); //} // Comparing enums actually compares the location of values declared in the enum return historyLevel.isAtLeast(level); } } public bool isHistoryEnabled() { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}", historyLevel); //} return historyLevel != HistoryLevel.NONE; } public bool isHistoryEnabled(string processDefinitionId) { if (enableProcessDefinitionHistoryLevel && processDefinitionId !is null) { HistoryLevel processDefinitionLevel = getProcessDefinitionHistoryLevel(processDefinitionId); if (processDefinitionLevel !is null) { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}", processDefinitionLevel); //} return processDefinitionLevel != (HistoryLevel.NONE); } else { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}", historyLevel); //} return historyLevel !=(HistoryLevel.NONE); } } else { //if (LOGGER.isDebugEnabled()) { // LOGGER.debug("Current history level: {}", historyLevel); //} return historyLevel != (HistoryLevel.NONE); } } public void createIdentityLinkComment(TaskEntity taskEntity, string userId, string groupId, string type, bool create) { createIdentityLinkComment(taskEntity, userId, groupId, type, create, false); } public void createUserIdentityLinkComment(TaskEntity taskEntity, string userId, string type, bool create) { createIdentityLinkComment(taskEntity, userId, null, type, create, false); } public void createGroupIdentityLinkComment(TaskEntity taskEntity, string groupId, string type, bool create) { createIdentityLinkComment(taskEntity, null, groupId, type, create, false); } public void createUserIdentityLinkComment(TaskEntity taskEntity, string userId, string type, bool create, bool forceNullUserId) { createIdentityLinkComment(taskEntity, userId, null, type, create, forceNullUserId); } /* * (non-Javadoc) * * @see flow.engine.impl.history.HistoryManagerInterface# createIdentityLinkComment(java.lang.string, java.lang.string, java.lang.string, java.lang.string, bool, bool) */ public void createIdentityLinkComment(TaskEntity taskEntity, string userId, string groupId, string type, bool create, bool forceNullUserId) { implementationMissing(false); //if (isHistoryLevelAtLeast(HistoryLevel.AUDIT, taskEntity.getProcessDefinitionId())) { // string authenticatedUserId = Authentication.getAuthenticatedUserId(); // CommentEntity comment = getCommentEntityManager().create(); // comment.setUserId(authenticatedUserId); // comment.setType(CommentEntity.TYPE_EVENT); // comment.setTime(getClock().getCurrentTime()); // comment.setTaskId(taskEntity.getId()); // if (userId !is null || forceNullUserId) { // if (create && !forceNullUserId) { // comment.setAction(Event.ACTION_ADD_USER_LINK); // } else { // comment.setAction(Event.ACTION_DELETE_USER_LINK); // } // comment.setMessage(new string[] { userId, type }); // } else { // if (create) { // comment.setAction(Event.ACTION_ADD_GROUP_LINK); // } else { // comment.setAction(Event.ACTION_DELETE_GROUP_LINK); // } // comment.setMessage(new string[] { groupId, type }); // } // // getCommentEntityManager().insert(comment); //} } public void createProcessInstanceIdentityLinkComment(ExecutionEntity processInstance, string userId, string groupId, string type, bool create) { createProcessInstanceIdentityLinkComment(processInstance, userId, groupId, type, create, false); } public void createProcessInstanceIdentityLinkComment(ExecutionEntity processInstance, string userId, string groupId, string type, bool create, bool forceNullUserId) { implementationMissing(false); //if (isHistoryLevelAtLeast(HistoryLevel.AUDIT, processInstance.getProcessDefinitionId())) { // string authenticatedUserId = Authentication.getAuthenticatedUserId(); // CommentEntity comment = getCommentEntityManager().create(); // comment.setUserId(authenticatedUserId); // comment.setType(CommentEntity.TYPE_EVENT); // comment.setTime(getClock().getCurrentTime()); // comment.setProcessInstanceId(processInstance.getId()); // if (userId !is null || forceNullUserId) { // if (create && !forceNullUserId) { // comment.setAction(Event.ACTION_ADD_USER_LINK); // } else { // comment.setAction(Event.ACTION_DELETE_USER_LINK); // } // comment.setMessage(new string[] { userId, type }); // } else { // if (create) { // comment.setAction(Event.ACTION_ADD_GROUP_LINK); // } else { // comment.setAction(Event.ACTION_DELETE_GROUP_LINK); // } // comment.setMessage(new string[] { groupId, type }); // } // getCommentEntityManager().insert(comment); //} } /* * (non-Javadoc) * * @see flow.engine.impl.history.HistoryManagerInterface# createAttachmentComment(java.lang.string, java.lang.string, java.lang.string, bool) */ public void createAttachmentComment(TaskEntity task, ExecutionEntity processInstance, string attachmentName, bool create) { implementationMissing(false); //string processDefinitionId = null; //if (processInstance !is null) { // processDefinitionId = processInstance.getProcessDefinitionId(); //} else if (task !is null) { // processDefinitionId = task.getProcessDefinitionId(); //} //if (isHistoryEnabled(processDefinitionId)) { // string userId = Authentication.getAuthenticatedUserId(); // CommentEntity comment = getCommentEntityManager().create(); // comment.setUserId(userId); // comment.setType(CommentEntity.TYPE_EVENT); // comment.setTime(getClock().getCurrentTime()); // if (task !is null) { // comment.setTaskId(task.getId()); // } // if (processInstance !is null) { // comment.setProcessInstanceId(processInstance.getId()); // } // if (create) { // comment.setAction(Event.ACTION_ADD_ATTACHMENT); // } else { // comment.setAction(Event.ACTION_DELETE_ATTACHMENT); // } // comment.setMessage(attachmentName); // getCommentEntityManager().insert(comment); //} } public void updateActivity(ExecutionEntity childExecution, string oldActivityId, FlowElement newFlowElement, TaskEntity task, Date updateTime) { if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) { HistoricActivityInstanceEntityManager historicActivityInstanceEntityManager = CommandContextUtil.getHistoricActivityInstanceEntityManager(); List!HistoricActivityInstanceEntity historicActivityInstances = historicActivityInstanceEntityManager.findHistoricActivityInstancesByExecutionAndActivityId(childExecution.getId(), oldActivityId); foreach (HistoricActivityInstanceEntity historicActivityInstance ; historicActivityInstances) { historicActivityInstance.setProcessDefinitionId(childExecution.getProcessDefinitionId()); historicActivityInstance.setActivityId(childExecution.getActivityId()); historicActivityInstance.setActivityName(newFlowElement.getName()); } } if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskService historicTaskService = CommandContextUtil.getHistoricTaskService(); historicTaskService.recordTaskInfoChange(task, updateTime); } } protected HistoricActivityInstanceEntity getHistoricActivityInstanceFromCache(string executionId, string activityId, bool endTimeMustBeNull) { implementationMissing(false); //List!HistoricActivityInstanceEntity cachedHistoricActivityInstances = getEntityCache().findInCache(HistoricActivityInstanceEntity.class); //for (HistoricActivityInstanceEntity cachedHistoricActivityInstance : cachedHistoricActivityInstances) { // if (activityId !is null // && activityId.equals(cachedHistoricActivityInstance.getActivityId()) // && (!endTimeMustBeNull || cachedHistoricActivityInstance.getEndTime() is null)) { // if (executionId.equals(cachedHistoricActivityInstance.getExecutionId())) { // return cachedHistoricActivityInstance; // } // } //} return null; } public HistoricActivityInstanceEntity findHistoricActivityInstance(ExecutionEntity execution, bool endTimeMustBeNull) { if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, execution.getProcessDefinitionId())) { string activityId = getActivityIdForExecution(execution); return activityId !is null ? findHistoricActivityInstance(execution, activityId, endTimeMustBeNull) : null; } return null; } protected string getActivityIdForExecution(ExecutionEntity execution) { string activityId = null; if (cast(FlowNode)execution.getCurrentFlowElement() !is null) { activityId = execution.getCurrentFlowElement().getId(); } else if (cast(SequenceFlow)execution.getCurrentFlowElement() !is null && execution.getCurrentFlowableListener() is null) { // while executing sequence flow listeners, we don't want historic activities activityId = (cast(SequenceFlow) execution.getCurrentFlowElement()).getSourceFlowElement().getId(); } return activityId; } protected HistoricActivityInstanceEntity findHistoricActivityInstance(ExecutionEntity execution, string activityId, bool endTimeMustBeNull) { implementationMissing(false); // No use looking for the HistoricActivityInstance when no activityId is provided. //if (activityId is null) { // return null; //} // //string executionId = execution.getId(); // //// Check the cache //HistoricActivityInstanceEntity historicActivityInstanceEntityFromCache = getHistoricActivityInstanceFromCache(executionId, activityId, endTimeMustBeNull); //if (historicActivityInstanceEntityFromCache !is null) { // return historicActivityInstanceEntityFromCache; //} // //// If the execution was freshly created, there is no need to check the database, //// there can never be an entry for a historic activity instance with this execution id. //if (!execution.isInserted() && !execution.isProcessInstanceType()) { // // // Check the database // List!HistoricActivityInstanceEntity historicActivityInstances = getHistoricActivityInstanceEntityManager() // .findUnfinishedHistoricActivityInstancesByExecutionAndActivityId(executionId, activityId); // // if (historicActivityInstances.size() > 0 && (!endTimeMustBeNull || historicActivityInstances.get(0).getEndTime() is null)) { // return historicActivityInstances.get(0); // } // //} return null; } protected HistoryLevel getProcessDefinitionHistoryLevel(string processDefinitionId) { implementationMissing(false); return null; //HistoryLevel processDefinitionHistoryLevel = null; // //try { // ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId); // // BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId); // // Process process = bpmnModel.getProcessById(processDefinition.getKey()); // if (process.getExtensionElements().containsKey("historyLevel")) { // ExtensionElement historyLevelElement = process.getExtensionElements().get("historyLevel").iterator().next(); // string historyLevelValue = historyLevelElement.getElementText(); // if (StringUtils.isNotEmpty(historyLevelValue)) { // try { // processDefinitionHistoryLevel = HistoryLevel.getHistoryLevelForKey(historyLevelValue); // // } catch (Exception e) {} // } // } // // if (processDefinitionHistoryLevel is null) { // processDefinitionHistoryLevel = this.historyLevel; // } //} catch (Exception e) {} // //return processDefinitionHistoryLevel; } protected string parseActivityType(FlowElement element) { implementationMissing(false); return ""; //string elementType = element.getClass().getSimpleName(); //elementType = elementType.substring(0, 1).toLowerCase() + elementType.substring(1); //return elementType; } //protected EntityCache getEntityCache() { // return getSession(EntityCache.class); //} public HistoryLevel getHistoryLevel() { return historyLevel; } public void setHistoryLevel(HistoryLevel historyLevel) { this.historyLevel = historyLevel; } protected string getProcessDefinitionId(VariableInstanceEntity variable, ExecutionEntity sourceActivityExecution) { string processDefinitionId = null; if (sourceActivityExecution !is null) { processDefinitionId = sourceActivityExecution.getProcessDefinitionId(); } else if (variable.getProcessInstanceId() !is null && variable.getProcessInstanceId().length != 0) { ExecutionEntity processInstanceExecution = CommandContextUtil.getExecutionEntityManager().findById(variable.getProcessInstanceId()); if (processInstanceExecution !is null) { processDefinitionId = processInstanceExecution.getProcessDefinitionId(); } } else if (variable.getTaskId() !is null && variable.getTaskId().length !=0 ) { TaskEntity taskEntity = CommandContextUtil.getTaskService().getTask(variable.getTaskId()); if (taskEntity !is null) { processDefinitionId = taskEntity.getProcessDefinitionId(); } } return processDefinitionId; } protected string getProcessDefinitionId(IdentityLinkEntity identityLink) { string processDefinitionId = null; if (identityLink.getProcessInstanceId() !is null && identityLink.getProcessInstanceId().length != 0) { ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager().findById(identityLink.getProcessInstanceId()); if (execution !is null) { processDefinitionId = execution.getProcessDefinitionId(); } } else if (identityLink.getTaskId() !is null && identityLink.getTaskId().length != 0) { TaskEntity task = CommandContextUtil.getTaskService().getTask(identityLink.getTaskId()); if (task !is null) { processDefinitionId = task.getProcessDefinitionId(); } } return processDefinitionId; } protected string getProcessDefinitionId(EntityLinkEntity entityLink) { string processDefinitionId = null; if (ScopeTypes.BPMN == (entityLink.getScopeType()) && entityLink.getScopeId() !is null && entityLink.getScopeId().length != 0) { ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager().findById(entityLink.getScopeId()); if (execution !is null) { processDefinitionId = execution.getProcessDefinitionId(); } } else if (ScopeTypes.TASK == (entityLink.getScopeType()) && entityLink.getScopeId() !is null && entityLink.getScopeId().length != 0) { TaskEntity task = CommandContextUtil.getTaskService().getTask(entityLink.getScopeId()); if (task !is null) { processDefinitionId = task.getProcessDefinitionId(); } } return processDefinitionId; } }
D
module sendero.time.LocalTime; import tango.time.Time; public import sendero.time.TimeZone; struct LocalTime { public Time utc; public TimeZone zone; Time local() { return zone.toLocal(utc); } void local(Time local) { utc = local - zone.getOffsetViaLocal(local); } alias local time; TimeSpan offset() { return zone.getOffsetViaUtc(utc); } char[] format() { return zone.format(utc); } } version(Unittest) { import tango.time.Clock; import tango.util.Convert; import tango.time.chrono.Gregorian; import tango.io.Stdout; import sendero_base.util.ISO8601; char[] pt(Time t) { char[] res; printISO8601(Clock.toDate(t), (char[] val) { res ~= val;} ); return res; } unittest { alias Gregorian.generic gg; } }
D
# FIXED UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/Comun/common/F2837xD_PieVect.c UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_device.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/assert.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/linkage.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stdarg.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stdbool.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stddef.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stdint.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_adc.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_analogsubsys.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_can.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_cla.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_cmpss.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_cputimer.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_dac.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_dcsm.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_dma.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_ecap.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_emif.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_epwm.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_epwm_xbar.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_eqep.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_flash.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_gpio.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_i2c.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_input_xbar.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_ipc.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_mcbsp.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_memconfig.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_nmiintrupt.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_output_xbar.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_piectrl.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_pievect.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_sci.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_sdfm.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_spi.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_sysctrl.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_upp.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_xbar.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_xint.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Examples.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_GlobalPrototypes.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_cputimervars.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Cla_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_EPwm_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Adc_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Emif_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Gpio_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_I2c_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Ipc_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Pie_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Dma_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_SysCtrl_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Upp_defines.h UFCharger/F2837xD/Comun/common/F2837xD_PieVect.obj: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_defaultisr.h C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/Comun/common/F2837xD_PieVect.c: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_device.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/assert.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/linkage.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stdarg.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stdbool.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stddef.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/ti-cgt-c2000_16.9.6.LTS/include/stdint.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_adc.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_analogsubsys.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_can.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_cla.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_cmpss.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_cputimer.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_dac.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_dcsm.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_dma.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_ecap.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_emif.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_epwm.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_epwm_xbar.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_eqep.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_flash.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_gpio.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_i2c.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_input_xbar.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_ipc.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_mcbsp.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_memconfig.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_nmiintrupt.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_output_xbar.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_piectrl.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_pievect.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_sci.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_sdfm.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_spi.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_sysctrl.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_upp.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_xbar.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_headers/include/F2837xD_xint.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Examples.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_GlobalPrototypes.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_cputimervars.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Cla_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_EPwm_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Adc_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Emif_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Gpio_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_I2c_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Ipc_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Pie_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Dma_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_SysCtrl_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_Upp_defines.h: C:/Users/dagaro/workspace/Firmware_Test/UFCharger/F2837xD/F2837xD_common/include/F2837xD_defaultisr.h:
D
module EncoShared.Network.ArrayPackets; import std.bitmanip; import EncoShared; /// Length prefixed array packet template with constant length and length >= 2 elements with maximum length ushort.max mixin template CommonArrayPacket(ElemType, ushort defaultPacketId) { static assert(ElemType.sizeof >= 2, "ElemType.sizeof < 2. Consider using StringPacket or (U)ByteArrayPacket instead"); private: ElemType[] m_content; public: alias m_content this; this(ElemType[] content = []) { m_content = content; } @property ushort id() { return PACKET_ID; } @property ref ElemType[] content() { return m_content; } ubyte[] serialize() { ubyte[] data = nativeToBigEndian(cast(ushort) (m_content.length * ElemType.sizeof)); foreach (ref ElemType child; m_content) data ~= nativeToBigEndian(child); return data; } void deserialize(ref ubyte[] stream) { ushort length = stream.read!ushort (); m_content.length = length / ElemType.sizeof; for (ushort i = 0; i < length; i++) m_content[i] = stream.read!ElemType (); stream = stream[length .. $]; } static ushort PACKET_ID = defaultPacketId; } /// Length prefixed ushort[] packet with maximum length of ushort.max with default id 65401 class UShortArrayPacket : IPacket { mixin CommonArrayPacket!(ushort, 65401); } /// Length prefixed short[] packet with maximum length of ushort.max with default id 65402 class ShortArrayPacket : IPacket { mixin CommonArrayPacket!(short, 65402); } /// Length prefixed uint[] packet with maximum length of ushort.max with default id 65403 class UIntArrayPacket : IPacket { mixin CommonArrayPacket!(uint, 65403); } /// Length prefixed int[] packet with maximum length of ushort.max with default id 65404 class IntArrayPacket : IPacket { mixin CommonArrayPacket!(int, 65404); } /// Length prefixed ulong[] packet with maximum length of ushort.max with default id 65405 class ULongArrayPacket : IPacket { mixin CommonArrayPacket!(ulong, 65405); } /// Length prefixed long[] packet with maximum length of ushort.max with default id 65406 class LongArrayPacket : IPacket { mixin CommonArrayPacket!(long, 65406); } /// Length prefixed float[] packet with maximum length of ushort.max with default id 65407 class FloatArrayPacket : IPacket { mixin CommonArrayPacket!(float, 65407); } /// Length prefixed double[] packet with maximum length of ushort.max with default id 65408 class DoubleArrayPacket : IPacket { mixin CommonArrayPacket!(double, 65408); }
D
module dwig.nodes.text; import dwig.node; class TextNode : BaseNode { this(string data,size_t lineno) { super(null, ["data" : data], lineno); } }
D
// Written in the D programming language. /** This module contains common Plaform definitions. Platform is abstraction layer for application. Synopsis: ---- import dlangui.platforms.common.platform; ---- Copyright: Vadim Lopatin, 2014 License: Boost License 1.0 Authors: Vadim Lopatin, coolreader.org@gmail.com */ module dlangui.platforms.common.platform; public import dlangui.core.config; public import dlangui.core.events; import dlangui.core.collections; import dlangui.widgets.widget; import dlangui.widgets.popup; import dlangui.graphics.drawbuf; import dlangui.core.stdaction; import dlangui.core.asyncsocket; static if (ENABLE_OPENGL) { private import dlangui.graphics.gldrawbuf; } private import std.algorithm; private import core.sync.mutex; private import std.string; /// entry point - declare such function to use as main for dlangui app extern(C) int UIAppMain(string[] args); // specify debug=DebugMouseEvents for logging mouse handling // specify debug=DebugRedraw for logging drawing and layouts handling // specify debug=DebugKeys for logging of key events /// window creation flags enum WindowFlag : uint { /// window can be resized Resizable = 1, /// window should be shown in fullscreen mode Fullscreen = 2, /// modal window - grabs input focus Modal = 4, } /// Window states enum WindowState : int { /// state is unknown (not supported by platform?), as well for using in setWindowState when only want to activate window or change its size/position unspecified, /// normal state normal, /// window is maximized maximized, /// window is maximized minimized, /// fullscreen mode (supported not on all platforms) fullscreen, /// application is paused (e.g. on Android) paused, /// window is hidden hidden, /// closed closed, } /// Window state signal listener interface OnWindowStateHandler { /// signal listener - called when state of window is changed bool onWindowStateChange(Window window, WindowState winState, Rect rect); } /// protected event list /// references to posted messages can be stored here at least to keep live reference and avoid GC /// as well, on some platforms it's easy to send id to message queue, but not pointer class EventList { protected Mutex _mutex; protected Collection!CustomEvent _events; this() { _mutex = new Mutex(); } ~this() { destroy(_mutex); _mutex = null; } /// puts event into queue, returns event's unique id long put(CustomEvent event) { _mutex.lock(); scope(exit) _mutex.unlock(); _events.pushBack(event); return event.uniqueId; } /// return next event CustomEvent get() { _mutex.lock(); scope(exit) _mutex.unlock(); return _events.popFront(); } /// return event by unique id CustomEvent get(uint uniqueId) { _mutex.lock(); scope(exit) _mutex.unlock(); for (int i = 0; i < _events.length; i++) { if (_events[i].uniqueId == uniqueId) { return _events.remove(i); } } // not found return null; } } class TimerInfo { static __gshared ulong nextId; this(Widget targetWidget, long intervalMillis) { _id = ++nextId; assert(intervalMillis >= 0 && intervalMillis < 7*24*60*60*1000L); _targetWidget = targetWidget; _interval = intervalMillis; _nextTimestamp = currentTimeMillis + _interval; } /// cancel timer void cancel() { _targetWidget = null; } /// cancel timer void notify() { if (_targetWidget) { _nextTimestamp = currentTimeMillis + _interval; if (!_targetWidget.onTimer(_id)) { _targetWidget = null; } } } /// unique Id of timer @property ulong id() { return _id; } /// timer interval, milliseconds @property long interval() { return _interval; } /// next timestamp to invoke timer at, as per currentTimeMillis() @property long nextTimestamp() { return _nextTimestamp; } /// widget to route timer event to @property Widget targetWidget() { return _targetWidget; } /// return true if timer is not yet cancelled @property bool valid() { return _targetWidget !is null; } protected ulong _id; protected long _interval; protected long _nextTimestamp; protected Widget _targetWidget; override bool opEquals(Object obj) const { TimerInfo b = cast(TimerInfo)obj; if (!b) return false; return b._nextTimestamp == _nextTimestamp; } override int opCmp(Object obj) { TimerInfo b = cast(TimerInfo)obj; if (!b) return false; if (valid && !b.valid) return -1; if (!valid && b.valid) return 1; if (!valid && !b.valid) return 0; if (_nextTimestamp < b._nextTimestamp) return -1; if (_nextTimestamp > b._nextTimestamp) return 1; return 0; } } /** * Window abstraction layer. Widgets can be shown only inside window. * */ class Window : CustomEventTarget { protected int _dx; protected int _dy; protected uint _keyboardModifiers; protected uint _backgroundColor; protected Widget _mainWidget; protected EventList _eventList; protected uint _flags; @property uint flags() { return _flags; } @property uint backgroundColor() const { return _backgroundColor; } @property void backgroundColor(uint color) { _backgroundColor = color; } @property int width() const { return _dx; } @property int height() const { return _dy; } @property uint keyboardModifiers() const { return _keyboardModifiers; } @property Widget mainWidget() { return _mainWidget; } @property void mainWidget(Widget widget) { if (_mainWidget !is null) { _mainWidget.window = null; destroy(_mainWidget); } _mainWidget = widget; if (_mainWidget !is null) _mainWidget.window = this; } protected Rect _caretRect; @property void caretRect(Rect rc) { _caretRect = rc; } @property Rect caretRect() { return _caretRect; } // Abstract methods : override in platform implementatino /// show window abstract void show(); /// returns window caption abstract @property dstring windowCaption(); /// sets window caption abstract @property void windowCaption(dstring caption); /// sets window icon abstract @property void windowIcon(DrawBufRef icon); /// request window redraw abstract void invalidate(); /// close window abstract void close(); protected WindowState _windowState = WindowState.normal; /// returns current window state @property WindowState windowState() { return _windowState; } protected Rect _windowRect = RECT_VALUE_IS_NOT_SET; /// returns window rectangle on screen (includes window frame and title) @property Rect windowRect() { if (_windowRect != RECT_VALUE_IS_NOT_SET) return _windowRect; // fake window rectangle -- at position 0,0 and return Rect(0, 0, _dx, _dy); } /// window state change signal Signal!OnWindowStateHandler windowStateChanged; /// update and signal window state and/or size/positon changes - for using in platform inplementations protected void handleWindowStateChange(WindowState newState, Rect newWindowRect = RECT_VALUE_IS_NOT_SET) { if (newState != WindowState.unspecified) _windowState = newState; if (newWindowRect != RECT_VALUE_IS_NOT_SET) _windowRect = newWindowRect; if (windowStateChanged.assigned) windowStateChanged(this, newState, newWindowRect); } /// change window state, position, or size; returns true if successful, false if not supported by platform bool setWindowState(WindowState newState, bool activate = false, Rect newWindowRect = RECT_VALUE_IS_NOT_SET) { // override for particular platforms return false; } /// maximize window bool maximizeWindow(bool activate = false) { return setWindowState(WindowState.maximized, activate); } /// minimize window bool minimizeWindow() { return setWindowState(WindowState.minimized); } /// restore window if maximized/minimized/hidden bool restoreWindow(bool activate = false) { return setWindowState(WindowState.normal, activate); } /// restore window if maximized/minimized/hidden bool hideWindow() { return setWindowState(WindowState.hidden); } /// just activate window bool activateWindow() { return setWindowState(WindowState.unspecified, true); } /// change window position only bool moveWindow(Point topLeft, bool activate = false) { return setWindowState(WindowState.unspecified, activate, Rect(topLeft.x, topLeft.y, int.min, int.min)); } /// change window size only bool resizeWindow(Point sz, bool activate = false) { return setWindowState(WindowState.unspecified, activate, Rect(int.min, int.min, sz.x, sz.y)); } /// set window rectangle bool moveAndResizeWindow(Rect rc, bool activate = false) { return setWindowState(WindowState.unspecified, activate, rc); } /// requests layout for main widget and popups void requestLayout() { if (_mainWidget) _mainWidget.requestLayout(); foreach(p; _popups) p.requestLayout(); if (_tooltip.popup) _tooltip.popup.requestLayout(); } void measure() { if (_mainWidget !is null) { _mainWidget.measure(_dx, _dy); } foreach(p; _popups) p.measure(_dx, _dy); if (_tooltip.popup) _tooltip.popup.measure(_dx, _dy); } void layout() { Rect rc = Rect(0, 0, _dx, _dy); if (_mainWidget !is null) { _mainWidget.layout(rc); } foreach(p; _popups) p.layout(rc); if (_tooltip.popup) _tooltip.popup.layout(rc); } void onResize(int width, int height) { if (_dx == width && _dy == height) return; _dx = width; _dy = height; if (_mainWidget !is null) { Log.d("onResize ", _dx, "x", _dy); long measureStart = currentTimeMillis; measure(); //Log.d("measured size: ", _mainWidget.measuredWidth, "x", _mainWidget.measuredHeight); long measureEnd = currentTimeMillis; debug Log.d("resize: measure took ", measureEnd - measureStart, " ms"); layout(); long layoutEnd = currentTimeMillis; debug Log.d("resize: layout took ", layoutEnd - measureEnd, " ms"); //Log.d("layout position: ", _mainWidget.pos); } update(true); } protected PopupWidget[] _popups; protected static struct TooltipInfo { PopupWidget popup; ulong timerId; Widget ownerWidget; uint alignment; int x; int y; } protected TooltipInfo _tooltip; /// schedule tooltip for widget be shown with specified delay void scheduleTooltip(Widget ownerWidget, long delay, uint alignment = PopupAlign.Below, int x = 0, int y = 0) { _tooltip.alignment = alignment; _tooltip.x = x; _tooltip.y = y; _tooltip.ownerWidget = ownerWidget; _tooltip.timerId = setTimer(ownerWidget, delay); } /// call when tooltip timer is expired private bool onTooltipTimer() { _tooltip.timerId = 0; if (isChild(_tooltip.ownerWidget)) { Widget w = _tooltip.ownerWidget.createTooltip(_lastMouseX, _lastMouseY, _tooltip.alignment, _tooltip.x, _tooltip.y); if (w) showTooltip(w, _tooltip.ownerWidget, _tooltip.alignment, _tooltip.x, _tooltip.y); } return false; } /// called when user dragged file(s) to application window void handleDroppedFiles(string[] filenames) { //Log.d("handleDroppedFiles(", filenames, ")"); if (_onFilesDropped) _onFilesDropped(filenames); } protected void delegate(string[]) _onFilesDropped; /// get handler for files dropped to app window @property void delegate(string[]) onFilesDropped() { return _onFilesDropped; } /// set handler for files dropped to app window @property Window onFilesDropped(void delegate(string[]) handler) { _onFilesDropped = handler; return this; } protected bool delegate() _onCanClose; /// get handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later) @property bool delegate() onCanClose() { return _onCanClose; } /// set handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later) @property Window onCanClose(bool delegate() handler) { _onCanClose = handler; return this; } protected void delegate() _onClose; /// get handler for closing of window @property void delegate() onClose() { return _onClose; } /// set handler for closing of window @property Window onClose(void delegate() handler) { _onClose = handler; return this; } /// returns true if there is some modal window opened above this window, and this window should not process mouse/key input and should not allow closing bool hasModalWindowsAbove() { return platform.hasModalWindowsAbove(this); } /// calls onCanClose handler if set to check if system may close window bool handleCanClose() { if (hasModalWindowsAbove()) return false; if (!_onCanClose) return true; bool res = _onCanClose(); if (!res) update(true); // redraw window if it was decided to not close immediately return res; } /// hide tooltip if shown and cancel tooltip timer if set void hideTooltip() { if (_tooltip.popup) { destroy(_tooltip.popup); _tooltip.popup = null; if (_mainWidget) _mainWidget.invalidate(); } if (_tooltip.timerId) cancelTimer(_tooltip.timerId); } /// show tooltip immediately PopupWidget showTooltip(Widget content, Widget anchor = null, uint alignment = PopupAlign.Center, int x = 0, int y = 0) { hideTooltip(); if (!content) return null; PopupWidget res = new PopupWidget(content, this); res.anchor.widget = anchor !is null ? anchor : _mainWidget; res.anchor.alignment = alignment; res.anchor.x = x; res.anchor.y = y; _tooltip.popup = res; return res; } /// show new popup PopupWidget showPopup(Widget content, Widget anchor = null, uint alignment = PopupAlign.Center, int x = 0, int y = 0) { PopupWidget res = new PopupWidget(content, this); res.anchor.widget = anchor !is null ? anchor : _mainWidget; res.anchor.alignment = alignment; res.anchor.x = x; res.anchor.y = y; _popups ~= res; if (_mainWidget !is null) { _mainWidget.requestLayout(); } return res; } /// remove popup bool removePopup(PopupWidget popup) { if (!popup) return false; for (int i = 0; i < _popups.length; i++) { PopupWidget p = _popups[i]; if (p is popup) { for (int j = i; j < _popups.length - 1; j++) _popups[j] = _popups[j + 1]; _popups.length--; p.onClose(); destroy(p); // force redraw _mainWidget.invalidate(); return true; } } return false; } /// returns last modal popup widget, or null if no modal popups opened PopupWidget modalPopup() { for (int i = cast(int)_popups.length - 1; i >= 0; i--) { if (_popups[i].flags & PopupFlags.Modal) return _popups[i]; } return null; } /// returns true if widget is child of either main widget or one of popups bool isChild(Widget w) { if (_mainWidget !is null && _mainWidget.isChild(w)) return true; foreach(p; _popups) if (p.isChild(w)) return true; if (_tooltip.popup) if (_tooltip.popup.isChild(w)) return true; return false; } private long lastDrawTs; this() { _eventList = new EventList(); _timerQueue = new TimerQueue(); _backgroundColor = 0xFFFFFF; if (currentTheme) _backgroundColor = currentTheme.customColor(STYLE_COLOR_WINDOW_BACKGROUND); } ~this() { debug Log.d("Destroying window"); if (_onClose) _onClose(); if (_tooltip.popup) { destroy(_tooltip.popup); _tooltip.popup = null; } foreach(p; _popups) destroy(p); _popups = null; if (_mainWidget !is null) { destroy(_mainWidget); _mainWidget = null; } destroy(_eventList); destroy(_timerQueue); _eventList = null; } private void animate(Widget root, long interval) { if (root is null) return; if (root.visibility != Visibility.Visible) return; for (int i = 0; i < root.childCount; i++) animate(root.child(i), interval); if (root.animating) root.animate(interval); } private void animate(long interval) { animate(_mainWidget, interval); foreach(p; _popups) p.animate(interval); if (_tooltip.popup) _tooltip.popup.animate(interval); } static immutable int PERFORMANCE_LOGGING_THRESHOLD_MS = 20; /// set when first draw is called: don't handle mouse/key input until draw (layout) is called protected bool _firstDrawCalled = false; void onDraw(DrawBuf buf) { _firstDrawCalled = true; static import std.datetime; try { bool needDraw = false; bool needLayout = false; bool animationActive = false; checkUpdateNeeded(needDraw, needLayout, animationActive); if (needLayout || animationActive) needDraw = true; long ts = std.datetime.Clock.currStdTime; if (animationActive && lastDrawTs != 0) { animate(ts - lastDrawTs); // layout required flag could be changed during animate - check again checkUpdateNeeded(needDraw, needLayout, animationActive); } lastDrawTs = ts; if (needLayout) { long measureStart = currentTimeMillis; measure(); long measureEnd = currentTimeMillis; if (measureEnd - measureStart > PERFORMANCE_LOGGING_THRESHOLD_MS) { debug(DebugRedraw) Log.d("measure took ", measureEnd - measureStart, " ms"); } layout(); long layoutEnd = currentTimeMillis; if (layoutEnd - measureEnd > PERFORMANCE_LOGGING_THRESHOLD_MS) { debug(DebugRedraw) Log.d("layout took ", layoutEnd - measureEnd, " ms"); } //checkUpdateNeeded(needDraw, needLayout, animationActive); } long drawStart = currentTimeMillis; // draw main widget _mainWidget.onDraw(buf); PopupWidget modal = modalPopup(); // draw popups foreach(p; _popups) { if (p is modal) { // TODO: get shadow color from theme buf.fillRect(Rect(0, 0, buf.width, buf.height), 0xD0404040); } p.onDraw(buf); } if (_tooltip.popup) _tooltip.popup.onDraw(buf); long drawEnd = currentTimeMillis; debug(DebugRedraw) { if (drawEnd - drawStart > PERFORMANCE_LOGGING_THRESHOLD_MS) Log.d("draw took ", drawEnd - drawStart, " ms"); } if (animationActive) scheduleAnimation(); _actionsUpdateRequested = false; } catch (Exception e) { Log.e("Exception inside winfow.onDraw: ", e); } } /// after drawing, call to schedule redraw if animation is active void scheduleAnimation() { // override if necessary } protected void setCaptureWidget(Widget w, MouseEvent event) { _mouseCaptureWidget = w; _mouseCaptureButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton); } protected Widget _focusedWidget; /// returns current focused widget @property Widget focusedWidget() { if (!isChild(_focusedWidget)) _focusedWidget = null; return _focusedWidget; } /// change focus to widget Widget setFocus(Widget newFocus, FocusReason reason = FocusReason.Unspecified) { if (!isChild(_focusedWidget)) _focusedWidget = null; Widget oldFocus = _focusedWidget; auto targetState = State.Focused; if(reason == FocusReason.TabFocus) targetState = State.Focused | State.KeyboardFocused; if (oldFocus is newFocus) return oldFocus; if (oldFocus !is null) { oldFocus.resetState(targetState); if (oldFocus) oldFocus.focusGroupFocused(false); } if (newFocus is null || isChild(newFocus)) { if (newFocus !is null) { // when calling, setState(focused), window.focusedWidget is still previously focused widget debug(DebugFocus) Log.d("new focus: ", newFocus.id); newFocus.setState(targetState); } _focusedWidget = newFocus; if (_focusedWidget) _focusedWidget.focusGroupFocused(true); // after focus change, ask for actions update automatically //requestActionsUpdate(); } return _focusedWidget; } /// dispatch key event to widgets which have wantsKeyTracking == true protected bool dispatchKeyEvent(Widget root, KeyEvent event) { if (root.visibility != Visibility.Visible) return false; if (root.wantsKeyTracking) { if (root.onKeyEvent(event)) return true; } for (int i = 0; i < root.childCount; i++) { Widget w = root.child(i); if (dispatchKeyEvent(w, event)) return true; } return false; } /// dispatch keyboard event bool dispatchKeyEvent(KeyEvent event) { if (hasModalWindowsAbove() || !_firstDrawCalled) return false; bool res = false; hideTooltip(); PopupWidget modal = modalPopup(); if (event.action == KeyAction.KeyDown || event.action == KeyAction.KeyUp) { _keyboardModifiers = event.flags; if (event.keyCode == KeyCode.ALT || event.keyCode == KeyCode.LALT || event.keyCode == KeyCode.RALT) { debug(DebugKeys) Log.d("ALT key: keyboardModifiers = ", _keyboardModifiers); if (_mainWidget) { _mainWidget.invalidate(); res = true; } } } if (event.action == KeyAction.Text) { // filter text if (event.text.length < 1) return res; dchar ch = event.text[0]; if (ch < ' ' || ch == 0x7F) // filter out control symbols return res; } Widget focus = focusedWidget; if (!modal || modal.isChild(focus)) { while (focus) { if (focus.onKeyEvent(event)) return true; // processed by focused widget if (focus.focusGroup) break; focus = focus.parent; } } if (modal) { if (dispatchKeyEvent(modal, event)) return res; return modal.onKeyEvent(event) || res; } else if (_mainWidget) { if (dispatchKeyEvent(_mainWidget, event)) return res; return _mainWidget.onKeyEvent(event) || res; } return res; } protected bool dispatchMouseEvent(Widget root, MouseEvent event, ref bool cursorIsSet) { // only route mouse events to visible widgets if (root.visibility != Visibility.Visible) return false; if (!root.isPointInside(event.x, event.y)) return false; // offer event to children first for (int i = 0; i < root.childCount; i++) { Widget child = root.child(i); if (dispatchMouseEvent(child, event, cursorIsSet)) return true; } if (event.action == MouseAction.Move && !cursorIsSet) { uint cursorType = root.getCursorType(event.x, event.y); if (cursorType != CursorType.Parent) { setCursorType(cursorType); cursorIsSet = true; } } // if not processed by children, offer event to root if (sendAndCheckOverride(root, event)) { debug(DebugMouseEvents) Log.d("MouseEvent is processed"); if (event.action == MouseAction.ButtonDown && _mouseCaptureWidget is null && !event.doNotTrackButtonDown) { debug(DebugMouseEvents) Log.d("Setting active widget"); setCaptureWidget(root, event); } else if (event.action == MouseAction.Move) { addTracking(root); } return true; } return false; } /// widget which tracks Move events //protected Widget _mouseTrackingWidget; protected Widget[] _mouseTrackingWidgets; private void addTracking(Widget w) { for(int i = 0; i < _mouseTrackingWidgets.length; i++) if (w is _mouseTrackingWidgets[i]) return; //foreach(widget; _mouseTrackingWidgets) // if (widget is w) // return; //Log.d("addTracking ", w.id, " items before: ", _mouseTrackingWidgets.length); _mouseTrackingWidgets ~= w; //Log.d("addTracking ", w.id, " items after: ", _mouseTrackingWidgets.length); } private bool checkRemoveTracking(MouseEvent event) { bool res = false; for(int i = cast(int)_mouseTrackingWidgets.length - 1; i >=0; i--) { Widget w = _mouseTrackingWidgets[i]; if (!isChild(w)) { // std.algorithm.remove does not work for me //_mouseTrackingWidgets.remove(i); for (int j = i; j < _mouseTrackingWidgets.length - 1; j++) _mouseTrackingWidgets[j] = _mouseTrackingWidgets[j + 1]; _mouseTrackingWidgets.length--; continue; } if (event.action == MouseAction.Leave || !w.isPointInside(event.x, event.y)) { // send Leave message MouseEvent leaveEvent = new MouseEvent(event); leaveEvent.changeAction(MouseAction.Leave); res = w.onMouseEvent(leaveEvent) || res; // std.algorithm.remove does not work for me //Log.d("removeTracking ", w.id, " items before: ", _mouseTrackingWidgets.length); //_mouseTrackingWidgets.remove(i); //_mouseTrackingWidgets.length--; for (int j = i; j < _mouseTrackingWidgets.length - 1; j++) _mouseTrackingWidgets[j] = _mouseTrackingWidgets[j + 1]; _mouseTrackingWidgets.length--; //Log.d("removeTracking ", w.id, " items after: ", _mouseTrackingWidgets.length); } } return res; } /// widget which tracks all events after processed ButtonDown protected Widget _mouseCaptureWidget; protected ushort _mouseCaptureButtons; protected bool _mouseCaptureFocusedOut; /// does current capture widget want to receive move events even if pointer left it protected bool _mouseCaptureFocusedOutTrackMovements; protected void clearMouseCapture() { _mouseCaptureWidget = null; _mouseCaptureFocusedOut = false; _mouseCaptureFocusedOutTrackMovements = false; _mouseCaptureButtons = 0; } protected bool dispatchCancel(MouseEvent event) { event.changeAction(MouseAction.Cancel); bool res = _mouseCaptureWidget.onMouseEvent(event); clearMouseCapture(); return res; } protected bool sendAndCheckOverride(Widget widget, MouseEvent event) { if (!isChild(widget)) return false; bool res = widget.onMouseEvent(event); if (event.trackingWidget !is null && _mouseCaptureWidget !is event.trackingWidget) { setCaptureWidget(event.trackingWidget, event); } return res; } /// returns true if mouse is currently captured bool isMouseCaptured() { return (_mouseCaptureWidget !is null && isChild(_mouseCaptureWidget)); } /// dispatch action to main widget bool dispatchAction(const Action action, Widget sourceWidget = null) { // try to handle by source widget if(sourceWidget && isChild(sourceWidget)) { if (sourceWidget.handleAction(action)) return true; sourceWidget = sourceWidget.parent; } Widget focus = focusedWidget; // then offer action to focused widget if (focus && isChild(focus)) { if (focus.handleAction(action)) return true; focus = focus.parent; } // then offer to parent chain of source widget while (sourceWidget && isChild(sourceWidget)) { if (sourceWidget.handleAction(action)) return true; sourceWidget = sourceWidget.parent; } // then offer to parent chain of focused widget while (focus && isChild(focus)) { if (focus.handleAction(action)) return true; focus = focus.parent; } if (_mainWidget) return _mainWidget.handleAction(action); return false; } /// dispatch action to main widget bool dispatchActionStateRequest(const Action action, Widget sourceWidget = null) { // try to handle by source widget if(sourceWidget && isChild(sourceWidget)) { if (sourceWidget.handleActionStateRequest(action)) return true; sourceWidget = sourceWidget.parent; } Widget focus = focusedWidget; // then offer action to focused widget if (focus && isChild(focus)) { if (focus.handleActionStateRequest(action)) return true; focus = focus.parent; } // then offer to parent chain of source widget while (sourceWidget && isChild(sourceWidget)) { if (sourceWidget.handleActionStateRequest(action)) return true; sourceWidget = sourceWidget.parent; } // then offer to parent chain of focused widget while (focus && isChild(focus)) { if (focus.handleActionStateRequest(action)) return true; focus = focus.parent; } if (_mainWidget) return _mainWidget.handleActionStateRequest(action); return false; } /// handle theme change: e.g. reload some themed resources void dispatchThemeChanged() { if (_mainWidget) _mainWidget.onThemeChanged(); // draw popups foreach(p; _popups) { p.onThemeChanged(); } if (_tooltip.popup) _tooltip.popup.onThemeChanged(); if (currentTheme) { _backgroundColor = currentTheme.customColor(STYLE_COLOR_WINDOW_BACKGROUND); } invalidate(); } /// post event to handle in UI thread (this method can be used from background thread) void postEvent(CustomEvent event) { // override to post event into window message queue _eventList.put(event); } /// post task to execute in UI thread (this method can be used from background thread) void executeInUiThread(void delegate() runnable) { RunnableEvent event = new RunnableEvent(CUSTOM_RUNNABLE, null, runnable); postEvent(event); } /// Creates async socket AsyncSocket createAsyncSocket(AsyncSocketCallback callback) { AsyncClientConnection conn = new AsyncClientConnection(new AsyncSocketCallbackProxy(callback, &executeInUiThread)); return conn; } /// remove event from queue by unique id if not yet dispatched (this method can be used from background thread) void cancelEvent(uint uniqueId) { CustomEvent ev = _eventList.get(uniqueId); if (ev) { //destroy(ev); } } /// remove event from queue by unique id if not yet dispatched and dispatch it void handlePostedEvent(uint uniqueId) { CustomEvent ev = _eventList.get(uniqueId); if (ev) { dispatchCustomEvent(ev); } } /// handle all events from queue, if any (call from UI thread only) void handlePostedEvents() { for(;;) { CustomEvent e = _eventList.get(); if (!e) break; dispatchCustomEvent(e); } } /// dispatch custom event bool dispatchCustomEvent(CustomEvent event) { if (event.destinationWidget) { if (!isChild(event.destinationWidget)) { //Event is sent to widget which does not exist anymore return false; } return event.destinationWidget.onEvent(event); } else { // no destination widget RunnableEvent runnable = cast(RunnableEvent)event; if (runnable) { // handle runnable runnable.run(); return true; } } return false; } private int _lastMouseX; private int _lastMouseY; /// dispatch mouse event to window content widgets bool dispatchMouseEvent(MouseEvent event) { if (hasModalWindowsAbove() || !_firstDrawCalled) return false; // ignore events if there is no root if (_mainWidget is null) return false; bool actualChange = true; if (event.action == MouseAction.Move) { actualChange = (_lastMouseX != event.x || _lastMouseY != event.y); _lastMouseX = event.x; _lastMouseY = event.y; } if (actualChange) hideTooltip(); PopupWidget modal = modalPopup(); // check if _mouseCaptureWidget and _mouseTrackingWidget still exist in child of root widget if (_mouseCaptureWidget !is null && (!isChild(_mouseCaptureWidget) || (modal && !modal.isChild(_mouseCaptureWidget)))) { clearMouseCapture(); } debug(DebugMouseEvents) Log.d("dispatchMouseEvent ", event.action, " (", event.x, ",", event.y, ")"); bool res = false; ushort currentButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton); if (_mouseCaptureWidget !is null) { // try to forward message directly to active widget if (event.action == MouseAction.Move) { debug(DebugMouseEvents) Log.d("dispatchMouseEvent: Move; buttons state=", currentButtons); if (!_mouseCaptureWidget.isPointInside(event.x, event.y)) { if (currentButtons != _mouseCaptureButtons) { debug(DebugMouseEvents) Log.d("dispatchMouseEvent: Move; buttons state changed from ", _mouseCaptureButtons, " to ", currentButtons, " - cancelling capture"); return dispatchCancel(event); } // point is no more inside of captured widget if (!_mouseCaptureFocusedOut) { // sending FocusOut message event.changeAction(MouseAction.FocusOut); _mouseCaptureFocusedOut = true; _mouseCaptureButtons = currentButtons; _mouseCaptureFocusedOutTrackMovements = sendAndCheckOverride(_mouseCaptureWidget, event); return true; } else if (_mouseCaptureFocusedOutTrackMovements) { // pointer is outside, but we still need to track pointer return sendAndCheckOverride(_mouseCaptureWidget, event); } // don't forward message return true; } else { // point is inside widget if (_mouseCaptureFocusedOut) { _mouseCaptureFocusedOut = false; if (currentButtons != _mouseCaptureButtons) return dispatchCancel(event); event.changeAction(MouseAction.FocusIn); // back in after focus out } return sendAndCheckOverride(_mouseCaptureWidget, event); } } else if (event.action == MouseAction.Leave) { if (!_mouseCaptureFocusedOut) { // sending FocusOut message event.changeAction(MouseAction.FocusOut); _mouseCaptureFocusedOut = true; _mouseCaptureButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton); return sendAndCheckOverride(_mouseCaptureWidget, event); } else { debug(DebugMouseEvents) Log.d("dispatchMouseEvent: mouseCaptureFocusedOut + Leave - cancelling capture"); return dispatchCancel(event); } } else if (event.action == MouseAction.ButtonDown || event.action == MouseAction.ButtonUp) { if (!_mouseCaptureWidget.isPointInside(event.x, event.y)) { if (currentButtons != _mouseCaptureButtons) { debug(DebugMouseEvents) Log.d("dispatchMouseEvent: ButtonUp/ButtonDown; buttons state changed from ", _mouseCaptureButtons, " to ", currentButtons, " - cancelling capture"); return dispatchCancel(event); } } } // other messages res = sendAndCheckOverride(_mouseCaptureWidget, event); if (!currentButtons) { // usable capturing - no more buttons pressed debug(DebugMouseEvents) Log.d("unsetting active widget"); clearMouseCapture(); } return res; } bool processed = false; if (event.action == MouseAction.Move || event.action == MouseAction.Leave) { processed = checkRemoveTracking(event); } bool cursorIsSet = false; if (!res) { bool insideOneOfPopups = false; for (int i = cast(int)_popups.length - 1; i >= 0; i--) { auto p = _popups[i]; if (p.isPointInside(event.x, event.y)) { if (p !is modal) insideOneOfPopups = true; } if (p is modal) break; } for (int i = cast(int)_popups.length - 1; i >= 0; i--) { auto p = _popups[i]; if (p is modal) break; if (!insideOneOfPopups) { if (p.onMouseEventOutside(event)) // stop loop when true is returned, but allow other main widget to handle event break; } else { if (dispatchMouseEvent(p, event, cursorIsSet)) return true; } } if (!modal) res = dispatchMouseEvent(_mainWidget, event, cursorIsSet); else res = dispatchMouseEvent(modal, event, cursorIsSet); } return res || processed || _mainWidget.needDraw; } /// calls update actions recursively protected void dispatchWidgetUpdateActionStateRecursive(Widget root) { if (root is null) return; root.updateActionState(true); for (int i = 0; i < root.childCount; i++) dispatchWidgetUpdateActionStateRecursive(root.child(i)); } /// checks content widgets for necessary redraw and/or layout protected void checkUpdateNeeded(Widget root, ref bool needDraw, ref bool needLayout, ref bool animationActive) { if (root is null) return; if (root.visibility != Visibility.Visible) return; needDraw = root.needDraw || needDraw; if (!needLayout) { needLayout = root.needLayout || needLayout; if (needLayout) { debug(DebugRedraw) Log.d("need layout: ", root.id); } } if (root.animating && root.visible) animationActive = true; // check animation only for visible widgets for (int i = 0; i < root.childCount; i++) checkUpdateNeeded(root.child(i), needDraw, needLayout, animationActive); } /// sets cursor type for window protected void setCursorType(uint cursorType) { // override to support different mouse cursors } /// update action states protected void dispatchWidgetUpdateActionStateRecursive() { if (_mainWidget !is null) dispatchWidgetUpdateActionStateRecursive(_mainWidget); foreach(p; _popups) dispatchWidgetUpdateActionStateRecursive(p); } /// checks content widgets for necessary redraw and/or layout bool checkUpdateNeeded(ref bool needDraw, ref bool needLayout, ref bool animationActive) { if (_actionsUpdateRequested) { // call update action check - as requested dispatchWidgetUpdateActionStateRecursive(); _actionsUpdateRequested = false; } needDraw = needLayout = animationActive = false; if (_mainWidget is null) return false; checkUpdateNeeded(_mainWidget, needDraw, needLayout, animationActive); foreach(p; _popups) checkUpdateNeeded(p, needDraw, needLayout, animationActive); if (_tooltip.popup) checkUpdateNeeded(_tooltip.popup, needDraw, needLayout, animationActive); return needDraw || needLayout || animationActive; } protected bool _animationActive; @property bool isAnimationActive() { return _animationActive; } /// requests update for window (unless force is true, update will be performed only if layout, redraw or animation is required). void update(bool force = false) { if (_mainWidget is null) return; bool needDraw = false; bool needLayout = false; _animationActive = false; if (checkUpdateNeeded(needDraw, needLayout, _animationActive) || force) { debug(DebugRedraw) Log.d("Requesting update"); invalidate(); } debug(DebugRedraw) Log.d("checkUpdateNeeded returned needDraw=", needDraw, " needLayout=", needLayout, " animationActive=", animationActive); } protected bool _actionsUpdateRequested = true; /// set action update request flag, will be cleared after redraw void requestActionsUpdate(bool immediateUpdate = false) { if (!immediateUpdate) _actionsUpdateRequested = true; else dispatchWidgetUpdateActionStateRecursive(); } @property bool actionsUpdateRequested() { return _actionsUpdateRequested; } /// Show message box with specified title and message (title and message as UIString) void showMessageBox(UIString title, UIString message, const (Action)[] actions = [ACTION_OK], int defaultActionIndex = 0, bool delegate(const Action result) handler = null) { import dlangui.dialogs.msgbox; MessageBox dlg = new MessageBox(title, message, this, actions, defaultActionIndex, handler); dlg.show(); } /// Show message box with specified title and message (title and message as dstring) void showMessageBox(dstring title, dstring message, const (Action)[] actions = [ACTION_OK], int defaultActionIndex = 0, bool delegate(const Action result) handler = null) { showMessageBox(UIString(title), UIString(message), actions, defaultActionIndex, handler); } static if (BACKEND_GUI) { void showInputBox(UIString title, UIString message, dstring initialText, void delegate(dstring result) handler) { import dlangui.dialogs.inputbox; InputBox dlg = new InputBox(title, message, this, initialText, handler); dlg.show(); } } void showInputBox(dstring title, dstring message, dstring initialText, void delegate(dstring result) handler) { showInputBox(UIString(title), UIString(message), initialText, handler); } protected TimerQueue _timerQueue; /// schedule timer for interval in milliseconds - call window.onTimer when finished protected void scheduleSystemTimer(long intervalMillis) { Log.d("override scheduleSystemTimer to support timers"); } /// system timer interval expired - notify queue protected void onTimer() { //Log.d("window.onTimer"); bool res = _timerQueue.notify(); //Log.d("window.onTimer after notify"); if (res) { // check if update needed and redraw if so //Log.d("before update"); update(false); //Log.d("after update"); } //Log.d("schedule next timer"); long nextInterval = _timerQueue.nextIntervalMillis(); if (nextInterval > 0) { scheduleSystemTimer(nextInterval); } //Log.d("schedule next timer done"); } /// set timer for destination widget - destination.onTimer() will be called after interval expiration; returns timer id ulong setTimer(Widget destination, long intervalMillis) { if (!isChild(destination)) { Log.e("setTimer() is called not for child widget of window"); return 0; } ulong res = _timerQueue.add(destination, intervalMillis); long nextInterval = _timerQueue.nextIntervalMillis(); if (nextInterval > 0) { scheduleSystemTimer(intervalMillis); } return res; } /// cancel previously scheduled widget timer (for timerId pass value returned from setTimer) void cancelTimer(ulong timerId) { _timerQueue.cancelTimer(timerId); } /// timers queue private class TimerQueue { protected TimerInfo[] _queue; /// add new timer ulong add(Widget destination, long intervalMillis) { TimerInfo item = new TimerInfo(destination, intervalMillis); _queue ~= item; sort(_queue); return item.id; } /// cancel timer void cancelTimer(ulong timerId) { if (!_queue.length) return; for (int i = cast(int)_queue.length - 1; i >= 0; i--) { if (_queue[i].id == timerId) { _queue[i].cancel(); break; } } } /// returns interval if millis of next scheduled event or -1 if no events queued long nextIntervalMillis() { if (!_queue.length || !_queue[0].valid) return -1; long delta = _queue[0].nextTimestamp - currentTimeMillis; if (delta < 1) delta = 1; return delta; } private void cleanup() { if (!_queue.length) return; sort(_queue); size_t newsize = _queue.length; for (int i = cast(int)_queue.length - 1; i >= 0; i--) { if (!_queue[i].valid) { newsize = i; } } if (_queue.length > newsize) _queue.length = newsize; } private TimerInfo[] expired() { if (!_queue.length) return null; long ts = currentTimeMillis; TimerInfo[] res; for (int i = 0; i < _queue.length; i++) { if (_queue[i].nextTimestamp <= ts) res ~= _queue[i]; } return res; } /// returns true if at least one widget was notified bool notify() { bool res = false; checkValidWidgets(); TimerInfo[] list = expired(); if (list) { for (int i = 0; i < list.length; i++) { if (_queue[i].id == _tooltip.timerId) { // special case for tooltip timer onTooltipTimer(); _queue[i].cancel(); res = true; } else { Widget w = _queue[i].targetWidget; if (w && !isChild(w)) _queue[i].cancel(); else { _queue[i].notify(); res = true; } } } } cleanup(); return res; } private void checkValidWidgets() { for (int i = 0; i < _queue.length; i++) { Widget w = _queue[i].targetWidget; if (w && !isChild(w)) _queue[i].cancel(); } cleanup(); } } } /** * Platform abstraction layer. * * Represents application. * * * */ class Platform { static __gshared Platform _instance; static void setInstance(Platform instance) { if (_instance) destroy(_instance); _instance = instance; } @property static Platform instance() { return _instance; } /** * create window * Args: * windowCaption = window caption text * parent = parent Window, or null if no parent * flags = WindowFlag bit set, combination of Resizable, Modal, Fullscreen * width = window width * height = window height * * Window w/o Resizable nor Fullscreen will be created with size based on measurement of its content widget */ abstract Window createWindow(dstring windowCaption, Window parent, uint flags = WindowFlag.Resizable, uint width = 0, uint height = 0); static if (ENABLE_OPENGL) { /** * OpenGL context major version. * Note: if the version is invalid or not supported, this value will be set to supported one. */ int GLVersionMajor = 3; /** * OpenGL context minor version. * Note: if the version is invalid or not supported, this value will be set to supported one. */ int GLVersionMinor = 2; } /** * close window * * Closes window earlier created with createWindow() */ abstract void closeWindow(Window w); /** * Starts application message loop. * * When returned from this method, application is shutting down. */ abstract int enterMessageLoop(); /// retrieves text from clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux) abstract dstring getClipboardText(bool mouseBuffer = false); /// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux) abstract void setClipboardText(dstring text, bool mouseBuffer = false); /// calls request layout for all windows abstract void requestLayout(); /// returns true if there is some modal window opened above this window, and this window should not process mouse/key input and should not allow closing bool hasModalWindowsAbove(Window w) { // override in platform specific class return false; } protected string _uiLanguage; /// returns currently selected UI language code @property string uiLanguage() { return _uiLanguage; } /// set UI language (e.g. "en", "fr", "ru") - will relayout content of all windows if language has been changed @property Platform uiLanguage(string langCode) { if (_uiLanguage.equal(langCode)) return this; _uiLanguage = langCode; Log.v("Loading language file"); if (langCode.equal("en")) i18n.load("en.ini"); //"ru.ini", "en.ini" else i18n.load(langCode ~ ".ini", "en.ini"); Log.v("Calling onThemeChanged"); onThemeChanged(); requestLayout(); return this; } protected string _themeId; @property string uiTheme() { return _themeId; } /// sets application UI theme - will relayout content of all windows if theme has been changed @property Platform uiTheme(string themeResourceId) { themeResourceId = "console_" ~ themeResourceId; if (_themeId.equal(themeResourceId)) return this; Log.v("uiTheme setting new theme ", themeResourceId); _themeId = themeResourceId; Theme theme = loadTheme(themeResourceId); if (!theme) { Log.e("Cannot load theme from resource ", themeResourceId, " - will use default theme"); theme = createDefaultTheme(); } else { Log.i("Applying loaded theme ", theme.id); } currentTheme = theme; onThemeChanged(); requestLayout(); return this; } /// to set uiLanguage and themeId to default (en, theme_default) if not set yet protected void setDefaultLanguageAndThemeIfNecessary() { if (!_uiLanguage) { Log.v("setDefaultLanguageAndThemeIfNecessary : setting UI language"); uiLanguage = "en"; } if (!_themeId) { Log.v("setDefaultLanguageAndThemeIfNecessary : setting UI theme"); uiTheme = "theme_default"; } } protected string[] _resourceDirs; /// returns list of resource directories @property string[] resourceDirs() { return _resourceDirs; } /// set list of directories to load resources from @property Platform resourceDirs(string[] dirs) { // setup resource directories - will use only existing directories drawableCache.setResourcePaths(dirs); _resourceDirs = drawableCache.resourcePaths; // setup i18n - look for i18n directory inside one of passed directories i18n.findTranslationsDir(dirs); return this; } /// open url in external browser bool openURL(string url) { import std.process; browse(url); return true; } /// show directory or file in OS file manager (explorer, finder, etc...) bool showInFileManager(string pathName) { Log.w("showInFileManager is not implemented for current platform"); return false; } /// handle theme change: e.g. reload some themed resources void onThemeChanged() { // override and call dispatchThemeChange for all windows } } /// get current platform object instance @property Platform platform() { return Platform.instance; } static if (ENABLE_OPENGL) { private __gshared bool _OPENGL_ENABLED = false; /// check if hardware acceleration is enabled @property bool openglEnabled() { return _OPENGL_ENABLED; } /// call on app initialization if OpenGL support is detected void setOpenglEnabled(bool enabled = true) { _OPENGL_ENABLED = enabled; if (enabled) glyphDestroyCallback = &onGlyphDestroyedCallback; else glyphDestroyCallback = null; } } else { @property bool openglEnabled() { return false; } void setOpenglEnabled(bool enabled = true) { // ignore } } static if (BACKEND_CONSOLE) { // to remove import extern(C) int DLANGUImain(string[] args); } else { version (Windows) { // to remove import extern(Windows) int DLANGUIWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int nCmdShow); } else { // to remove import extern(C) int DLANGUImain(string[] args); } } /// put "mixin APP_ENTRY_POINT;" to main module of your dlangui based app mixin template APP_ENTRY_POINT() { static if (BACKEND_CONSOLE) { int main(string[] args) { return DLANGUImain(args); } } else { /// workaround for link issue when WinMain is located in library version(Windows) { extern (Windows) int WinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int nCmdShow) { try { int res = DLANGUIWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); return res; } catch (Exception e) { Log.e("Exception: ", e); return 1; } } } else { version (Android) { } else { int main(string[] args) { return DLANGUImain(args); } } } } } /// initialize font manager on startup extern(C) bool initFontManager(); /// initialize logging (for win32 - to file ui.log, for other platforms - stderr; log level is TRACE for debug builds, and WARN for release builds) extern(C) void initLogs(); /// call this when all resources are supposed to be freed to report counts of non-freed resources by type extern(C) void releaseResourcesOnAppExit(); /// call this on application initialization extern(C) void initResourceManagers(); /// call this from shared static this() extern (C) void initSharedResourceManagers();
D
/Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/Classes/LiquittableCircle.swift.o : /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquittableCircle.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/SimpleCircleLiquidEngine.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidUtil.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidFloatingActionButton.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/UIColorEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGRectEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGPointEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/ArrayEx.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/CoreImage.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/QuartzCore.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/Metal.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/Classes/LiquittableCircle~partial.swiftmodule : /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquittableCircle.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/SimpleCircleLiquidEngine.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidUtil.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidFloatingActionButton.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/UIColorEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGRectEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGPointEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/ArrayEx.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/CoreImage.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/QuartzCore.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/Metal.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/Classes/LiquittableCircle~partial.swiftdoc : /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquittableCircle.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/SimpleCircleLiquidEngine.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidUtil.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidFloatingActionButton.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/UIColorEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGRectEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGPointEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/ArrayEx.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/CoreImage.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/QuartzCore.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/Metal.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/Classes/LiquittableCircle~partial.swiftsourceinfo : /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquittableCircle.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/SimpleCircleLiquidEngine.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidUtil.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/LiquidFloatingActionButton.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/UIColorEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGRectEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/CGPointEx.swift /Users/jaylee/Workspace/LiquidFloatingActionButton/Sources/LiquidFloatingActionButton/Classes/ArrayEx.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/CoreImage.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/QuartzCore.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/Metal.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Users/jaylee/Workspace/LiquidFloatingActionButton/.build/x86_64-apple-macosx/debug/LiquidFloatingActionButton.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/** * Copyright: Enalye * License: Zlib * Authors: Enalye */ module scripthandler; import std.stdio, core.thread; import grimoire; final class ScriptHandler { private final class TimeoutThread: Thread { private { __gshared ScriptHandler _script; } shared bool isRunning = true; shared bool isTimedout; this(ScriptHandler script) { _script = script; super(&run); } void run() { try { const auto startTime = MonoTime.currTime(); while(isRunning) { const auto currentCycle = _script._cycle; sleep(dur!("msecs")(100)); if(currentCycle == _script._cycle && _script._isLoaded) { isTimedout = true; isRunning = false; _script.engine.isRunning = false; } const auto deltaTime = MonoTime.currTime() - startTime; if(deltaTime > dur!"msecs"(1000)) { isTimedout = true; isRunning = false; _script.engine.isRunning = false; } } } catch(Exception e) { writeln("Script timeout error: ", e.msg); } } } private { shared int _cycle; shared bool _isLoaded = false; TimeoutThread _timeout; } GrEngine engine; @property { bool isRunning() { return engine.hasCoroutines && !engine.isPanicking && engine.isRunning; } bool isTimedout() { return _timeout.isTimedout; } } void cleanup() { engine.isRunning = false; _isLoaded = false; if(_timeout) { _timeout.isRunning = false; _timeout = null; } } void load(GrData data, string name) { GrBytecode bytecode; GrCompiler compiler = new GrCompiler(data); if(!compiler.compileFile(bytecode, name)) { return; } engine = new GrEngine; engine.load(data, bytecode); engine.spawn(); _timeout = new TimeoutThread(this); _timeout.start(); } void run() { _isLoaded = true; if(engine.hasCoroutines) engine.process(); _cycle = _cycle + 1; if(!engine.hasCoroutines || engine.isPanicking) _timeout.isRunning = false; } }
D
/Users/yuxiangtang1/Desktop/MineSweeper/build/MineSweeper.build/Debug-iphonesimulator/MineSweeper.build/Objects-normal/x86_64/MSMineData.o : /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/ViewController.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MSCollectionViewCell.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/ArrayExtensions.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/AppDelegate.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MSMineData.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MainViewController.swift /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/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/CoreData.swiftmodule /Users/yuxiangtang1/Desktop/MineSweeper/build/MineSweeper.build/Debug-iphonesimulator/MineSweeper.build/Objects-normal/x86_64/MSMineData~partial.swiftmodule : /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/ViewController.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MSCollectionViewCell.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/ArrayExtensions.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/AppDelegate.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MSMineData.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MainViewController.swift /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/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/CoreData.swiftmodule /Users/yuxiangtang1/Desktop/MineSweeper/build/MineSweeper.build/Debug-iphonesimulator/MineSweeper.build/Objects-normal/x86_64/MSMineData~partial.swiftdoc : /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/ViewController.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MSCollectionViewCell.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/ArrayExtensions.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/AppDelegate.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MSMineData.swift /Users/yuxiangtang1/Desktop/MineSweeper/MineSweeper/MainViewController.swift /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/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/CoreData.swiftmodule
D
a member of the Algonquian people formerly living along the Tennessee river the Algonquian language spoken by the Shawnee
D
instance BAU_961_Gaan (Npc_Default) { // ------ NSC ------ name = "Gaan"; guild = GIL_NONE; id = 961; voice = 3; flags = 0; //NPC_FLAG_IMMORTAL oder 0 npctype = NPCTYPE_MAIN; aivar[AIV_NPCIsRanger] = TRUE; // ------ Attribute ------ B_SetAttributesToChapter (self, 2); //setzt Attribute und LEVEL entsprechend dem angegebenen Kapitel (1-6) // ------ Kampf-Taktik ------ fight_tactic = FAI_HUMAN_STRONG; // MASTER / STRONG / COWARD // ------ Equippte Waffen ------ //Munition wird automatisch generiert, darf aber angegeben werden EquipItem (self, ItMw_1h_Bau_Mace); EquipItem (self, ItRw_Sld_Bow); // ------ Inventory ------ B_CreateAmbientInv (self); // ------ visuals ------ //Muss NACH Attributen kommen, weil in B_SetNpcVisual die Breite abh. v. STR skaliert wird B_SetNpcVisual (self, MALE, "Hum_Head_Bald", Face_N_Normal02, BodyTex_N, ITAR_Bau_L); Mdl_SetModelFatness (self, 1); Mdl_ApplyOverlayMds (self, "Humans_Militia.mds"); // Tired / Militia / Mage / Arrogance / Relaxed // ------ NSC-relevante Talente vergeben ------ B_GiveNpcTalents (self); // ------ Kampf-Talente ------ //Der enthaltene B_AddFightSkill setzt Talent-Ani abhängig von TrefferChance% - alle Kampftalente werden gleichhoch gesetzt B_SetFightSkills (self, 25); //Grenzen für Talent-Level liegen bei 30 und 60 // ------ TA anmelden ------ daily_routine = Rtn_PreStart_961; }; FUNC VOID Rtn_PreStart_961 () { TA_Stand_ArmsCrossed (08,00,22,00,"NW_FARM3_PATH_LEVELCHANGE_02"); TA_Stand_ArmsCrossed (22,00,08,00,"NW_FARM3_PATH_LEVELCHANGE_02"); }; FUNC VOID Rtn_Start_961 () { TA_Stand_ArmsCrossed (08,00,22,00,"NW_FARM3_GAAN"); TA_Stand_ArmsCrossed (22,00,08,00,"NW_FARM3_STABLE_REST_01"); }; FUNC VOID Rtn_PreRangerMeeting_961 () { TA_RangerMeeting (05,00,20,00,"NW_TAVERNE_03"); TA_RangerMeeting (20,00,05,00,"NW_TAVERNE_03"); }; FUNC VOID Rtn_RangerMeeting_961 () { TA_RangerMeeting (05,00,20,00,"NW_TAVERNE_IN_RANGERMEETING"); TA_RangerMeeting (20,00,05,00,"NW_TAVERNE_IN_RANGERMEETING"); }; FUNC VOID Rtn_Parking_961 () { TA_Stand_ArmsCrossed (05,00,20,00,"NW_TAVERNE_IN_RANGERMEETING"); TA_Stand_ArmsCrossed (20,00,05,00,"NW_TAVERNE_IN_RANGERMEETING"); };
D
// This file is just a placeholder, please use the libgit2 package directly instead module git.c.refspec; public import deimos.git2.refspec; pragma(msg, "Deprecated import git.c.refspec used. Please import deimos.git2.refspec instead.");
D
module android.java.android.database.sqlite.SQLiteOutOfMemoryException_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import1 = android.java.java.io.PrintStream_d_interface; import import4 = android.java.java.lang.Class_d_interface; import import3 = android.java.java.lang.StackTraceElement_d_interface; import import2 = android.java.java.io.PrintWriter_d_interface; import import0 = android.java.java.lang.JavaThrowable_d_interface; final class SQLiteOutOfMemoryException : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import this(arsd.jni.Default); @Import this(string); @Import string getMessage(); @Import string getLocalizedMessage(); @Import import0.JavaThrowable getCause(); @Import import0.JavaThrowable initCause(import0.JavaThrowable); @Import @JavaName("toString") string toString_(); override string toString() { return arsd.jni.javaObjectToString(this); } @Import void printStackTrace(); @Import void printStackTrace(import1.PrintStream); @Import void printStackTrace(import2.PrintWriter); @Import import0.JavaThrowable fillInStackTrace(); @Import import3.StackTraceElement[] getStackTrace(); @Import void setStackTrace(import3.StackTraceElement[]); @Import void addSuppressed(import0.JavaThrowable); @Import import0.JavaThrowable[] getSuppressed(); @Import import4.Class getClass(); @Import int hashCode(); @Import bool equals(IJavaObject); @Import void notify(); @Import void notifyAll(); @Import void wait(long); @Import void wait(long, int); @Import void wait(); mixin IJavaObjectImplementation!(false); public static immutable string _javaParameterString = "Landroid/database/sqlite/SQLiteOutOfMemoryException;"; }
D
instance VLK_460_Buerger (Npc_Default) { // ------ NSC ------ name = NAME_BUERGER; guild = GIL_VLK; id = 460; voice = 8; flags = 0; npctype = NPCTYPE_AMBIENT; //-----------AIVARS---------------- aivar[AIV_ToughGuy] = TRUE; // ------ Attribute ------ B_SetAttributesToChapter (self, 2); // ------ Kampf-Taktik ------ fight_tactic = FAI_HUMAN_COWARD; // ------ Equippte Waffen ------ EquipItem (self, ItMw_1h_VLK_DAGGER); // ------ Inventory ------ B_CreateAmbientInv (self); // ------ visuals ------ B_SetNpcVisual (self, MALE, "Hum_Head_FatBald", Face_N_Normal_Olli_Kahn, BodyTex_N,ITAR_Vlk_M); Mdl_SetModelFatness (self,1); Mdl_ApplyOverlayMds (self, "Humans_Arrogance.mds"); // ------ NSC-relevante Talente vergeben ------ B_GiveNpcTalents (self); // ------ Kampf-Talente ------ B_SetFightSkills (self, 40); // ------ TA anmelden ------ daily_routine = Rtn_Start_460; }; FUNC VOID Rtn_Start_460() { TA_Smalltalk (05,35,11,30,"NW_CITY_HABOUR_05"); TA_Stand_Drinking (11,30,13,35,"NW_CITY_HABOUR_03"); TA_Smalltalk (13,35,17,30,"NW_CITY_HABOUR_03"); TA_Stand_Drinking (17,30,23,30,"NW_CITY_HABOUR_TAVERN01_01"); TA_Sleep (23,30,05,35,"NW_CITY_HABOUR_POOR_AREA_HUT_01_BED_02"); };
D
func void ZS_GuardPassage() { PrintDebugNpc(PD_TA_FRAME,"ZS_GuardPassage"); GuardPerception(); Npc_PercEnable(self,PERC_ASSESSPLAYER,B_AssessSC); Npc_PercEnable(self,PERC_ASSESSQUIETSOUND,B_AssessSC); Npc_PercDisable(self,PERC_OBSERVEINTRUDER); AI_Standup(self); AI_SetWalkMode(self,NPC_WALK); AI_GotoWP(self,self.wp); AI_AlignToWP(self); B_InitArmor(); }; func int ZS_GuardPassage_Loop() { PrintDebugNpc(PD_TA_LOOP,"ZS_GuardPassage_Loop"); if(Npc_GetDistToWP(self,self.wp) > 200) { AI_SetWalkMode(self,NPC_RUN); AI_GotoWP(self,self.wp); return LOOP_CONTINUE; } else if(Npc_GetDistToNpc(self,hero) > HAI_DIST_GUARDPASSAGE_ATTENTION) { AI_AlignToWP(self); }; B_PlayArmor(); AI_Wait(self,0.5); return LOOP_CONTINUE; }; func void ZS_GuardPassage_End() { PrintDebugNpc(PD_TA_FRAME,"ZS_GuardPassage_End"); B_ExitArmor(); };
D
# FIXED pwm.obj: C:/ti/motorware/motorware_1_01_00_17/sw/drivers/pwm/src/32b/f28x/f2802x/pwm.c pwm.obj: C:/ti/motorware/motorware_1_01_00_17/sw/drivers/pwm/src/32b/f28x/f2802x/pwm.h pwm.obj: C:/ti/motorware/motorware_1_01_00_17/sw/modules/types/src/types.h pwm.obj: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/stdbool.h pwm.obj: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/string.h pwm.obj: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/linkage.h pwm.obj: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/stdint.h pwm.obj: C:/ti/motorware/motorware_1_01_00_17/sw/drivers/cpu/src/32b/f28x/f2802x/cpu.h C:/ti/motorware/motorware_1_01_00_17/sw/drivers/pwm/src/32b/f28x/f2802x/pwm.c: C:/ti/motorware/motorware_1_01_00_17/sw/drivers/pwm/src/32b/f28x/f2802x/pwm.h: C:/ti/motorware/motorware_1_01_00_17/sw/modules/types/src/types.h: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/stdbool.h: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/string.h: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/linkage.h: C:/ti/ccsv6/tools/compiler/c2000_15.12.3.LTS/include/stdint.h: C:/ti/motorware/motorware_1_01_00_17/sw/drivers/cpu/src/32b/f28x/f2802x/cpu.h:
D
/** * * THIS FILE IS AUTO-GENERATED BY ./parse_specs.d FOR MCU ata5790 WITH ARCHITECTURE avr5 * */ module avr.specs.specs_ata5790; enum __AVR_ARCH__ = 5; enum __AVR_ASM_ONLY__ = false; enum __AVR_ENHANCED__ = true; enum __AVR_HAVE_MUL__ = true; enum __AVR_HAVE_JMP_CALL__ = true; enum __AVR_MEGA__ = true; enum __AVR_HAVE_LPMX__ = true; enum __AVR_HAVE_MOVW__ = true; enum __AVR_HAVE_ELPM__ = false; enum __AVR_HAVE_ELPMX__ = false; enum __AVR_HAVE_EIJMP_EICALL_ = false; enum __AVR_2_BYTE_PC__ = true; enum __AVR_3_BYTE_PC__ = false; enum __AVR_XMEGA__ = false; enum __AVR_HAVE_RAMPX__ = false; enum __AVR_HAVE_RAMPY__ = false; enum __AVR_HAVE_RAMPZ__ = false; enum __AVR_HAVE_RAMPD__ = false; enum __AVR_TINY__ = false; enum __AVR_PM_BASE_ADDRESS__ = 0; enum __AVR_SFR_OFFSET__ = 32; enum __AVR_DEVICE_NAME__ = "ata5790";
D
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/Console.build/Objects-normal/x86_64/Argument.o : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/String+ANSI.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal+Command.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Runnable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/ConsoleStyle.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Value.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ask.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ephemeral.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleProtocol.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/FileHandle+Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Pipe+Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/String+Trim.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Confirm.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Option.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Run.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Group.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Bar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/LoadingBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/ProgressBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Clear/ConsoleClear.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Center.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Color/ConsoleColor.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Options.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Argument.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command+Print.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Print.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/Console.build/Objects-normal/x86_64/Argument~partial.swiftmodule : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/String+ANSI.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal+Command.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Runnable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/ConsoleStyle.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Value.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ask.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ephemeral.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleProtocol.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/FileHandle+Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Pipe+Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/String+Trim.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Confirm.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Option.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Run.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Group.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Bar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/LoadingBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/ProgressBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Clear/ConsoleClear.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Center.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Color/ConsoleColor.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Options.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Argument.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command+Print.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Print.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/Console.build/Objects-normal/x86_64/Argument~partial.swiftdoc : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/String+ANSI.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal+Command.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Runnable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/ConsoleStyle.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Value.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ask.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ephemeral.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleProtocol.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/FileHandle+Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Pipe+Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Stream.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/String+Trim.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Confirm.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Option.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Run.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Group.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Bar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/LoadingBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/ProgressBar.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Clear/ConsoleClear.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Center.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Color/ConsoleColor.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleError.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Options.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Argument.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command+Print.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Print.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
/***********************************\ ADRESSEN DER ENGINECALLS \***********************************/ //======================================== // Talents Aivar field //======================================== const int AIV_TALENT_INDEX = 89; //======================================== // Alle (?) genutzen Engineadressen //======================================== const int CGameManager__ApplySomeSettings = 4355760; //0x4276B0 const int CGameManager__Read_Savegame = 4366400; //0x42A040 Hook: Saves const int CloseHandle = 8079190; //0x7B4756 const int CreateFileA = 8079286; //0x7B47B6 const int Cursor_Ptr = 9246300; //0x8D165C const int Cursor_sX = 9019720; //0x89A148 const int Cursor_sY = 9019724; //0x89A14C const int GetFileSize = 8079310; //0x7B47CE const int GetLastError = 8079394; //0x7B4822 const int oCGame__changeLevel = 7107216; //0x6C7290 Hook: Saves const int oCGame__changeLevelEnd = 7109323; //0x6C7ACB Hook: Saves const int oCGame__Render = 7112352; //0x6C86A0 Hook: FrameFunctions const int oCGame__RenderX = 7112704; //0x6C8800 Hook: Quickslots const int oCGame__UpdateStatus = 7093113; //0x6C3B79 Hook: Focusnames const int oCGame__UpdateStatus_start = 7090496; //0x6C3140 Hook: Bars const int oCGame__UpdateScreenResolution = 7089664; //0x6C2E00 Hook: Bars const int oCItem__Render = 7420608; //0x713AC0 const int oCNpc__CloseInventory = 7742483; //0x762413 Hook: Quickslots const int oCNpc__DropUnconscious = 7560880; //0x735EB0 Hook: Shields const int oCNpc__Equip = 7576720; //0x739C90 const int oCNpc__EquipItem = 7545792; //0x7323C0 Hook: Shields const int oCNpc__EquipWeapon = 7577648; //0x73A030 const int oCNpc__EV_DrawWeapon = 7654416; //0x74CC10 Hook: Shields const int oCNpc__EV_DrawWeapon1 = 7656160; //0x74D2E0 Hook: Shields const int oCNpc__EV_PlayAni = 7699121; //0x757AB1 Hook: AI_Function const int oCNpc__EV_RemoveWeapon = 7658272; //0x74DB20 Hook: Shields const int oCNpc__EV_RemoveWeapon1 = 7660720; //0x74E4B0 Hook: Shields const int oCNpc__OpenInventory = 7742032; //0x762250 Hook: Quickslots const int oCNpc__PutInSlot = 7642288; //0x749CB0 const int oCNpc__RemoveFromSlot = 7643760; //0x74A270 const int oCNpc__UnequipItem = 7546560; //0x7326C0 Hook: Shields const int oCNpc__UseItem = 7584784; //0x73BC10 const int oCNpc__StartDialogAniX = 7700155; // 0x757EBB const int oCNpc__StartDialogAniY = 7700162; // 0x757EC2 const int oCNpc__GetPerceptionFunc = 7726080; //0x75E400 const int oCSavegameManager__SetAndWriteSavegame = 4428037; //0x439105 Hook: Saves const int oCSavegameManager__SetAndWriteSavegame_bp_offset = 60; const int parser =11223232; //0xAB40C0 const int ReadFile = 8272388; //0x7E3A04 const int screen =11232360; //0xAB6468 const int sysGetTimePtr = 5264000; //0x505280 const int WriteFile = 8079292; //0x7B47BC const int zCAICamera_StartDialogCam = 4923632; //0x4B20F0 const int zCAICamera__current = 9235128; //0x8CEAB8 const int zCAICamera__StartDialogCam = 4923632; //0x4B20F0 const int zCAICamera__StartDialogCam_oldInstr = 275316586; const int zCFontMan__GetFont = 7898288; //0x7884B0 const int zCFontMan__Load = 7897808; //0x7882D0 const int zCFont__GetFontName = 7902368; //0x7894A0 const int zCFont__GetFontX = 7902448; //0x7894F0 const int zCFont__GetFontY = 7902432; //0x7894E0 const int zCViewText_vtbl = 8643396; //0x83E344 const int zCInput_zinput = 9246288; //0x8D1650 const int zCInput_Win32__SetDeviceEnabled = 5067008; //0x4D5100 const int zCInput_Win32__GetMouseButtonPressedLeft = 5068688; //0x4D5790 const int zCInput_Win32__GetMouseButtonPressedMid = 5068704; //0x4D57A0 const int zCInput_Win32__GetMouseButtonPressedRight = 5068720; //0x4D57B0 const int zCInput_Win32__GetMousePos = 5068592; //0x4D5730 const int zCParser__CreateInstance = 7942048; //0x792FA0 const int zCParser__CreatePrototype = 7942288; //0x793090 const int zCParser__DoStack = 7936352; //0x791960 const int zCRenderer__DrawTile = 6110448; //0x5D3CF0 const int zCTexture__Load = 6239904; //0x5F36A0 const int zCView__@zCView = 8017856; //0x7A57C0 const int zCView__Close = 8023600; //0x7A6E30 const int zCView__InsertBack = 8020272; //0x7A6130 const int zCView__Move = 8025824; //0x7A76E0 const int zCView__Open = 8023040; //0x7A6C00 const int zCView__Render = 8045072; //0x7AC210 const int zCView__SetFontColor = 8034576; //0x7A9910 const int zCView__SetSize = 8026016; //0x7A77A0 const int zCView__zCView = 8017664; //0x7A5700 const int zCView_Top = 8021904; //007A6790 const int zCView__PrintTimed_color = 8027512; //0x7A7D78 Hook: Interface const int zCView__PrintTimedCX_color = 8027837; //0x7A7EBD Hook: Interface const int zCView__PrintTimedCY_color = 8028042; //0x7A7F8A Hook: Interface const int zCView__PrintTimedCXY_color = 8028406; //0x7A80F6 Hook: Interface const int zCView__PrintTimed_colored = 8027536; //0x7A7D90 Hook: Interface const int zCView__PrintTimedCX_colored = 8027857; //0x7A7ED1 Hook: Interface const int zCView__PrintTimedCY_colored = 8028058; //0x7A7F9A Hook: Interface const int zCView__PrintTimedCXY_colored = 8028422; //0x7A8106 Hook: Interface const int zCWorld__zCWorld = 6421056; //0x61FA40 const int zFontMan =11221460; //0xAB39D4 const int zParser__CallFunc = 7940592; //0x7929F0 const int zrenderer_adr = 9973512; //0x982F08 const int zRND_D3D__DrawLine = 6609120; //0x64D8E0 const int zRND_D3D__DrawPolySimple = 6597680; //0x64AC30 const int zRND_D3D__EndFrame = 6610720; //0X64DF20 Hook: Sprite const int zRND_D3D__SetAlphaBlendFunc = 6628880; //0x652610 const int zCRnd_D3D__XD3D_SetRenderState = 6573808; //0x644EF0 const int zRND_D3D_TexMemory_offset = 1208; const int zSinCosApprox = 6269632; //0x5FAAC0 const int T_DIALOGGESTURE_ = 9148264; //0x8B9768 const int _atan2f = 8123804; //0x7BF59C const int _sinf = 8123910; //0x7BF606 const int _acosf = 8123794; //0x7BF592 const int menu_savegame_slot_offset = 3276; const int sub_4D3D90_X = 5062907; //0x4D40FB Hook: Cursor const int zCConsole__Register = 7875296; //0x782AE0 const int zCConsoleOutputOverwriteAddr = 7142904; //0x6CFDF8 Hook: ConsoleCommands const int zCOption__ParmValue = 4608896; //0x465380 const int zCOptions_dir_string_offset = 124; //0x7C // The class zCOption is defined incorrectly in Ikarus for Gothic1! const int zCWorld__AdvanceClock = 6447328; //0x6260E0 Hook: Draw3D const int zlineCache = 9257720; //0x8D42F8 const int zCLineCache__Line3D = 5289040; //0x50B450 const int zTBSphere3D__Draw = 5521904; //0x5441F0 const int zTBBox3D__Draw = 5529312; //0x545EE0 const int zCOBBox3D__Draw = 5533040; //0x546D70 const int zcon_address_lego = 11221088; //0xAB3860 //zcon_address is defined in Ikarus but only for Gothic2! //======================================== // Globale Flagvariable //======================================== const int _LeGo_Flags = 0; //======================================== // Missing Item flag //======================================== const int ITEM_ACTIVE_LEGO = 1 << 30; // Not defined in Gothic 1. Necessary for EquipWeapon() //======================================== // Namen einer Textur holen //======================================== func string zCTexture_GetName(var int ptr) { // Eigentlich gar kein Engine-Call if(!ptr) { return ""; }; var zCObject obj; obj = MEM_PtrToInst(ptr); return obj.objectName; }; //======================================== // Pointer auf eine Textur holen //======================================== func int zCTexture_Load(var string texture) { CALL_IntParam(1); CALL_zStringPtrParam(texture); CALL__cdecl(zCTexture__Load); return CALL_RetValAsInt(); }; //======================================== // FontManager holen //======================================== func int zCFontMan_Load(var string font) { CALL_zStringPtrParam(font); CALL__Thiscall(MEM_ReadInt(zFontMan), zCFontMan__Load); return CALL_RetValAsInt(); }; //======================================== // Pointer auf eine Font holen //======================================== func int Print_GetFontPtr(var string font) { var int i; i = zCFontMan_Load(font); CALL_IntParam(i); CALL__Thiscall(MEM_ReadInt(zFontMan), zCFontMan__GetFont); return CALL_RetValAsInt(); }; //======================================== // Namen einer Font holen //======================================== func string Print_GetFontName(var int fontPtr) { CALL_RetValIszString(); CALL__Thiscall(fontPtr, zCFont__GetFontName); return CALL_RetValAszString(); }; //======================================== // Breite eines Strings holen //======================================== func int Print_GetStringWidthPtr(var string s, var int font) { CALL_zStringPtrParam(s); CALL__Thiscall(font, zCFont__GetFontX); return CALL_RetValAsInt(); }; func int Print_GetStringWidth(var string s, var string font) { return Print_GetStringWidthPtr(s, Print_GetFontPtr(font)); }; //======================================== // Höhe einer Font holen //======================================== func int Print_GetFontHeight(var string font) { var int adr; adr = Print_GetFontPtr(font); CALL__thiscall(adr, zCFont__GetFontY); return CALL_RetValAsInt(); }; //======================================== // Beliebigen Waypoint holen //======================================== func int MEM_GetAnyWPPtr() { var zCWaynet wayNet; wayNet = MEM_PtrToInst(MEM_World.wayNet); return MEM_ReadInt(wayNet.wplist_next+4); }; func string MEM_GetAnyWP() { var zCWaypoint wp; wp = _^(MEM_GetAnyWPPtr()); return wp.name; }; //======================================== // Item an Koordinaten einfügen //======================================== func void MEM_InsertItem(var c_item itm, var int fX, var int fY, var int fZ) { var zCWaynet wayNet; wayNet = MEM_PtrToInst(MEM_World.wayNet); var zCWaypoint wp; wp = MEM_PtrToInst(MEM_ReadInt(wayNet.wplist_next+4)); var int x; x = wp.pos[0]; var int y; y = wp.pos[1]; var int z; z = wp.pos[2]; wp.pos[0] = fX; wp.pos[1] = fY; wp.pos[2] = fZ; Wld_InsertItem(Hlp_GetInstanceID(itm), wp.name); wp.pos[0] = x; wp.pos[1] = y; wp.pos[2] = z; }; //======================================== // Vob an Npc hängen //======================================== func int oCNpc_PutInSlot(var c_npc slf, var string SlotName, var int oCVobPtr, var int SlotID) { CALL_IntParam(SlotID); CALL_PtrParam(oCVobPtr); CALL_zStringPtrParam(SlotName); CALL__thiscall(MEM_InstToPtr(slf), oCNpc__PutInSlot); return CALL_RetValAsInt(); }; //======================================== // Vob von Npc entfernen //======================================== func void oCNpc_RemoveFromSlot(var c_npc slf, var string SlotName, var int retVal, var int SlotID) { CALL_IntParam(SlotID); CALL_IntParam(retVal); CALL_zStringPtrParam(SlotName); CALL__thiscall(MEM_InstToPtr(slf), oCNpc__RemoveFromSlot); }; //======================================== // Item ablegen //======================================== func void oCNpc_UnequipItem(var c_npc slf, var int oCItemPtr) { CALL_PtrParam(oCItemPtr); CALL__thiscall(MEM_InstToPtr(slf), oCNpc__UnequipItem); }; //======================================== // Ein Item auf einem View rendern //======================================== func void oCItem_Render(var int itm, var int wld, var int view, var int rot) { var zCView v; v = _^(view); if(v.vposy < 0||(v.vposy+v.vsizey) > 8192) { return; }; if(v.vposy < 0||(v.vposy+v.vsizey) > 8192) { return; }; CALL_FloatParam(rot); CALL_PtrParam(view); CALL_PtrParam(wld); CALL__thiscall(itm, oCItem__Render); }; //======================================== // <funktioniert nicht?> //======================================== func void zCRenderer_DrawTile(var int this, var int tex, var int vec0x, var int vec0y, var int vec1x, var int vec1y, var int flt, var int vec2x, var int vec2y, var int vec3x, var int vec3y, var int color) { const int vec = 0; if(!vec) { vec = MEM_Alloc(8); }; CALL_IntParam(color); CALL_PtrParam(vec); CALL_PtrParam(vec); CALL_FloatParam(flt); CALL_PtrParam(vec); MEM_WriteInt(vec+0, vec0x); MEM_WriteInt(vec+4, vec0y); CALL_PtrParam(vec); CALL_PtrParam(tex); CALL__thiscall(this, zCRenderer__DrawTile); }; //======================================== // Beliebiges Item anlegen //======================================== func void oCNpc_Equip(var int npcPtr, var int itmPtr) { CALL_PtrParam(itmPtr); CALL__thiscall(npcPtr, oCNpc__Equip); }; //======================================== // Aktuelle Instanz bearbeiten //======================================== func void MEM_SetUseInstance(var int inst) { MemoryProtectionOverride(11232304, 10); if (inst) { MEM_WriteInt(11232304, inst); MEM_WriteInt(11232308, MEM_ReadInt(inst+zCParSymbol_offset_offset)); } else { MEM_WriteInt(11232304, 0); MEM_WriteInt(11232308, 0); }; }; func int MEM_GetUseInstance() { return MEM_ReadInt(11232304); };
D
<?xml version="1.0" encoding="ASCII" standalone="no"?> <di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0"> <pageList> <availablePage> <emfPageIdentifier href="VAR_10_BeT-3619791182.notation#_copSALmGEeKQQp7P9cQvNQ"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="VAR_10_BeT-3619791182.notation#_copSALmGEeKQQp7P9cQvNQ"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
module UnrealScript.Engine.MaterialExpressionTerrainLayerWeight; import ScriptClasses; import UnrealScript.Helpers; import UnrealScript.Core.UObject; import UnrealScript.Engine.MaterialExpression; extern(C++) interface MaterialExpressionTerrainLayerWeight : MaterialExpression { public extern(D): private static __gshared ScriptClass mStaticClass; @property final static ScriptClass StaticClass() { mixin(MGSCC("Class Engine.MaterialExpressionTerrainLayerWeight")); } private static __gshared MaterialExpressionTerrainLayerWeight mDefaultProperties; @property final static MaterialExpressionTerrainLayerWeight DefaultProperties() { mixin(MGDPC("MaterialExpressionTerrainLayerWeight", "MaterialExpressionTerrainLayerWeight Engine.Default__MaterialExpressionTerrainLayerWeight")); } @property final auto ref { UObject.Guid ExpressionGUID() { mixin(MGPC("UObject.Guid", 180)); } float PreviewWeight() { mixin(MGPC("float", 176)); } ScriptName ParameterName() { mixin(MGPC("ScriptName", 168)); } MaterialExpression.ExpressionInput Layer() { mixin(MGPC("MaterialExpression.ExpressionInput", 140)); } MaterialExpression.ExpressionInput Base() { mixin(MGPC("MaterialExpression.ExpressionInput", 112)); } Pointer InstanceOverride() { mixin(MGPC("Pointer", 108)); } } }
D
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ module flow.job.service.impl.asyncexecutor.multitenant.TenantAwareExecuteAsyncRunnable; import flow.common.cfg.multitenant.TenantInfoHolder; import flow.job.service.api.JobInfo; import flow.job.service.JobServiceConfiguration; import flow.job.service.impl.asyncexecutor.ExecuteAsyncRunnable; import flow.job.service.impl.persistence.entity.JobInfoEntityManager; import flow.job.service.impl.persistence.entity.JobInfoEntity; /** * Extends the default {@link ExecuteAsyncRunnable} by setting the 'tenant' context before executing. * * @author Joram Barrez */ class TenantAwareExecuteAsyncRunnable : ExecuteAsyncRunnable { protected TenantInfoHolder tenantInfoHolder; protected string tenantId; this(JobInfo job, JobServiceConfiguration jobServiceConfiguration, TenantInfoHolder tenantInfoHolder, string tenantId) { super(job, jobServiceConfiguration, cast(JobInfoEntityManager!JobInfoEntity)(jobServiceConfiguration.getJobEntityManager()), null); this.tenantInfoHolder = tenantInfoHolder; this.tenantId = tenantId; } override public void run() { tenantInfoHolder.setCurrentTenantId(tenantId); super.run(); tenantInfoHolder.clearCurrentTenantId(); } }
D
/Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/EventMonitor.o : /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartFormData.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartUpload.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AlamofireExtended.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Protected.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPMethod.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Combine.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Result+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Response.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/SessionDelegate.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoding.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Session.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Validation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ResponseSerialization.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestTaskMap.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RedirectHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AFError.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/EventMonitor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Notifications.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPHeaders.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Request.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/sergiysobol/Projects/MovieDatabase/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/dyld.modulemap /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/EventMonitor~partial.swiftmodule : /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartFormData.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartUpload.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AlamofireExtended.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Protected.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPMethod.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Combine.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Result+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Response.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/SessionDelegate.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoding.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Session.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Validation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ResponseSerialization.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestTaskMap.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RedirectHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AFError.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/EventMonitor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Notifications.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPHeaders.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Request.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/sergiysobol/Projects/MovieDatabase/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/dyld.modulemap /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/EventMonitor~partial.swiftdoc : /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartFormData.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartUpload.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AlamofireExtended.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Protected.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPMethod.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Combine.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Result+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Response.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/SessionDelegate.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoding.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Session.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Validation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ResponseSerialization.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestTaskMap.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RedirectHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AFError.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/EventMonitor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Notifications.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPHeaders.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Request.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/sergiysobol/Projects/MovieDatabase/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/dyld.modulemap /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/EventMonitor~partial.swiftsourceinfo : /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartFormData.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/MultipartUpload.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AlamofireExtended.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Protected.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPMethod.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Combine.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Result+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Alamofire.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Response.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/SessionDelegate.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoding.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Session.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Validation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ResponseSerialization.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestTaskMap.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/ParameterEncoder.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RedirectHandler.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AFError.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/EventMonitor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RequestInterceptor.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Notifications.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/HTTPHeaders.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/Request.swift /Users/sergiysobol/Projects/MovieDatabase/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/sergiysobol/Projects/MovieDatabase/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/dyld.modulemap /Users/sergiysobol/Projects/MovieDatabase/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/Build/Intermediates/tableView.build/Debug-iphonesimulator/tableView.build/Objects-normal/x86_64/AppDelegate.o : /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/tableView/ViewController.swift /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/tableView/AppDelegate.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/Build/Intermediates/tableView.build/Debug-iphonesimulator/tableView.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule : /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/tableView/ViewController.swift /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/tableView/AppDelegate.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/Build/Intermediates/tableView.build/Debug-iphonesimulator/tableView.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc : /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/tableView/ViewController.swift /Users/hernaniruegasvillarreal/Documents/github/swift/Timers-Tables-PermanentStorage-WebContent/tableView/tableView/AppDelegate.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule
D
# FIXED HVACI_Sensorless-DevInit_F2833x.obj: ../HVACI_Sensorless-DevInit_F2833x.c HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/development_kits/~SupportFiles/F2833x_headers/PeripheralHeaderIncludes.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Adc.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_DevEmu.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_CpuTimers.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_ECan.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_ECap.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_DMA.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_EPwm.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_EQep.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Gpio.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_I2c.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_McBSP.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_PieCtrl.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_PieVect.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Spi.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Sci.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_SysCtrl.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_XIntrupt.h HVACI_Sensorless-DevInit_F2833x.obj: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Xintf.h ../HVACI_Sensorless-DevInit_F2833x.c: C:/ti/controlSUITE/development_kits/~SupportFiles/F2833x_headers/PeripheralHeaderIncludes.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Adc.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_DevEmu.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_CpuTimers.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_ECan.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_ECap.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_DMA.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_EPwm.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_EQep.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Gpio.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_I2c.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_McBSP.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_PieCtrl.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_PieVect.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Spi.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Sci.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_SysCtrl.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_XIntrupt.h: C:/ti/controlSUITE/device_support/f2833x/v140/DSP2833x_headers/include/DSP2833x_Xintf.h:
D
/** * Defines the bulk of the classes which represent the AST at the expression level. * * Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions) * * Copyright: Copyright (C) 1999-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/expression.d, _expression.d) * Documentation: https://dlang.org/phobos/dmd_expression.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/expression.d */ module dmd.expression; import core.stdc.stdarg; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; import dmd.aliasthis; import dmd.arrayop; import dmd.arraytypes; import dmd.astenums; import dmd.ast_node; import dmd.gluelayer; import dmd.constfold; import dmd.ctfeexpr; import dmd.ctorflow; import dmd.dcast; import dmd.dclass; import dmd.declaration; import dmd.delegatize; import dmd.dimport; import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.dtemplate; import dmd.errors; import dmd.escape; import dmd.expressionsem; import dmd.func; import dmd.globals; import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.init; import dmd.inline; import dmd.location; import dmd.mtype; import dmd.nspace; import dmd.objc; import dmd.opover; import dmd.optimize; import dmd.postordervisitor; import dmd.root.complex; import dmd.root.ctfloat; import dmd.root.filename; import dmd.common.outbuffer; import dmd.root.optional; import dmd.root.rmem; import dmd.root.rootobject; import dmd.root.string; import dmd.root.utf; import dmd.safe; import dmd.sideeffect; import dmd.target; import dmd.tokens; import dmd.typesem; import dmd.visitor; enum LOGSEMANTIC = false; void emplaceExp(T : Expression, Args...)(void* p, Args args) { static if (__VERSION__ < 2099) const init = typeid(T).initializer; else const init = __traits(initSymbol, T); p[0 .. __traits(classInstanceSize, T)] = init[]; (cast(T)p).__ctor(args); } void emplaceExp(T : UnionExp)(T* p, Expression e) { memcpy(p, cast(void*)e, e.size); } /// Return value for `checkModifiable` enum Modifiable { /// Not modifiable no, /// Modifiable (the type is mutable) yes, /// Modifiable because it is initialization initialization, } /** * Specifies how the checkModify deals with certain situations */ enum ModifyFlags { /// Issue error messages on invalid modifications of the variable none, /// No errors are emitted for invalid modifications noError = 0x1, /// The modification occurs for a subfield of the current variable fieldAssign = 0x2, } /**************************************** * Find the first non-comma expression. * Params: * e = Expressions connected by commas * Returns: * left-most non-comma expression */ inout(Expression) firstComma(inout Expression e) { Expression ex = cast()e; while (ex.op == EXP.comma) ex = (cast(CommaExp)ex).e1; return cast(inout)ex; } /**************************************** * Find the last non-comma expression. * Params: * e = Expressions connected by commas * Returns: * right-most non-comma expression */ inout(Expression) lastComma(inout Expression e) { Expression ex = cast()e; while (ex.op == EXP.comma) ex = (cast(CommaExp)ex).e2; return cast(inout)ex; } /***************************************** * Determine if `this` is available by walking up the enclosing * scopes until a function is found. * * Params: * sc = where to start looking for the enclosing function * Returns: * Found function if it satisfies `isThis()`, otherwise `null` */ FuncDeclaration hasThis(Scope* sc) { //printf("hasThis()\n"); Dsymbol p = sc.parent; while (p && p.isTemplateMixin()) p = p.parent; FuncDeclaration fdthis = p ? p.isFuncDeclaration() : null; //printf("fdthis = %p, '%s'\n", fdthis, fdthis ? fdthis.toChars() : ""); // Go upwards until we find the enclosing member function FuncDeclaration fd = fdthis; while (1) { if (!fd) { return null; } if (!fd.isNested() || fd.isThis() || (fd.hasDualContext() && fd.isMember2())) break; Dsymbol parent = fd.parent; while (1) { if (!parent) return null; TemplateInstance ti = parent.isTemplateInstance(); if (ti) parent = ti.parent; else break; } fd = parent.isFuncDeclaration(); } if (!fd.isThis() && !(fd.hasDualContext() && fd.isMember2())) { return null; } assert(fd.vthis); return fd; } /*********************************** * Determine if a `this` is needed to access `d`. * Params: * sc = context * d = declaration to check * Returns: * true means a `this` is needed */ bool isNeedThisScope(Scope* sc, Declaration d) { if (sc.intypeof == 1) return false; AggregateDeclaration ad = d.isThis(); if (!ad) return false; //printf("d = %s, ad = %s\n", d.toChars(), ad.toChars()); for (Dsymbol s = sc.parent; s; s = s.toParentLocal()) { //printf("\ts = %s %s, toParent2() = %p\n", s.kind(), s.toChars(), s.toParent2()); if (AggregateDeclaration ad2 = s.isAggregateDeclaration()) { if (ad2 == ad) return false; else if (ad2.isNested()) continue; else return true; } if (FuncDeclaration f = s.isFuncDeclaration()) { if (f.isMemberLocal()) break; } } return true; } /****************************** * check e is exp.opDispatch!(tiargs) or not * It's used to switch to UFCS the semantic analysis path */ bool isDotOpDispatch(Expression e) { if (auto dtie = e.isDotTemplateInstanceExp()) return dtie.ti.name == Id.opDispatch; return false; } /**************************************** * Expand tuples in-place. * * Example: * When there's a call `f(10, pair: AliasSeq!(20, 30), single: 40)`, the input is: * `exps = [10, (20, 30), 40]` * `names = [null, "pair", "single"]` * The arrays will be modified to: * `exps = [10, 20, 30, 40]` * `names = [null, "pair", null, "single"]` * * Params: * exps = array of Expressions * names = optional array of names corresponding to Expressions */ extern (C++) void expandTuples(Expressions* exps, Identifiers* names = null) { //printf("expandTuples()\n"); if (exps is null) return; if (names) { if (exps.length != names.length) { printf("exps.length = %d, names.length = %d\n", cast(int) exps.length, cast(int) names.length); printf("exps = %s, names = %s\n", exps.toChars(), names.toChars()); if (exps.length > 0) printf("%s\n", (*exps)[0].loc.toChars()); assert(0); } } // At `index`, a tuple of length `length` is expanded. Insert corresponding nulls in `names`. void expandNames(size_t index, size_t length) { if (names) { if (length == 0) { names.remove(index); return; } foreach (i; 1 .. length) { names.insert(index + i, cast(Identifier) null); } } } for (size_t i = 0; i < exps.length; i++) { Expression arg = (*exps)[i]; if (!arg) continue; // Look for tuple with 0 members if (auto e = arg.isTypeExp()) { if (auto tt = e.type.toBasetype().isTypeTuple()) { if (!tt.arguments || tt.arguments.length == 0) { exps.remove(i); expandNames(i, 0); if (i == exps.length) return; } else // Expand a TypeTuple { exps.remove(i); auto texps = new Expressions(tt.arguments.length); foreach (j, a; *tt.arguments) (*texps)[j] = new TypeExp(e.loc, a.type); exps.insert(i, texps); expandNames(i, texps.length); } i--; continue; } } // Inline expand all the tuples while (arg.op == EXP.tuple) { TupleExp te = cast(TupleExp)arg; exps.remove(i); // remove arg exps.insert(i, te.exps); // replace with tuple contents expandNames(i, te.exps.length); if (i == exps.length) return; // empty tuple, no more arguments (*exps)[i] = Expression.combine(te.e0, (*exps)[i]); arg = (*exps)[i]; } } } /**************************************** * Expand alias this tuples. */ TupleDeclaration isAliasThisTuple(Expression e) { if (!e.type) return null; Type t = e.type.toBasetype(); while (true) { if (Dsymbol s = t.toDsymbol(null)) { if (auto ad = s.isAggregateDeclaration()) { s = ad.aliasthis ? ad.aliasthis.sym : null; if (s && s.isVarDeclaration()) { TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration(); if (td && td.isexp) return td; } if (Type att = t.aliasthisOf()) { t = att; continue; } } } return null; } } int expandAliasThisTuples(Expressions* exps, size_t starti = 0) { if (!exps || exps.length == 0) return -1; for (size_t u = starti; u < exps.length; u++) { Expression exp = (*exps)[u]; if (TupleDeclaration td = exp.isAliasThisTuple) { exps.remove(u); size_t i; td.foreachVar((s) { auto d = s.isDeclaration(); auto e = new DotVarExp(exp.loc, exp, d); assert(d.type); e.type = d.type; exps.insert(u + i, e); ++i; }); version (none) { printf("expansion ->\n"); foreach (e; exps) { printf("\texps[%d] e = %s %s\n", i, EXPtoString(e.op), e.toChars()); } } return cast(int)u; } } return -1; } /**************************************** * If `s` is a function template, i.e. the only member of a template * and that member is a function, return that template. * Params: * s = symbol that might be a function template * Returns: * template for that function, otherwise null */ TemplateDeclaration getFuncTemplateDecl(Dsymbol s) { FuncDeclaration f = s.isFuncDeclaration(); if (f && f.parent) { if (auto ti = f.parent.isTemplateInstance()) { if (!ti.isTemplateMixin() && ti.tempdecl) { auto td = ti.tempdecl.isTemplateDeclaration(); if (td.onemember && td.ident == f.ident) { return td; } } } } return null; } /************************************************ * If we want the value of this expression, but do not want to call * the destructor on it. */ Expression valueNoDtor(Expression e) { auto ex = lastComma(e); if (auto ce = ex.isCallExp()) { /* The struct value returned from the function is transferred * so do not call the destructor on it. * Recognize: * ((S _ctmp = S.init), _ctmp).this(...) * and make sure the destructor is not called on _ctmp * BUG: if ex is a CommaExp, we should go down the right side. */ if (auto dve = ce.e1.isDotVarExp()) { if (dve.var.isCtorDeclaration()) { // It's a constructor call if (auto comma = dve.e1.isCommaExp()) { if (auto ve = comma.e2.isVarExp()) { VarDeclaration ctmp = ve.var.isVarDeclaration(); if (ctmp) { ctmp.storage_class |= STC.nodtor; assert(!ce.isLvalue()); } } } } } } else if (auto ve = ex.isVarExp()) { auto vtmp = ve.var.isVarDeclaration(); if (vtmp && (vtmp.storage_class & STC.rvalue)) { vtmp.storage_class |= STC.nodtor; } } return e; } /********************************************* * If e is an instance of a struct, and that struct has a copy constructor, * rewrite e as: * (tmp = e),tmp * Input: * sc = just used to specify the scope of created temporary variable * destinationType = the type of the object on which the copy constructor is called; * may be null if the struct defines a postblit */ private Expression callCpCtor(Scope* sc, Expression e, Type destinationType) { if (auto ts = e.type.baseElemOf().isTypeStruct()) { StructDeclaration sd = ts.sym; if (sd.postblit || sd.hasCopyCtor) { /* Create a variable tmp, and replace the argument e with: * (tmp = e),tmp * and let AssignExp() handle the construction. * This is not the most efficient, ideally tmp would be constructed * directly onto the stack. */ auto tmp = copyToTemp(STC.rvalue, "__copytmp", e); if (sd.hasCopyCtor && destinationType) { // https://issues.dlang.org/show_bug.cgi?id=22619 // If the destination type is inout we can preserve it // only if inside an inout function; if we are not inside // an inout function, then we will preserve the type of // the source if (destinationType.hasWild && !(sc.func.storage_class & STC.wild)) tmp.type = e.type; else tmp.type = destinationType; } tmp.storage_class |= STC.nodtor; tmp.dsymbolSemantic(sc); Expression de = new DeclarationExp(e.loc, tmp); Expression ve = new VarExp(e.loc, tmp); de.type = Type.tvoid; ve.type = e.type; return Expression.combine(de, ve); } } return e; } /************************************************ * Handle the postblit call on lvalue, or the move of rvalue. * * Params: * sc = the scope where the expression is encountered * e = the expression the needs to be moved or copied (source) * t = if the struct defines a copy constructor, the type of the destination * * Returns: * The expression that copy constructs or moves the value. */ extern (D) Expression doCopyOrMove(Scope *sc, Expression e, Type t = null) { if (auto ce = e.isCondExp()) { ce.e1 = doCopyOrMove(sc, ce.e1); ce.e2 = doCopyOrMove(sc, ce.e2); } else { e = e.isLvalue() ? callCpCtor(sc, e, t) : valueNoDtor(e); } return e; } /****************************************************************/ /* A type meant as a union of all the Expression types, * to serve essentially as a Variant that will sit on the stack * during CTFE to reduce memory consumption. */ extern (C++) struct UnionExp { // yes, default constructor does nothing extern (D) this(Expression e) { memcpy(&this, cast(void*)e, e.size); } /* Extract pointer to Expression */ extern (C++) Expression exp() return { return cast(Expression)&u; } /* Convert to an allocated Expression */ extern (C++) Expression copy() { Expression e = exp(); //if (e.size > sizeof(u)) printf("%s\n", EXPtoString(e.op).ptr); assert(e.size <= u.sizeof); switch (e.op) { case EXP.cantExpression: return CTFEExp.cantexp; case EXP.voidExpression: return CTFEExp.voidexp; case EXP.break_: return CTFEExp.breakexp; case EXP.continue_: return CTFEExp.continueexp; case EXP.goto_: return CTFEExp.gotoexp; default: return e.copy(); } } private: // Ensure that the union is suitably aligned. align(8) union __AnonStruct__u { char[__traits(classInstanceSize, Expression)] exp; char[__traits(classInstanceSize, IntegerExp)] integerexp; char[__traits(classInstanceSize, ErrorExp)] errorexp; char[__traits(classInstanceSize, RealExp)] realexp; char[__traits(classInstanceSize, ComplexExp)] complexexp; char[__traits(classInstanceSize, SymOffExp)] symoffexp; char[__traits(classInstanceSize, StringExp)] stringexp; char[__traits(classInstanceSize, ArrayLiteralExp)] arrayliteralexp; char[__traits(classInstanceSize, AssocArrayLiteralExp)] assocarrayliteralexp; char[__traits(classInstanceSize, StructLiteralExp)] structliteralexp; char[__traits(classInstanceSize, CompoundLiteralExp)] compoundliteralexp; char[__traits(classInstanceSize, NullExp)] nullexp; char[__traits(classInstanceSize, DotVarExp)] dotvarexp; char[__traits(classInstanceSize, AddrExp)] addrexp; char[__traits(classInstanceSize, IndexExp)] indexexp; char[__traits(classInstanceSize, SliceExp)] sliceexp; char[__traits(classInstanceSize, VectorExp)] vectorexp; } __AnonStruct__u u; } /******************************** * Test to see if two reals are the same. * Regard NaN's as equivalent. * Regard +0 and -0 as different. * Params: * x1 = first operand * x2 = second operand * Returns: * true if x1 is x2 * else false */ bool RealIdentical(real_t x1, real_t x2) { return (CTFloat.isNaN(x1) && CTFloat.isNaN(x2)) || CTFloat.isIdentical(x1, x2); } /************************ TypeDotIdExp ************************************/ /* Things like: * int.size * foo.size * (foo).size * cast(foo).size */ DotIdExp typeDotIdExp(const ref Loc loc, Type type, Identifier ident) { return new DotIdExp(loc, new TypeExp(loc, type), ident); } /*************************************************** * Given an Expression, find the variable it really is. * * For example, `a[index]` is really `a`, and `s.f` is really `s`. * Params: * e = Expression to look at * Returns: * variable if there is one, null if not */ VarDeclaration expToVariable(Expression e) { while (1) { switch (e.op) { case EXP.variable: return (cast(VarExp)e).var.isVarDeclaration(); case EXP.dotVariable: e = (cast(DotVarExp)e).e1; continue; case EXP.index: { IndexExp ei = cast(IndexExp)e; e = ei.e1; Type ti = e.type.toBasetype(); if (ti.ty == Tsarray) continue; return null; } case EXP.slice: { SliceExp ei = cast(SliceExp)e; e = ei.e1; Type ti = e.type.toBasetype(); if (ti.ty == Tsarray) continue; return null; } case EXP.this_: case EXP.super_: return (cast(ThisExp)e).var.isVarDeclaration(); // Temporaries for rvalues that need destruction // are of form: (T s = rvalue, s). For these cases // we can just return var declaration of `s`. However, // this is intentionally not calling `Expression.extractLast` // because at this point we cannot infer the var declaration // of more complex generated comma expressions such as the // one for the array append hook. case EXP.comma: { if (auto ve = e.isCommaExp().e2.isVarExp()) return ve.var.isVarDeclaration(); return null; } default: return null; } } } enum OwnedBy : ubyte { code, // normal code expression in AST ctfe, // value expression for CTFE cache, // constant value cached for CTFE } enum WANTvalue = 0; // default enum WANTexpand = 1; // expand const/immutable variables if possible /*********************************************************** * https://dlang.org/spec/expression.html#expression */ extern (C++) abstract class Expression : ASTNode { Type type; // !=null means that semantic() has been run Loc loc; // file location const EXP op; // to minimize use of dynamic_cast extern (D) this(const ref Loc loc, EXP op) scope { //printf("Expression::Expression(op = %d) this = %p\n", op, this); this.loc = loc; this.op = op; } /// Returns: class instance size of this expression (implemented manually because `extern(C++)`) final size_t size() nothrow @nogc pure @safe const { return expSize[op]; } static void _init() { CTFEExp.cantexp = new CTFEExp(EXP.cantExpression); CTFEExp.voidexp = new CTFEExp(EXP.voidExpression); CTFEExp.breakexp = new CTFEExp(EXP.break_); CTFEExp.continueexp = new CTFEExp(EXP.continue_); CTFEExp.gotoexp = new CTFEExp(EXP.goto_); CTFEExp.showcontext = new CTFEExp(EXP.showCtfeContext); } /** * Deinitializes the global state of the compiler. * * This can be used to restore the state set by `_init` to its original * state. */ static void deinitialize() { CTFEExp.cantexp = CTFEExp.cantexp.init; CTFEExp.voidexp = CTFEExp.voidexp.init; CTFEExp.breakexp = CTFEExp.breakexp.init; CTFEExp.continueexp = CTFEExp.continueexp.init; CTFEExp.gotoexp = CTFEExp.gotoexp.init; CTFEExp.showcontext = CTFEExp.showcontext.init; } /********************************* * Does *not* do a deep copy. */ final Expression copy() { Expression e; if (!size) { debug { fprintf(stderr, "No expression copy for: %s\n", toChars()); printf("op = %d\n", op); } assert(0); } // memory never freed, so can use the faster bump-pointer-allocation e = cast(Expression)allocmemory(size); //printf("Expression::copy(op = %d) e = %p\n", op, e); return cast(Expression)memcpy(cast(void*)e, cast(void*)this, size); } Expression syntaxCopy() { //printf("Expression::syntaxCopy()\n"); //print(); return copy(); } // kludge for template.isExpression() override final DYNCAST dyncast() const { return DYNCAST.expression; } override const(char)* toChars() const { OutBuffer buf; HdrGenState hgs; toCBuffer(this, &buf, &hgs); return buf.extractChars(); } static if (__VERSION__ < 2092) { final void error(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .verror(loc, format, ap); va_end(ap); } } final void errorSupplemental(const(char)* format, ...) { if (type == Type.terror) return; va_list ap; va_start(ap, format); .verrorSupplemental(loc, format, ap); va_end(ap); } final void warning(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vwarning(loc, format, ap); va_end(ap); } } final void deprecation(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vdeprecation(loc, format, ap); va_end(ap); } } } else { pragma(printf) final void error(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .verror(loc, format, ap); va_end(ap); } } pragma(printf) final void errorSupplemental(const(char)* format, ...) { if (type == Type.terror) return; va_list ap; va_start(ap, format); .verrorSupplemental(loc, format, ap); va_end(ap); } pragma(printf) final void warning(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vwarning(loc, format, ap); va_end(ap); } } pragma(printf) final void deprecation(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vdeprecation(loc, format, ap); va_end(ap); } } } /********************************** * Combine e1 and e2 by CommaExp if both are not NULL. */ extern (D) static Expression combine(Expression e1, Expression e2) { if (e1) { if (e2) { e1 = new CommaExp(e1.loc, e1, e2); e1.type = e2.type; } } else e1 = e2; return e1; } extern (D) static Expression combine(Expression e1, Expression e2, Expression e3) { return combine(combine(e1, e2), e3); } extern (D) static Expression combine(Expression e1, Expression e2, Expression e3, Expression e4) { return combine(combine(e1, e2), combine(e3, e4)); } /********************************** * If 'e' is a tree of commas, returns the rightmost expression * by stripping off it from the tree. The remained part of the tree * is returned via e0. * Otherwise 'e' is directly returned and e0 is set to NULL. */ extern (D) static Expression extractLast(Expression e, out Expression e0) { if (e.op != EXP.comma) { return e; } CommaExp ce = cast(CommaExp)e; if (ce.e2.op != EXP.comma) { e0 = ce.e1; return ce.e2; } else { e0 = e; Expression* pce = &ce.e2; while ((cast(CommaExp)(*pce)).e2.op == EXP.comma) { pce = &(cast(CommaExp)(*pce)).e2; } assert((*pce).op == EXP.comma); ce = cast(CommaExp)(*pce); *pce = ce.e1; return ce.e2; } } extern (D) static Expressions* arraySyntaxCopy(Expressions* exps) { Expressions* a = null; if (exps) { a = new Expressions(exps.length); foreach (i, e; *exps) { (*a)[i] = e ? e.syntaxCopy() : null; } } return a; } dinteger_t toInteger() { //printf("Expression %s\n", EXPtoString(op).ptr); error("integer constant expression expected instead of `%s`", toChars()); return 0; } uinteger_t toUInteger() { //printf("Expression %s\n", EXPtoString(op).ptr); return cast(uinteger_t)toInteger(); } real_t toReal() { error("floating point constant expression expected instead of `%s`", toChars()); return CTFloat.zero; } real_t toImaginary() { error("floating point constant expression expected instead of `%s`", toChars()); return CTFloat.zero; } complex_t toComplex() { error("floating point constant expression expected instead of `%s`", toChars()); return complex_t(CTFloat.zero); } StringExp toStringExp() { return null; } /*************************************** * Return !=0 if expression is an lvalue. */ bool isLvalue() { return false; } /******************************* * Give error if we're not an lvalue. * If we can, convert expression to be an lvalue. */ Expression toLvalue(Scope* sc, Expression e) { if (!e) e = this; else if (!loc.isValid()) loc = e.loc; if (e.op == EXP.type) error("`%s` is a `%s` definition and cannot be modified", e.type.toChars(), e.type.kind()); else error("`%s` is not an lvalue and cannot be modified", e.toChars()); return ErrorExp.get(); } Expression modifiableLvalue(Scope* sc, Expression e) { //printf("Expression::modifiableLvalue() %s, type = %s\n", toChars(), type.toChars()); // See if this expression is a modifiable lvalue (i.e. not const) if (checkModifiable(this, sc) == Modifiable.yes) { assert(type); if (!type.isMutable()) { if (auto dve = this.isDotVarExp()) { if (isNeedThisScope(sc, dve.var)) for (Dsymbol s = sc.func; s; s = s.toParentLocal()) { FuncDeclaration ff = s.isFuncDeclaration(); if (!ff) break; if (!ff.type.isMutable) { error("cannot modify `%s` in `%s` function", toChars(), MODtoChars(type.mod)); return ErrorExp.get(); } } } error("cannot modify `%s` expression `%s`", MODtoChars(type.mod), toChars()); return ErrorExp.get(); } else if (!type.isAssignable()) { error("cannot modify struct instance `%s` of type `%s` because it contains `const` or `immutable` members", toChars(), type.toChars()); return ErrorExp.get(); } } return toLvalue(sc, e); } final Expression implicitCastTo(Scope* sc, Type t) { return .implicitCastTo(this, sc, t); } final MATCH implicitConvTo(Type t) { return .implicitConvTo(this, t); } final Expression castTo(Scope* sc, Type t) { return .castTo(this, sc, t); } /**************************************** * Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, __FILE_FULL_PATH__ to loc. */ Expression resolveLoc(const ref Loc loc, Scope* sc) { this.loc = loc; return this; } /**************************************** * Check that the expression has a valid type. * If not, generates an error "... has no type". * Returns: * true if the expression is not valid. * Note: * When this function returns true, `checkValue()` should also return true. */ bool checkType() { return false; } /**************************************** * Check that the expression has a valid value. * If not, generates an error "... has no value". * Returns: * true if the expression is not valid or has void type. */ bool checkValue() { if (type && type.toBasetype().ty == Tvoid) { error("expression `%s` is `void` and has no value", toChars()); //print(); assert(0); if (!global.gag) type = Type.terror; return true; } return false; } extern (D) final bool checkScalar() { if (op == EXP.error) return true; if (type.toBasetype().ty == Terror) return true; if (!type.isscalar()) { error("`%s` is not a scalar, it is a `%s`", toChars(), type.toChars()); return true; } return checkValue(); } extern (D) final bool checkNoBool() { if (op == EXP.error) return true; if (type.toBasetype().ty == Terror) return true; if (type.toBasetype().ty == Tbool) { error("operation not allowed on `bool` `%s`", toChars()); return true; } return false; } extern (D) final bool checkIntegral() { if (op == EXP.error) return true; if (type.toBasetype().ty == Terror) return true; if (!type.isintegral()) { error("`%s` is not of integral type, it is a `%s`", toChars(), type.toChars()); return true; } return checkValue(); } extern (D) final bool checkArithmetic() { if (op == EXP.error) return true; if (type.toBasetype().ty == Terror) return true; if (!type.isintegral() && !type.isfloating()) { error("`%s` is not of arithmetic type, it is a `%s`", toChars(), type.toChars()); return true; } return checkValue(); } final bool checkDeprecated(Scope* sc, Dsymbol s) { return s.checkDeprecated(loc, sc); } extern (D) final bool checkDisabled(Scope* sc, Dsymbol s) { if (auto d = s.isDeclaration()) { return d.checkDisabled(loc, sc); } return false; } /********************************************* * Calling function f. * Check the purity, i.e. if we're in a pure function * we can only call other pure functions. * Returns true if error occurs. */ extern (D) final bool checkPurity(Scope* sc, FuncDeclaration f) { if (!sc.func) return false; if (sc.func == f) return false; if (sc.intypeof == 1) return false; if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; // If the call has a pure parent, then the called func must be pure. if (!f.isPure() && checkImpure(sc, loc, null, f)) { error("`pure` %s `%s` cannot call impure %s `%s`", sc.func.kind(), sc.func.toPrettyChars(), f.kind(), f.toPrettyChars()); if (!f.isDtorDeclaration()) errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.pure_); checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure"); return true; } return false; } /** * Checks whether `f` is a generated `DtorDeclaration` that hides a user-defined one * which passes `check` while `f` doesn't (e.g. when the user defined dtor is pure but * the generated dtor is not). * In that case the method will identify and print all members causing the attribute * missmatch. * * Params: * sc = scope * f = potential `DtorDeclaration` * check = current check (e.g. whether it's pure) * checkName = the kind of check (e.g. `"pure"`) */ extern (D) final void checkOverridenDtor(Scope* sc, FuncDeclaration f, scope bool function(DtorDeclaration) check, const string checkName ) { auto dd = f.isDtorDeclaration(); if (!dd || !dd.isGenerated()) return; // DtorDeclaration without parents should fail at an earlier stage auto ad = cast(AggregateDeclaration) f.toParent2(); assert(ad); if (ad.userDtors.length) { if (!check(ad.userDtors[0])) // doesn't match check (e.g. is impure as well) return; // Sanity check assert(!check(ad.fieldDtor)); } dd.loc.errorSupplemental("%s`%s.~this` is %.*s because of the following field's destructors:", dd.isGenerated() ? "generated " : "".ptr, ad.toChars, cast(int) checkName.length, checkName.ptr); // Search for the offending fields foreach (field; ad.fields) { // Only structs may define automatically called destructors auto ts = field.type.isTypeStruct(); if (!ts) { // But they might be part of a static array auto ta = field.type.isTypeSArray(); if (!ta) continue; ts = ta.baseElemOf().isTypeStruct(); if (!ts) continue; } auto fieldSym = ts.toDsymbol(sc); assert(fieldSym); // Resolving ts must succeed because missing defs. should error before auto fieldSd = fieldSym.isStructDeclaration(); assert(fieldSd); // ts is a TypeStruct, this would imply a malformed ASR if (fieldSd.dtor && !check(fieldSd.dtor)) { field.loc.errorSupplemental(" - %s %s", field.type.toChars(), field.toChars()); if (fieldSd.dtor.isGenerated()) checkOverridenDtor(sc, fieldSd.dtor, check, checkName); else fieldSd.dtor.loc.errorSupplemental(" %.*s `%s.~this` is declared here", cast(int) checkName.length, checkName.ptr, fieldSd.toChars()); } } } /******************************************* * Accessing variable v. * Check for purity and safety violations. * Returns true if error occurs. */ extern (D) final bool checkPurity(Scope* sc, VarDeclaration v) { //printf("v = %s %s\n", v.type.toChars(), v.toChars()); /* Look for purity and safety violations when accessing variable v * from current function. */ if (!sc.func) return false; if (sc.intypeof == 1) return false; // allow violations inside typeof(expression) if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; // allow violations inside compile-time evaluated expressions and debug conditionals if (v.ident == Id.ctfe) return false; // magic variable never violates pure and safe if (v.isImmutable()) return false; // always safe and pure to access immutables... if (v.isConst() && !v.isReference() && (v.isDataseg() || v.isParameter()) && v.type.implicitConvTo(v.type.immutableOf())) return false; // or const global/parameter values which have no mutable indirections if (v.storage_class & STC.manifest) return false; // ...or manifest constants // accessing empty structs is pure // https://issues.dlang.org/show_bug.cgi?id=18694 // https://issues.dlang.org/show_bug.cgi?id=21464 // https://issues.dlang.org/show_bug.cgi?id=23589 if (v.type.ty == Tstruct) { StructDeclaration sd = (cast(TypeStruct)v.type).sym; if (sd.members) // not opaque { if (sd.semanticRun >= PASS.semanticdone) sd.determineSize(v.loc); if (sd.hasNoFields) return false; } } bool err = false; if (v.isDataseg()) { // https://issues.dlang.org/show_bug.cgi?id=7533 // Accessing implicit generated __gate is pure. if (v.ident == Id.gate) return false; if (checkImpure(sc, loc, "`pure` %s `%s` cannot access mutable static data `%s`", v)) { error("`pure` %s `%s` cannot access mutable static data `%s`", sc.func.kind(), sc.func.toPrettyChars(), v.toChars()); err = true; } } else { /* Given: * void f() { * int fx; * pure void g() { * int gx; * /+pure+/ void h() { * int hx; * /+pure+/ void i() { } * } * } * } * i() can modify hx and gx but not fx */ Dsymbol vparent = v.toParent2(); for (Dsymbol s = sc.func; !err && s; s = s.toParentP(vparent)) { if (s == vparent) break; if (AggregateDeclaration ad = s.isAggregateDeclaration()) { if (ad.isNested()) continue; break; } FuncDeclaration ff = s.isFuncDeclaration(); if (!ff) break; if (ff.isNested() || ff.isThis()) { if (ff.type.isImmutable() || ff.type.isShared() && !MODimplicitConv(ff.type.mod, v.type.mod)) { OutBuffer ffbuf; OutBuffer vbuf; MODMatchToBuffer(&ffbuf, ff.type.mod, v.type.mod); MODMatchToBuffer(&vbuf, v.type.mod, ff.type.mod); error("%s%s `%s` cannot access %sdata `%s`", ffbuf.peekChars(), ff.kind(), ff.toPrettyChars(), vbuf.peekChars(), v.toChars()); err = true; break; } continue; } break; } } /* Do not allow safe functions to access __gshared data */ if (v.storage_class & STC.gshared) { if (sc.setUnsafe(false, this.loc, "`@safe` function `%s` cannot access `__gshared` data `%s`", sc.func, v)) { err = true; } } return err; } /* Check if sc.func is impure or can be made impure. Returns true on error, i.e. if sc.func is pure and cannot be made impure. */ private static bool checkImpure(Scope* sc, Loc loc, const(char)* fmt, RootObject arg0) { return sc.func && (isRootTraitsCompilesScope(sc) ? sc.func.isPureBypassingInference() >= PURE.weak : sc.func.setImpure(loc, fmt, arg0)); } /********************************************* * Calling function f. * Check the safety, i.e. if we're in a @safe function * we can only call @safe or @trusted functions. * Returns true if error occurs. */ extern (D) final bool checkSafety(Scope* sc, FuncDeclaration f) { if (sc.func == f) return false; if (sc.intypeof == 1) return false; if (sc.flags & SCOPE.debug_) return false; if ((sc.flags & SCOPE.ctfe) && sc.func) return false; if (!sc.func) { if (sc.varDecl && !f.safetyInprocess && !f.isSafe() && !f.isTrusted()) { if (sc.varDecl.storage_class & STC.safe) { error("`@safe` variable `%s` cannot be initialized by calling `@system` function `%s`", sc.varDecl.toChars(), f.toChars()); return true; } else { sc.varDecl.storage_class |= STC.system; } } return false; } if (!f.isSafe() && !f.isTrusted()) { if (isRootTraitsCompilesScope(sc) ? sc.func.isSafeBypassingInference() : sc.func.setUnsafeCall(f)) { if (!loc.isValid()) // e.g. implicitly generated dtor loc = sc.func.loc; const prettyChars = f.toPrettyChars(); error("`@safe` %s `%s` cannot call `@system` %s `%s`", sc.func.kind(), sc.func.toPrettyChars(), f.kind(), prettyChars); if (!f.isDtorDeclaration) errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.safe); .errorSupplemental(f.loc, "`%s` is declared here", prettyChars); checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system"); return true; } } else if (f.isSafe() && f.safetyViolation) { // for dip1000 by default transition, print deprecations for calling functions that will become `@system` if (sc.func.isSafeBypassingInference()) { .deprecation(this.loc, "`@safe` function `%s` calling `%s`", sc.func.toChars(), f.toChars()); errorSupplementalInferredAttr(f, 10, true, STC.safe); } else if (!sc.func.safetyViolation) { import dmd.func : AttributeViolation; sc.func.safetyViolation = new AttributeViolation(this.loc, null, f, null, null); } } return false; } /********************************************* * Calling function f. * Check the @nogc-ness, i.e. if we're in a @nogc function * we can only call other @nogc functions. * Returns true if error occurs. */ extern (D) final bool checkNogc(Scope* sc, FuncDeclaration f) { if (!sc.func) return false; if (sc.func == f) return false; if (sc.intypeof == 1) return false; if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; /* The original expression (`new S(...)`) will be verified instead. This * is to keep errors related to the original code and not the lowering. */ if (f.ident == Id._d_newitemT) return false; if (!f.isNogc()) { if (isRootTraitsCompilesScope(sc) ? sc.func.isNogcBypassingInference() : sc.func.setGCCall(f)) { if (loc.linnum == 0) // e.g. implicitly generated dtor loc = sc.func.loc; // Lowered non-@nogc'd hooks will print their own error message inside of nogc.d (NOGCVisitor.visit(CallExp e)), // so don't print anything to avoid double error messages. if (!(f.ident == Id._d_HookTraceImpl || f.ident == Id._d_arraysetlengthT || f.ident == Id._d_arrayappendT || f.ident == Id._d_arrayappendcTX || f.ident == Id._d_arraycatnTX || f.ident == Id._d_newclassT)) { error("`@nogc` %s `%s` cannot call non-@nogc %s `%s`", sc.func.kind(), sc.func.toPrettyChars(), f.kind(), f.toPrettyChars()); if (!f.isDtorDeclaration) f.errorSupplementalInferredAttr(/*max depth*/ 10, /*deprecation*/ false, STC.nogc); } checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc"); return true; } } return false; } /******************************************** * Check that the postblit is callable if t is an array of structs. * Returns true if error happens. */ extern (D) final bool checkPostblit(Scope* sc, Type t) { if (auto ts = t.baseElemOf().isTypeStruct()) { if (global.params.useTypeInfo && Type.dtypeinfo) { // https://issues.dlang.org/show_bug.cgi?id=11395 // Require TypeInfo generation for array concatenation semanticTypeInfo(sc, t); } StructDeclaration sd = ts.sym; if (sd.postblit) { if (sd.postblit.checkDisabled(loc, sc)) return true; //checkDeprecated(sc, sd.postblit); // necessary? checkPurity(sc, sd.postblit); checkSafety(sc, sd.postblit); checkNogc(sc, sd.postblit); //checkAccess(sd, loc, sc, sd.postblit); // necessary? return false; } } return false; } extern (D) final bool checkRightThis(Scope* sc) { if (op == EXP.error) return true; if (op == EXP.variable && type.ty != Terror) { VarExp ve = cast(VarExp)this; if (isNeedThisScope(sc, ve.var)) { //printf("checkRightThis sc.intypeof = %d, ad = %p, func = %p, fdthis = %p\n", // sc.intypeof, sc.getStructClassScope(), func, fdthis); error("need `this` for `%s` of type `%s`", ve.var.toChars(), ve.var.type.toChars()); return true; } } return false; } /******************************* * Check whether the expression allows RMW operations, error with rmw operator diagnostic if not. * ex is the RHS expression, or NULL if ++/-- is used (for diagnostics) * Returns true if error occurs. */ extern (D) final bool checkReadModifyWrite(EXP rmwOp, Expression ex = null) { //printf("Expression::checkReadModifyWrite() %s %s", toChars(), ex ? ex.toChars() : ""); if (!type || !type.isShared() || type.isTypeStruct() || type.isTypeClass()) return false; // atomicOp uses opAssign (+=/-=) rather than opOp (++/--) for the CT string literal. switch (rmwOp) { case EXP.plusPlus: case EXP.prePlusPlus: rmwOp = EXP.addAssign; break; case EXP.minusMinus: case EXP.preMinusMinus: rmwOp = EXP.minAssign; break; default: break; } error("read-modify-write operations are not allowed for `shared` variables"); errorSupplemental("Use `core.atomic.atomicOp!\"%s\"(%s, %s)` instead", EXPtoString(rmwOp).ptr, toChars(), ex ? ex.toChars() : "1"); return true; } /************************************************ * Destructors are attached to VarDeclarations. * Hence, if expression returns a temp that needs a destructor, * make sure and create a VarDeclaration for that temp. */ Expression addDtorHook(Scope* sc) { return this; } /****************************** * Take address of expression. */ final Expression addressOf() { //printf("Expression::addressOf()\n"); debug { assert(op == EXP.error || isLvalue()); } Expression e = new AddrExp(loc, this, type.pointerTo()); return e; } /****************************** * If this is a reference, dereference it. */ final Expression deref() { //printf("Expression::deref()\n"); // type could be null if forward referencing an 'auto' variable if (type) if (auto tr = type.isTypeReference()) { Expression e = new PtrExp(loc, this, tr.next); return e; } return this; } final Expression optimize(int result, bool keepLvalue = false) { return Expression_optimize(this, result, keepLvalue); } // Entry point for CTFE. // A compile-time result is required. Give an error if not possible final Expression ctfeInterpret() { return .ctfeInterpret(this); } final int isConst() { return .isConst(this); } /****** * Identical, not just equal. I.e. NaNs with different bit patterns are not identical */ bool isIdentical(const Expression e) const { return equals(e); } /// Statically evaluate this expression to a `bool` if possible /// Returns: an optional thath either contains the value or is empty Optional!bool toBool() { return typeof(return)(); } bool hasCode() { return true; } final pure inout nothrow @nogc @safe { inout(IntegerExp) isIntegerExp() { return op == EXP.int64 ? cast(typeof(return))this : null; } inout(ErrorExp) isErrorExp() { return op == EXP.error ? cast(typeof(return))this : null; } inout(VoidInitExp) isVoidInitExp() { return op == EXP.void_ ? cast(typeof(return))this : null; } inout(RealExp) isRealExp() { return op == EXP.float64 ? cast(typeof(return))this : null; } inout(ComplexExp) isComplexExp() { return op == EXP.complex80 ? cast(typeof(return))this : null; } inout(IdentifierExp) isIdentifierExp() { return op == EXP.identifier ? cast(typeof(return))this : null; } inout(DollarExp) isDollarExp() { return op == EXP.dollar ? cast(typeof(return))this : null; } inout(DsymbolExp) isDsymbolExp() { return op == EXP.dSymbol ? cast(typeof(return))this : null; } inout(ThisExp) isThisExp() { return op == EXP.this_ ? cast(typeof(return))this : null; } inout(SuperExp) isSuperExp() { return op == EXP.super_ ? cast(typeof(return))this : null; } inout(NullExp) isNullExp() { return op == EXP.null_ ? cast(typeof(return))this : null; } inout(StringExp) isStringExp() { return op == EXP.string_ ? cast(typeof(return))this : null; } inout(TupleExp) isTupleExp() { return op == EXP.tuple ? cast(typeof(return))this : null; } inout(ArrayLiteralExp) isArrayLiteralExp() { return op == EXP.arrayLiteral ? cast(typeof(return))this : null; } inout(AssocArrayLiteralExp) isAssocArrayLiteralExp() { return op == EXP.assocArrayLiteral ? cast(typeof(return))this : null; } inout(StructLiteralExp) isStructLiteralExp() { return op == EXP.structLiteral ? cast(typeof(return))this : null; } inout(CompoundLiteralExp) isCompoundLiteralExp() { return op == EXP.compoundLiteral ? cast(typeof(return))this : null; } inout(TypeExp) isTypeExp() { return op == EXP.type ? cast(typeof(return))this : null; } inout(ScopeExp) isScopeExp() { return op == EXP.scope_ ? cast(typeof(return))this : null; } inout(TemplateExp) isTemplateExp() { return op == EXP.template_ ? cast(typeof(return))this : null; } inout(NewExp) isNewExp() { return op == EXP.new_ ? cast(typeof(return))this : null; } inout(NewAnonClassExp) isNewAnonClassExp() { return op == EXP.newAnonymousClass ? cast(typeof(return))this : null; } inout(SymOffExp) isSymOffExp() { return op == EXP.symbolOffset ? cast(typeof(return))this : null; } inout(VarExp) isVarExp() { return op == EXP.variable ? cast(typeof(return))this : null; } inout(OverExp) isOverExp() { return op == EXP.overloadSet ? cast(typeof(return))this : null; } inout(FuncExp) isFuncExp() { return op == EXP.function_ ? cast(typeof(return))this : null; } inout(DeclarationExp) isDeclarationExp() { return op == EXP.declaration ? cast(typeof(return))this : null; } inout(TypeidExp) isTypeidExp() { return op == EXP.typeid_ ? cast(typeof(return))this : null; } inout(TraitsExp) isTraitsExp() { return op == EXP.traits ? cast(typeof(return))this : null; } inout(HaltExp) isHaltExp() { return op == EXP.halt ? cast(typeof(return))this : null; } inout(IsExp) isExp() { return op == EXP.is_ ? cast(typeof(return))this : null; } inout(MixinExp) isMixinExp() { return op == EXP.mixin_ ? cast(typeof(return))this : null; } inout(ImportExp) isImportExp() { return op == EXP.import_ ? cast(typeof(return))this : null; } inout(AssertExp) isAssertExp() { return op == EXP.assert_ ? cast(typeof(return))this : null; } inout(ThrowExp) isThrowExp() { return op == EXP.throw_ ? cast(typeof(return))this : null; } inout(DotIdExp) isDotIdExp() { return op == EXP.dotIdentifier ? cast(typeof(return))this : null; } inout(DotTemplateExp) isDotTemplateExp() { return op == EXP.dotTemplateDeclaration ? cast(typeof(return))this : null; } inout(DotVarExp) isDotVarExp() { return op == EXP.dotVariable ? cast(typeof(return))this : null; } inout(DotTemplateInstanceExp) isDotTemplateInstanceExp() { return op == EXP.dotTemplateInstance ? cast(typeof(return))this : null; } inout(DelegateExp) isDelegateExp() { return op == EXP.delegate_ ? cast(typeof(return))this : null; } inout(DotTypeExp) isDotTypeExp() { return op == EXP.dotType ? cast(typeof(return))this : null; } inout(CallExp) isCallExp() { return op == EXP.call ? cast(typeof(return))this : null; } inout(AddrExp) isAddrExp() { return op == EXP.address ? cast(typeof(return))this : null; } inout(PtrExp) isPtrExp() { return op == EXP.star ? cast(typeof(return))this : null; } inout(NegExp) isNegExp() { return op == EXP.negate ? cast(typeof(return))this : null; } inout(UAddExp) isUAddExp() { return op == EXP.uadd ? cast(typeof(return))this : null; } inout(ComExp) isComExp() { return op == EXP.tilde ? cast(typeof(return))this : null; } inout(NotExp) isNotExp() { return op == EXP.not ? cast(typeof(return))this : null; } inout(DeleteExp) isDeleteExp() { return op == EXP.delete_ ? cast(typeof(return))this : null; } inout(CastExp) isCastExp() { return op == EXP.cast_ ? cast(typeof(return))this : null; } inout(VectorExp) isVectorExp() { return op == EXP.vector ? cast(typeof(return))this : null; } inout(VectorArrayExp) isVectorArrayExp() { return op == EXP.vectorArray ? cast(typeof(return))this : null; } inout(SliceExp) isSliceExp() { return op == EXP.slice ? cast(typeof(return))this : null; } inout(ArrayLengthExp) isArrayLengthExp() { return op == EXP.arrayLength ? cast(typeof(return))this : null; } inout(ArrayExp) isArrayExp() { return op == EXP.array ? cast(typeof(return))this : null; } inout(DotExp) isDotExp() { return op == EXP.dot ? cast(typeof(return))this : null; } inout(CommaExp) isCommaExp() { return op == EXP.comma ? cast(typeof(return))this : null; } inout(IntervalExp) isIntervalExp() { return op == EXP.interval ? cast(typeof(return))this : null; } inout(DelegatePtrExp) isDelegatePtrExp() { return op == EXP.delegatePointer ? cast(typeof(return))this : null; } inout(DelegateFuncptrExp) isDelegateFuncptrExp() { return op == EXP.delegateFunctionPointer ? cast(typeof(return))this : null; } inout(IndexExp) isIndexExp() { return op == EXP.index ? cast(typeof(return))this : null; } inout(PostExp) isPostExp() { return (op == EXP.plusPlus || op == EXP.minusMinus) ? cast(typeof(return))this : null; } inout(PreExp) isPreExp() { return (op == EXP.prePlusPlus || op == EXP.preMinusMinus) ? cast(typeof(return))this : null; } inout(AssignExp) isAssignExp() { return op == EXP.assign ? cast(typeof(return))this : null; } inout(LoweredAssignExp) isLoweredAssignExp() { return op == EXP.loweredAssignExp ? cast(typeof(return))this : null; } inout(ConstructExp) isConstructExp() { return op == EXP.construct ? cast(typeof(return))this : null; } inout(BlitExp) isBlitExp() { return op == EXP.blit ? cast(typeof(return))this : null; } inout(AddAssignExp) isAddAssignExp() { return op == EXP.addAssign ? cast(typeof(return))this : null; } inout(MinAssignExp) isMinAssignExp() { return op == EXP.minAssign ? cast(typeof(return))this : null; } inout(MulAssignExp) isMulAssignExp() { return op == EXP.mulAssign ? cast(typeof(return))this : null; } inout(DivAssignExp) isDivAssignExp() { return op == EXP.divAssign ? cast(typeof(return))this : null; } inout(ModAssignExp) isModAssignExp() { return op == EXP.modAssign ? cast(typeof(return))this : null; } inout(AndAssignExp) isAndAssignExp() { return op == EXP.andAssign ? cast(typeof(return))this : null; } inout(OrAssignExp) isOrAssignExp() { return op == EXP.orAssign ? cast(typeof(return))this : null; } inout(XorAssignExp) isXorAssignExp() { return op == EXP.xorAssign ? cast(typeof(return))this : null; } inout(PowAssignExp) isPowAssignExp() { return op == EXP.powAssign ? cast(typeof(return))this : null; } inout(ShlAssignExp) isShlAssignExp() { return op == EXP.leftShiftAssign ? cast(typeof(return))this : null; } inout(ShrAssignExp) isShrAssignExp() { return op == EXP.rightShiftAssign ? cast(typeof(return))this : null; } inout(UshrAssignExp) isUshrAssignExp() { return op == EXP.unsignedRightShiftAssign ? cast(typeof(return))this : null; } inout(CatAssignExp) isCatAssignExp() { return op == EXP.concatenateAssign ? cast(typeof(return))this : null; } inout(CatElemAssignExp) isCatElemAssignExp() { return op == EXP.concatenateElemAssign ? cast(typeof(return))this : null; } inout(CatDcharAssignExp) isCatDcharAssignExp() { return op == EXP.concatenateDcharAssign ? cast(typeof(return))this : null; } inout(AddExp) isAddExp() { return op == EXP.add ? cast(typeof(return))this : null; } inout(MinExp) isMinExp() { return op == EXP.min ? cast(typeof(return))this : null; } inout(CatExp) isCatExp() { return op == EXP.concatenate ? cast(typeof(return))this : null; } inout(MulExp) isMulExp() { return op == EXP.mul ? cast(typeof(return))this : null; } inout(DivExp) isDivExp() { return op == EXP.div ? cast(typeof(return))this : null; } inout(ModExp) isModExp() { return op == EXP.mod ? cast(typeof(return))this : null; } inout(PowExp) isPowExp() { return op == EXP.pow ? cast(typeof(return))this : null; } inout(ShlExp) isShlExp() { return op == EXP.leftShift ? cast(typeof(return))this : null; } inout(ShrExp) isShrExp() { return op == EXP.rightShift ? cast(typeof(return))this : null; } inout(UshrExp) isUshrExp() { return op == EXP.unsignedRightShift ? cast(typeof(return))this : null; } inout(AndExp) isAndExp() { return op == EXP.and ? cast(typeof(return))this : null; } inout(OrExp) isOrExp() { return op == EXP.or ? cast(typeof(return))this : null; } inout(XorExp) isXorExp() { return op == EXP.xor ? cast(typeof(return))this : null; } inout(LogicalExp) isLogicalExp() { return (op == EXP.andAnd || op == EXP.orOr) ? cast(typeof(return))this : null; } //inout(CmpExp) isCmpExp() { return op == EXP. ? cast(typeof(return))this : null; } inout(InExp) isInExp() { return op == EXP.in_ ? cast(typeof(return))this : null; } inout(RemoveExp) isRemoveExp() { return op == EXP.remove ? cast(typeof(return))this : null; } inout(EqualExp) isEqualExp() { return (op == EXP.equal || op == EXP.notEqual) ? cast(typeof(return))this : null; } inout(IdentityExp) isIdentityExp() { return (op == EXP.identity || op == EXP.notIdentity) ? cast(typeof(return))this : null; } inout(CondExp) isCondExp() { return op == EXP.question ? cast(typeof(return))this : null; } inout(GenericExp) isGenericExp() { return op == EXP._Generic ? cast(typeof(return))this : null; } inout(DefaultInitExp) isDefaultInitExp() { return isDefaultInitOp(op) ? cast(typeof(return))this: null; } inout(FileInitExp) isFileInitExp() { return (op == EXP.file || op == EXP.fileFullPath) ? cast(typeof(return))this : null; } inout(LineInitExp) isLineInitExp() { return op == EXP.line ? cast(typeof(return))this : null; } inout(ModuleInitExp) isModuleInitExp() { return op == EXP.moduleString ? cast(typeof(return))this : null; } inout(FuncInitExp) isFuncInitExp() { return op == EXP.functionString ? cast(typeof(return))this : null; } inout(PrettyFuncInitExp) isPrettyFuncInitExp() { return op == EXP.prettyFunction ? cast(typeof(return))this : null; } inout(ObjcClassReferenceExp) isObjcClassReferenceExp() { return op == EXP.objcClassReference ? cast(typeof(return))this : null; } inout(ClassReferenceExp) isClassReferenceExp() { return op == EXP.classReference ? cast(typeof(return))this : null; } inout(ThrownExceptionExp) isThrownExceptionExp() { return op == EXP.thrownException ? cast(typeof(return))this : null; } inout(UnaExp) isUnaExp() pure inout nothrow @nogc { return exptab[op] & EXPFLAGS.unary ? cast(typeof(return))this : null; } inout(BinExp) isBinExp() pure inout nothrow @nogc { return exptab[op] & EXPFLAGS.binary ? cast(typeof(return))this : null; } inout(BinAssignExp) isBinAssignExp() pure inout nothrow @nogc { return exptab[op] & EXPFLAGS.binaryAssign ? cast(typeof(return))this : null; } } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A compile-time known integer value */ extern (C++) final class IntegerExp : Expression { private dinteger_t value; extern (D) this(const ref Loc loc, dinteger_t value, Type type) { super(loc, EXP.int64); //printf("IntegerExp(value = %lld, type = '%s')\n", value, type ? type.toChars() : ""); assert(type); if (!type.isscalar()) { //printf("%s, loc = %d\n", toChars(), loc.linnum); if (type.ty != Terror) error("integral constant must be scalar type, not `%s`", type.toChars()); type = Type.terror; } this.type = type; this.value = normalize(type.toBasetype().ty, value); } extern (D) this(dinteger_t value) { super(Loc.initial, EXP.int64); this.type = Type.tint32; this.value = cast(int)value; } static IntegerExp create(const ref Loc loc, dinteger_t value, Type type) { return new IntegerExp(loc, value, type); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, const ref Loc loc, dinteger_t value, Type type) { emplaceExp!(IntegerExp)(pue, loc, value, type); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = (cast(Expression)o).isIntegerExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && value == ne.value) { return true; } } return false; } override dinteger_t toInteger() { // normalize() is necessary until we fix all the paints of 'type' return value = normalize(type.toBasetype().ty, value); } override real_t toReal() { // normalize() is necessary until we fix all the paints of 'type' const ty = type.toBasetype().ty; const val = normalize(ty, value); value = val; return (ty == Tuns64) ? real_t(cast(ulong)val) : real_t(cast(long)val); } override real_t toImaginary() { return CTFloat.zero; } override complex_t toComplex() { return complex_t(toReal()); } override Optional!bool toBool() { bool r = toInteger() != 0; return typeof(return)(r); } override Expression toLvalue(Scope* sc, Expression e) { if (!e) e = this; else if (!loc.isValid()) loc = e.loc; e.error("cannot modify constant `%s`", e.toChars()); return ErrorExp.get(); } override void accept(Visitor v) { v.visit(this); } dinteger_t getInteger() { return value; } void setInteger(dinteger_t value) { this.value = normalize(type.toBasetype().ty, value); } extern (D) static dinteger_t normalize(TY ty, dinteger_t value) { /* 'Normalize' the value of the integer to be in range of the type */ dinteger_t result; switch (ty) { case Tbool: result = (value != 0); break; case Tint8: result = cast(byte)value; break; case Tchar: case Tuns8: result = cast(ubyte)value; break; case Tint16: result = cast(short)value; break; case Twchar: case Tuns16: result = cast(ushort)value; break; case Tint32: result = cast(int)value; break; case Tdchar: case Tuns32: result = cast(uint)value; break; case Tint64: result = cast(long)value; break; case Tuns64: result = cast(ulong)value; break; case Tpointer: if (target.ptrsize == 8) goto case Tuns64; if (target.ptrsize == 4) goto case Tuns32; if (target.ptrsize == 2) goto case Tuns16; assert(0); default: break; } return result; } override IntegerExp syntaxCopy() { return this; } /** * Use this instead of creating new instances for commonly used literals * such as 0 or 1. * * Parameters: * v = The value of the expression * Returns: * A static instance of the expression, typed as `Tint32`. */ static IntegerExp literal(int v)() { __gshared IntegerExp theConstant; if (!theConstant) theConstant = new IntegerExp(v); return theConstant; } /** * Use this instead of creating new instances for commonly used bools. * * Parameters: * b = The value of the expression * Returns: * A static instance of the expression, typed as `Type.tbool`. */ static IntegerExp createBool(bool b) { __gshared IntegerExp trueExp, falseExp; if (!trueExp) { trueExp = new IntegerExp(Loc.initial, 1, Type.tbool); falseExp = new IntegerExp(Loc.initial, 0, Type.tbool); } return b ? trueExp : falseExp; } } /*********************************************************** * Use this expression for error recovery. * * It should behave as a 'sink' to prevent further cascaded error messages. */ extern (C++) final class ErrorExp : Expression { private extern (D) this() { super(Loc.initial, EXP.error); type = Type.terror; } static ErrorExp get () { if (errorexp is null) errorexp = new ErrorExp(); if (global.errors == 0 && global.gaggedErrors == 0) { /* Unfortunately, errors can still leak out of gagged errors, * and we need to set the error count to prevent bogus code * generation. At least give a message. */ .error(Loc.initial, "unknown, please file report on issues.dlang.org"); } return errorexp; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } extern (C++) __gshared ErrorExp errorexp; // handy shared value } /*********************************************************** * An uninitialized value, * generated from void initializers. * * https://dlang.org/spec/declaration.html#void_init */ extern (C++) final class VoidInitExp : Expression { VarDeclaration var; /// the variable from where the void value came from, null if not known /// Useful for error messages extern (D) this(VarDeclaration var) { super(var.loc, EXP.void_); this.var = var; this.type = var.type; } override const(char)* toChars() const { return "void"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A compile-time known floating point number */ extern (C++) final class RealExp : Expression { real_t value; extern (D) this(const ref Loc loc, real_t value, Type type) { super(loc, EXP.float64); //printf("RealExp::RealExp(%Lg)\n", value); this.value = value; this.type = type; } static RealExp create(const ref Loc loc, real_t value, Type type) { return new RealExp(loc, value, type); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, const ref Loc loc, real_t value, Type type) { emplaceExp!(RealExp)(pue, loc, value, type); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = (cast(Expression)o).isRealExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && RealIdentical(value, ne.value)) { return true; } } return false; } override bool isIdentical(const Expression e) const { if (!equals(e)) return false; return CTFloat.isIdentical(value, e.isRealExp().value); } override dinteger_t toInteger() { return cast(sinteger_t)toReal(); } override uinteger_t toUInteger() { return cast(uinteger_t)toReal(); } override real_t toReal() { return type.isreal() ? value : CTFloat.zero; } override real_t toImaginary() { return type.isreal() ? CTFloat.zero : value; } override complex_t toComplex() { return complex_t(toReal(), toImaginary()); } override Optional!bool toBool() { return typeof(return)(!!value); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A compile-time complex number (deprecated) */ extern (C++) final class ComplexExp : Expression { complex_t value; extern (D) this(const ref Loc loc, complex_t value, Type type) { super(loc, EXP.complex80); this.value = value; this.type = type; //printf("ComplexExp::ComplexExp(%s)\n", toChars()); } static ComplexExp create(const ref Loc loc, complex_t value, Type type) { return new ComplexExp(loc, value, type); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, const ref Loc loc, complex_t value, Type type) { emplaceExp!(ComplexExp)(pue, loc, value, type); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = (cast(Expression)o).isComplexExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && RealIdentical(creall(value), creall(ne.value)) && RealIdentical(cimagl(value), cimagl(ne.value))) { return true; } } return false; } override bool isIdentical(const Expression e) const { if (!equals(e)) return false; // equals() regards different NaN values as 'equals' auto c = e.isComplexExp(); return CTFloat.isIdentical(creall(value), creall(c.value)) && CTFloat.isIdentical(cimagl(value), cimagl(c.value)); } override dinteger_t toInteger() { return cast(sinteger_t)toReal(); } override uinteger_t toUInteger() { return cast(uinteger_t)toReal(); } override real_t toReal() { return creall(value); } override real_t toImaginary() { return cimagl(value); } override complex_t toComplex() { return value; } override Optional!bool toBool() { return typeof(return)(!!value); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * An identifier in the context of an expression (as opposed to a declaration) * * --- * int x; // VarDeclaration with Identifier * x++; // PostExp with IdentifierExp * --- */ extern (C++) class IdentifierExp : Expression { Identifier ident; bool parens; // if it appears as (identifier) extern (D) this(const ref Loc loc, Identifier ident) scope { super(loc, EXP.identifier); this.ident = ident; } static IdentifierExp create(const ref Loc loc, Identifier ident) { return new IdentifierExp(loc, ident); } override final bool isLvalue() { return true; } override final Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The dollar operator used when indexing or slicing an array. E.g `a[$]`, `a[1 .. $]` etc. * * https://dlang.org/spec/arrays.html#array-length */ extern (C++) final class DollarExp : IdentifierExp { extern (D) this(const ref Loc loc) { super(loc, Id.dollar); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Won't be generated by parser. */ extern (C++) final class DsymbolExp : Expression { Dsymbol s; bool hasOverloads; extern (D) this(const ref Loc loc, Dsymbol s, bool hasOverloads = true) { super(loc, EXP.dSymbol); this.s = s; this.hasOverloads = hasOverloads; } override bool isLvalue() { return true; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/expression.html#this */ extern (C++) class ThisExp : Expression { VarDeclaration var; extern (D) this(const ref Loc loc) { super(loc, EXP.this_); //printf("ThisExp::ThisExp() loc = %d\n", loc.linnum); } this(const ref Loc loc, const EXP tok) { super(loc, tok); //printf("ThisExp::ThisExp() loc = %d\n", loc.linnum); } override ThisExp syntaxCopy() { auto r = cast(ThisExp) super.syntaxCopy(); // require new semantic (possibly new `var` etc.) r.type = null; r.var = null; return r; } override Optional!bool toBool() { // `this` is never null (what about structs?) return typeof(return)(true); } override final bool isLvalue() { // Class `this` should be an rvalue; struct `this` should be an lvalue. return type.toBasetype().ty != Tclass; } override final Expression toLvalue(Scope* sc, Expression e) { if (type.toBasetype().ty == Tclass) { // Class `this` is an rvalue; struct `this` is an lvalue. return Expression.toLvalue(sc, e); } return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/expression.html#super */ extern (C++) final class SuperExp : ThisExp { extern (D) this(const ref Loc loc) { super(loc, EXP.super_); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A compile-time known `null` value * * https://dlang.org/spec/expression.html#null */ extern (C++) final class NullExp : Expression { extern (D) this(const ref Loc loc, Type type = null) scope { super(loc, EXP.null_); this.type = type; } override bool equals(const RootObject o) const { if (auto e = o.isExpression()) { if (e.op == EXP.null_ && type.equals(e.type)) { return true; } } return false; } override Optional!bool toBool() { // null in any type is false return typeof(return)(false); } override StringExp toStringExp() { if (implicitConvTo(Type.tstring)) { auto se = new StringExp(loc, (cast(char*)mem.xcalloc(1, 1))[0 .. 0]); se.type = Type.tstring; return se; } return null; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/expression.html#string_literals */ extern (C++) final class StringExp : Expression { char postfix = NoPostfix; // 'c', 'w', 'd' OwnedBy ownedByCtfe = OwnedBy.code; private union { char* string; // if sz == 1 wchar* wstring; // if sz == 2 dchar* dstring; // if sz == 4 } // (const if ownedByCtfe == OwnedBy.code) size_t len; // number of code units ubyte sz = 1; // 1: char, 2: wchar, 4: dchar /** * Whether the string literal's type is fixed * Example: * --- * wstring x = "abc"; // OK, string literal is flexible * wstring y = cast(string) "abc"; // Error: type was committed after cast * --- */ bool committed; enum char NoPostfix = 0; extern (D) this(const ref Loc loc, const(void)[] string) scope { super(loc, EXP.string_); this.string = cast(char*)string.ptr; // note that this.string should be const this.len = string.length; this.sz = 1; // work around LDC bug #1286 } extern (D) this(const ref Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix = NoPostfix) scope { super(loc, EXP.string_); this.string = cast(char*)string.ptr; // note that this.string should be const this.len = len; this.sz = sz; this.postfix = postfix; } static StringExp create(const ref Loc loc, const(char)* s) { return new StringExp(loc, s.toDString()); } static StringExp create(const ref Loc loc, const(void)* string, size_t len) { return new StringExp(loc, string[0 .. len]); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, const ref Loc loc, const(char)* s) { emplaceExp!(StringExp)(pue, loc, s.toDString()); } extern (D) static void emplace(UnionExp* pue, const ref Loc loc, const(void)[] string) { emplaceExp!(StringExp)(pue, loc, string); } extern (D) static void emplace(UnionExp* pue, const ref Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix) { emplaceExp!(StringExp)(pue, loc, string, len, sz, postfix); } override bool equals(const RootObject o) const { //printf("StringExp::equals('%s') %s\n", o.toChars(), toChars()); if (auto e = o.isExpression()) { if (auto se = e.isStringExp()) { return compare(se) == 0; } } return false; } /********************************** * Return the number of code units the string would be if it were re-encoded * as tynto. * Params: * tynto = code unit type of the target encoding * Returns: * number of code units */ size_t numberOfCodeUnits(int tynto = 0) const { int encSize; switch (tynto) { case 0: return len; case Tchar: encSize = 1; break; case Twchar: encSize = 2; break; case Tdchar: encSize = 4; break; default: assert(0); } if (sz == encSize) return len; size_t result = 0; dchar c; switch (sz) { case 1: for (size_t u = 0; u < len;) { if (const s = utf_decodeChar(string[0 .. len], u, c)) { error("%.*s", cast(int)s.length, s.ptr); return 0; } result += utf_codeLength(encSize, c); } break; case 2: for (size_t u = 0; u < len;) { if (const s = utf_decodeWchar(wstring[0 .. len], u, c)) { error("%.*s", cast(int)s.length, s.ptr); return 0; } result += utf_codeLength(encSize, c); } break; case 4: foreach (u; 0 .. len) { result += utf_codeLength(encSize, dstring[u]); } break; default: assert(0); } return result; } /********************************************** * Write the contents of the string to dest. * Use numberOfCodeUnits() to determine size of result. * Params: * dest = destination * tyto = encoding type of the result * zero = add terminating 0 */ void writeTo(void* dest, bool zero, int tyto = 0) const { int encSize; switch (tyto) { case 0: encSize = sz; break; case Tchar: encSize = 1; break; case Twchar: encSize = 2; break; case Tdchar: encSize = 4; break; default: assert(0); } if (sz == encSize) { memcpy(dest, string, len * sz); if (zero) memset(dest + len * sz, 0, sz); } else assert(0); } /********************************************* * Get the code unit at index i * Params: * i = index * Returns: * code unit at index i */ dchar getCodeUnit(size_t i) const pure { assert(i < len); final switch (sz) { case 1: return string[i]; case 2: return wstring[i]; case 4: return dstring[i]; } } /********************************************* * Set the code unit at index i to c * Params: * i = index * c = code unit to set it to */ void setCodeUnit(size_t i, dchar c) { assert(i < len); final switch (sz) { case 1: string[i] = cast(char)c; break; case 2: wstring[i] = cast(wchar)c; break; case 4: dstring[i] = c; break; } } override StringExp toStringExp() { return this; } /**************************************** * Convert string to char[]. */ StringExp toUTF8(Scope* sc) { if (sz != 1) { // Convert to UTF-8 string committed = false; Expression e = castTo(sc, Type.tchar.arrayOf()); e = e.optimize(WANTvalue); auto se = e.isStringExp(); assert(se.sz == 1); return se; } return this; } /** * Compare two `StringExp` by length, then value * * The comparison is not the usual C-style comparison as seen with * `strcmp` or `memcmp`, but instead first compare based on the length. * This allows both faster lookup and sorting when comparing sparse data. * * This ordering scheme is relied on by the string-switching feature. * Code in Druntime's `core.internal.switch_` relies on this ordering * when doing a binary search among case statements. * * Both `StringExp` should be of the same encoding. * * Params: * se2 = String expression to compare `this` to * * Returns: * `0` when `this` is equal to se2, a value greater than `0` if * `this` should be considered greater than `se2`, * and a value less than `0` if `this` is lesser than `se2`. */ int compare(const StringExp se2) const nothrow pure @nogc { //printf("StringExp::compare()\n"); const len1 = len; const len2 = se2.len; assert(this.sz == se2.sz, "Comparing string expressions of different sizes"); //printf("sz = %d, len1 = %d, len2 = %d\n", sz, cast(int)len1, cast(int)len2); if (len1 == len2) { switch (sz) { case 1: return memcmp(string, se2.string, len1); case 2: { wchar* s1 = cast(wchar*)string; wchar* s2 = cast(wchar*)se2.string; foreach (u; 0 .. len) { if (s1[u] != s2[u]) return s1[u] - s2[u]; } } break; case 4: { dchar* s1 = cast(dchar*)string; dchar* s2 = cast(dchar*)se2.string; foreach (u; 0 .. len) { if (s1[u] != s2[u]) return s1[u] - s2[u]; } } break; default: assert(0); } } return cast(int)(len1 - len2); } override Optional!bool toBool() { // Keep the old behaviour for this refactoring // Should probably match language spec instead and check for length return typeof(return)(true); } override bool isLvalue() { /* string literal is rvalue in default, but * conversion to reference of static array is only allowed. */ return (type && type.toBasetype().ty == Tsarray); } override Expression toLvalue(Scope* sc, Expression e) { //printf("StringExp::toLvalue(%s) type = %s\n", toChars(), type ? type.toChars() : NULL); return (type && type.toBasetype().ty == Tsarray) ? this : Expression.toLvalue(sc, e); } override Expression modifiableLvalue(Scope* sc, Expression e) { error("cannot modify string literal `%s`", toChars()); return ErrorExp.get(); } /******************************** * Convert string contents to a 0 terminated string, * allocated by mem.xmalloc(). */ extern (D) const(char)[] toStringz() const { auto nbytes = len * sz; char* s = cast(char*)mem.xmalloc(nbytes + sz); writeTo(s, true); return s[0 .. nbytes]; } extern (D) const(char)[] peekString() const { assert(sz == 1); return this.string[0 .. len]; } extern (D) const(wchar)[] peekWstring() const { assert(sz == 2); return this.wstring[0 .. len]; } extern (D) const(dchar)[] peekDstring() const { assert(sz == 4); return this.dstring[0 .. len]; } /******************* * Get a slice of the data. */ extern (D) const(ubyte)[] peekData() const { return cast(const(ubyte)[])this.string[0 .. len * sz]; } /******************* * Borrow a slice of the data, so the caller can modify * it in-place (!) */ extern (D) ubyte[] borrowData() { return cast(ubyte[])this.string[0 .. len * sz]; } /*********************** * Set new string data. * `this` becomes the new owner of the data. */ extern (D) void setData(void* s, size_t len, ubyte sz) { this.string = cast(char*)s; this.len = len; this.sz = sz; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A sequence of expressions * * --- * alias AliasSeq(T...) = T; * alias Tup = AliasSeq!(3, int, "abc"); * --- */ extern (C++) final class TupleExp : Expression { /* Tuple-field access may need to take out its side effect part. * For example: * foo().tupleof * is rewritten as: * (ref __tup = foo(); tuple(__tup.field0, __tup.field1, ...)) * The declaration of temporary variable __tup will be stored in TupleExp.e0. */ Expression e0; Expressions* exps; extern (D) this(const ref Loc loc, Expression e0, Expressions* exps) { super(loc, EXP.tuple); //printf("TupleExp(this = %p)\n", this); this.e0 = e0; this.exps = exps; } extern (D) this(const ref Loc loc, Expressions* exps) { super(loc, EXP.tuple); //printf("TupleExp(this = %p)\n", this); this.exps = exps; } extern (D) this(const ref Loc loc, TupleDeclaration tup) { super(loc, EXP.tuple); this.exps = new Expressions(); this.exps.reserve(tup.objects.length); foreach (o; *tup.objects) { if (Dsymbol s = getDsymbol(o)) { /* If tuple element represents a symbol, translate to DsymbolExp * to supply implicit 'this' if needed later. */ Expression e = new DsymbolExp(loc, s); this.exps.push(e); } else if (auto eo = o.isExpression()) { auto e = eo.copy(); e.loc = loc; // https://issues.dlang.org/show_bug.cgi?id=15669 this.exps.push(e); } else if (auto t = o.isType()) { Expression e = new TypeExp(loc, t); this.exps.push(e); } else { error("`%s` is not an expression", o.toChars()); } } } static TupleExp create(const ref Loc loc, Expressions* exps) { return new TupleExp(loc, exps); } override TupleExp syntaxCopy() { return new TupleExp(loc, e0 ? e0.syntaxCopy() : null, arraySyntaxCopy(exps)); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto e = o.isExpression()) if (auto te = e.isTupleExp()) { if (exps.length != te.exps.length) return false; if (e0 && !e0.equals(te.e0) || !e0 && te.e0) return false; foreach (i, e1; *exps) { auto e2 = (*te.exps)[i]; if (!e1.equals(e2)) return false; } return true; } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * [ e1, e2, e3, ... ] * * https://dlang.org/spec/expression.html#array_literals */ extern (C++) final class ArrayLiteralExp : Expression { OwnedBy ownedByCtfe = OwnedBy.code; bool onstack = false; /** If !is null, elements[] can be sparse and basis is used for the * "default" element value. In other words, non-null elements[i] overrides * this 'basis' value. */ Expression basis; Expressions* elements; extern (D) this(const ref Loc loc, Type type, Expressions* elements) { super(loc, EXP.arrayLiteral); this.type = type; this.elements = elements; } extern (D) this(const ref Loc loc, Type type, Expression e) { super(loc, EXP.arrayLiteral); this.type = type; elements = new Expressions(); elements.push(e); } extern (D) this(const ref Loc loc, Type type, Expression basis, Expressions* elements) { super(loc, EXP.arrayLiteral); this.type = type; this.basis = basis; this.elements = elements; } static ArrayLiteralExp create(const ref Loc loc, Expressions* elements) { return new ArrayLiteralExp(loc, null, elements); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, const ref Loc loc, Expressions* elements) { emplaceExp!(ArrayLiteralExp)(pue, loc, null, elements); } override ArrayLiteralExp syntaxCopy() { return new ArrayLiteralExp(loc, null, basis ? basis.syntaxCopy() : null, arraySyntaxCopy(elements)); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto ae = e.isArrayLiteralExp()) { if (elements.length != ae.elements.length) return false; if (elements.length == 0 && !type.equals(ae.type)) { return false; } foreach (i, e1; *elements) { auto e2 = (*ae.elements)[i]; auto e1x = e1 ? e1 : basis; auto e2x = e2 ? e2 : ae.basis; if (e1x != e2x && (!e1x || !e2x || !e1x.equals(e2x))) return false; } return true; } return false; } Expression getElement(size_t i) { return this[i]; } Expression opIndex(size_t i) { auto el = (*elements)[i]; return el ? el : basis; } override Optional!bool toBool() { size_t dim = elements ? elements.length : 0; return typeof(return)(dim != 0); } override StringExp toStringExp() { TY telem = type.nextOf().toBasetype().ty; if (telem.isSomeChar || (telem == Tvoid && (!elements || elements.length == 0))) { ubyte sz = 1; if (telem == Twchar) sz = 2; else if (telem == Tdchar) sz = 4; OutBuffer buf; if (elements) { foreach (i; 0 .. elements.length) { auto ch = this[i]; if (ch.op != EXP.int64) return null; if (sz == 1) buf.writeByte(cast(uint)ch.toInteger()); else if (sz == 2) buf.writeword(cast(uint)ch.toInteger()); else buf.write4(cast(uint)ch.toInteger()); } } char prefix; if (sz == 1) { prefix = 'c'; buf.writeByte(0); } else if (sz == 2) { prefix = 'w'; buf.writeword(0); } else { prefix = 'd'; buf.write4(0); } const size_t len = buf.length / sz - 1; auto se = new StringExp(loc, buf.extractSlice()[0 .. len * sz], len, sz, prefix); se.sz = sz; se.type = type; return se; } return null; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * [ key0 : value0, key1 : value1, ... ] * * https://dlang.org/spec/expression.html#associative_array_literals */ extern (C++) final class AssocArrayLiteralExp : Expression { OwnedBy ownedByCtfe = OwnedBy.code; Expressions* keys; Expressions* values; extern (D) this(const ref Loc loc, Expressions* keys, Expressions* values) { super(loc, EXP.assocArrayLiteral); assert(keys.length == values.length); this.keys = keys; this.values = values; } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto ae = e.isAssocArrayLiteralExp()) { if (keys.length != ae.keys.length) return false; size_t count = 0; foreach (i, key; *keys) { foreach (j, akey; *ae.keys) { if (key.equals(akey)) { if (!(*values)[i].equals((*ae.values)[j])) return false; ++count; } } } return count == keys.length; } return false; } override AssocArrayLiteralExp syntaxCopy() { return new AssocArrayLiteralExp(loc, arraySyntaxCopy(keys), arraySyntaxCopy(values)); } override Optional!bool toBool() { size_t dim = keys.length; return typeof(return)(dim != 0); } override void accept(Visitor v) { v.visit(this); } } enum stageScrub = 0x1; /// scrubReturnValue is running enum stageSearchPointers = 0x2; /// hasNonConstPointers is running enum stageOptimize = 0x4; /// optimize is running enum stageApply = 0x8; /// apply is running enum stageInlineScan = 0x10; /// inlineScan is running enum stageToCBuffer = 0x20; /// toCBuffer is running /*********************************************************** * sd( e1, e2, e3, ... ) */ extern (C++) final class StructLiteralExp : Expression { StructDeclaration sd; /// which aggregate this is for Expressions* elements; /// parallels sd.fields[] with null entries for fields to skip Type stype; /// final type of result (can be different from sd's type) // `inlineCopy` is only used temporarily in the `inline.d` pass, // while `sym` is only used in `e2ir/s2ir/tocsym` which comes after union { Symbol* sym; /// back end symbol to initialize with literal /// those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer. StructLiteralExp inlinecopy; } /** pointer to the origin instance of the expression. * once a new expression is created, origin is set to 'this'. * anytime when an expression copy is created, 'origin' pointer is set to * 'origin' pointer value of the original expression. */ StructLiteralExp origin; /** anytime when recursive function is calling, 'stageflags' marks with bit flag of * current stage and unmarks before return from this function. * 'inlinecopy' uses similar 'stageflags' and from multiple evaluation 'doInline' * (with infinite recursion) of this expression. */ ubyte stageflags; bool useStaticInit; /// if this is true, use the StructDeclaration's init symbol bool isOriginal = false; /// used when moving instances to indicate `this is this.origin` OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, StructDeclaration sd, Expressions* elements, Type stype = null) { super(loc, EXP.structLiteral); this.sd = sd; if (!elements) elements = new Expressions(); this.elements = elements; this.stype = stype; this.origin = this; //printf("StructLiteralExp::StructLiteralExp(%s)\n", toChars()); } static StructLiteralExp create(const ref Loc loc, StructDeclaration sd, void* elements, Type stype = null) { return new StructLiteralExp(loc, sd, cast(Expressions*)elements, stype); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto se = e.isStructLiteralExp()) { if (!type.equals(se.type)) return false; if (elements.length != se.elements.length) return false; foreach (i, e1; *elements) { auto e2 = (*se.elements)[i]; if (e1 != e2 && (!e1 || !e2 || !e1.equals(e2))) return false; } return true; } return false; } override StructLiteralExp syntaxCopy() { auto exp = new StructLiteralExp(loc, sd, arraySyntaxCopy(elements), type ? type : stype); exp.origin = this; return exp; } /************************************** * Gets expression at offset of type. * Returns NULL if not found. */ Expression getField(Type type, uint offset) { //printf("StructLiteralExp::getField(this = %s, type = %s, offset = %u)\n", // /*toChars()*/"", type.toChars(), offset); Expression e = null; int i = getFieldIndex(type, offset); if (i != -1) { //printf("\ti = %d\n", i); if (i >= sd.nonHiddenFields()) return null; assert(i < elements.length); e = (*elements)[i]; if (e) { //printf("e = %s, e.type = %s\n", e.toChars(), e.type.toChars()); /* If type is a static array, and e is an initializer for that array, * then the field initializer should be an array literal of e. */ auto tsa = type.isTypeSArray(); if (tsa && e.type.castMod(0) != type.castMod(0)) { const length = cast(size_t)tsa.dim.toInteger(); auto z = new Expressions(length); foreach (ref q; *z) q = e.copy(); e = new ArrayLiteralExp(loc, type, z); } else { e = e.copy(); e.type = type; } if (useStaticInit && e.type.needsNested()) if (auto se = e.isStructLiteralExp()) { se.useStaticInit = true; } } } return e; } /************************************ * Get index of field. * Returns -1 if not found. */ int getFieldIndex(Type type, uint offset) { /* Find which field offset is by looking at the field offsets */ if (elements.length) { const sz = type.size(); if (sz == SIZE_INVALID) return -1; foreach (i, v; sd.fields) { if (offset == v.offset && sz == v.type.size()) { /* context fields might not be filled. */ if (i >= sd.nonHiddenFields()) return cast(int)i; if (auto e = (*elements)[i]) { return cast(int)i; } break; } } } return -1; } override Expression addDtorHook(Scope* sc) { /* If struct requires a destructor, rewrite as: * (S tmp = S()),tmp * so that the destructor can be hung on tmp. */ if (sd.dtor && sc.func) { /* Make an identifier for the temporary of the form: * __sl%s%d, where %s is the struct name */ char[10] buf = void; const prefix = "__sl"; const ident = sd.ident.toString; const fullLen = prefix.length + ident.length; const len = fullLen < buf.length ? fullLen : buf.length; buf[0 .. prefix.length] = prefix; buf[prefix.length .. len] = ident[0 .. len - prefix.length]; auto tmp = copyToTemp(0, buf[0 .. len], this); Expression ae = new DeclarationExp(loc, tmp); Expression e = new CommaExp(loc, ae, new VarExp(loc, tmp)); e = e.expressionSemantic(sc); return e; } return this; } override Expression toLvalue(Scope* sc, Expression e) { if (sc.flags & SCOPE.Cfile) return this; // C struct literals are lvalues else return Expression.toLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * C11 6.5.2.5 * ( type-name ) { initializer-list } */ extern (C++) final class CompoundLiteralExp : Expression { Initializer initializer; /// initializer-list extern (D) this(const ref Loc loc, Type type_name, Initializer initializer) { super(loc, EXP.compoundLiteral); super.type = type_name; this.initializer = initializer; //printf("CompoundLiteralExp::CompoundLiteralExp(%s)\n", toChars()); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class TypeExp : Expression { bool parens; // if this is a parenthesized expression extern (D) this(const ref Loc loc, Type type) { super(loc, EXP.type); //printf("TypeExp::TypeExp(%s)\n", type.toChars()); this.type = type; } override TypeExp syntaxCopy() { return new TypeExp(loc, type.syntaxCopy()); } override bool checkType() { error("type `%s` is not an expression", toChars()); return true; } override bool checkValue() { error("type `%s` has no value", toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder of * Package, Module, Nspace, and TemplateInstance (including TemplateMixin) * * A template instance that requires IFTI: * foo!tiargs(fargs) // foo!tiargs * is left until CallExp::semantic() or resolveProperties() */ extern (C++) final class ScopeExp : Expression { ScopeDsymbol sds; extern (D) this(const ref Loc loc, ScopeDsymbol sds) { super(loc, EXP.scope_); //printf("ScopeExp::ScopeExp(sds = '%s')\n", sds.toChars()); //static int count; if (++count == 38) *(char*)0=0; this.sds = sds; assert(!sds.isTemplateDeclaration()); // instead, you should use TemplateExp } override ScopeExp syntaxCopy() { return new ScopeExp(loc, sds.syntaxCopy(null)); } override bool checkType() { if (sds.isPackage()) { error("%s `%s` has no type", sds.kind(), sds.toChars()); return true; } if (auto ti = sds.isTemplateInstance()) { //assert(ti.needsTypeInference(sc)); if (ti.tempdecl && ti.semantictiargsdone && ti.semanticRun == PASS.initial) { error("partial %s `%s` has no type", sds.kind(), toChars()); return true; } } return false; } override bool checkValue() { error("%s `%s` has no value", sds.kind(), sds.toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class TemplateExp : Expression { TemplateDeclaration td; FuncDeclaration fd; extern (D) this(const ref Loc loc, TemplateDeclaration td, FuncDeclaration fd = null) { super(loc, EXP.template_); //printf("TemplateExp(): %s\n", td.toChars()); this.td = td; this.fd = fd; } override bool isLvalue() { return fd !is null; } override Expression toLvalue(Scope* sc, Expression e) { if (!fd) return Expression.toLvalue(sc, e); assert(sc); return symbolToExp(fd, loc, sc, true); } override bool checkType() { error("%s `%s` has no type", td.kind(), toChars()); return true; } override bool checkValue() { error("%s `%s` has no value", td.kind(), toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * newtype(arguments) */ extern (C++) final class NewExp : Expression { Expression thisexp; // if !=null, 'this' for class being allocated Type newtype; Expressions* arguments; // Array of Expression's Identifiers* names; // Array of names corresponding to expressions Expression argprefix; // expression to be evaluated just before arguments[] CtorDeclaration member; // constructor function bool onstack; // allocate on stack bool thrownew; // this NewExp is the expression of a ThrowStatement Expression lowering; // lowered druntime hook: `_d_new{class,itemT}` /// Puts the `arguments` and `names` into an `ArgumentList` for easily passing them around. /// The fields are still separate for backwards compatibility extern (D) ArgumentList argumentList() { return ArgumentList(arguments, names); } extern (D) this(const ref Loc loc, Expression thisexp, Type newtype, Expressions* arguments, Identifiers* names = null) { super(loc, EXP.new_); this.thisexp = thisexp; this.newtype = newtype; this.arguments = arguments; this.names = names; } static NewExp create(const ref Loc loc, Expression thisexp, Type newtype, Expressions* arguments) { return new NewExp(loc, thisexp, newtype, arguments); } override NewExp syntaxCopy() { return new NewExp(loc, thisexp ? thisexp.syntaxCopy() : null, newtype.syntaxCopy(), arraySyntaxCopy(arguments), names ? names.copy() : null); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * class baseclasses { } (arguments) */ extern (C++) final class NewAnonClassExp : Expression { Expression thisexp; // if !=null, 'this' for class being allocated ClassDeclaration cd; // class being instantiated Expressions* arguments; // Array of Expression's to call class constructor extern (D) this(const ref Loc loc, Expression thisexp, ClassDeclaration cd, Expressions* arguments) { super(loc, EXP.newAnonymousClass); this.thisexp = thisexp; this.cd = cd; this.arguments = arguments; } override NewAnonClassExp syntaxCopy() { return new NewAnonClassExp(loc, thisexp ? thisexp.syntaxCopy() : null, cd.syntaxCopy(null), arraySyntaxCopy(arguments)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) class SymbolExp : Expression { Declaration var; Dsymbol originalScope; // original scope before inlining bool hasOverloads; extern (D) this(const ref Loc loc, EXP op, Declaration var, bool hasOverloads) { super(loc, op); assert(var); this.var = var; this.hasOverloads = hasOverloads; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Offset from symbol */ extern (C++) final class SymOffExp : SymbolExp { dinteger_t offset; extern (D) this(const ref Loc loc, Declaration var, dinteger_t offset, bool hasOverloads = true) { if (auto v = var.isVarDeclaration()) { // FIXME: This error report will never be handled anyone. // It should be done before the SymOffExp construction. if (v.needThis()) .error(loc, "need `this` for address of `%s`", v.toChars()); hasOverloads = false; } super(loc, EXP.symbolOffset, var, hasOverloads); this.offset = offset; } override Optional!bool toBool() { return typeof(return)(true); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Variable */ extern (C++) final class VarExp : SymbolExp { bool delegateWasExtracted; extern (D) this(const ref Loc loc, Declaration var, bool hasOverloads = true) { if (var.isVarDeclaration()) hasOverloads = false; super(loc, EXP.variable, var, hasOverloads); //printf("VarExp(this = %p, '%s', loc = %s)\n", this, var.toChars(), loc.toChars()); //if (strcmp(var.ident.toChars(), "func") == 0) assert(0); this.type = var.type; } static VarExp create(const ref Loc loc, Declaration var, bool hasOverloads = true) { return new VarExp(loc, var, hasOverloads); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = o.isExpression().isVarExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && var == ne.var) { return true; } } return false; } override bool isLvalue() { if (var.storage_class & (STC.lazy_ | STC.rvalue | STC.manifest)) return false; return true; } override Expression toLvalue(Scope* sc, Expression e) { if (var.storage_class & STC.manifest) { error("manifest constant `%s` cannot be modified", var.toChars()); return ErrorExp.get(); } if (var.storage_class & STC.lazy_ && !delegateWasExtracted) { error("lazy variable `%s` cannot be modified", var.toChars()); return ErrorExp.get(); } if (var.ident == Id.ctfe) { error("cannot modify compiler-generated variable `__ctfe`"); return ErrorExp.get(); } if (var.ident == Id.dollar) // https://issues.dlang.org/show_bug.cgi?id=13574 { error("cannot modify operator `$`"); return ErrorExp.get(); } return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { //printf("VarExp::modifiableLvalue('%s')\n", var.toChars()); if (var.storage_class & STC.manifest) { error("cannot modify manifest constant `%s`", toChars()); return ErrorExp.get(); } // See if this expression is a modifiable lvalue (i.e. not const) return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Overload Set */ extern (C++) final class OverExp : Expression { OverloadSet vars; extern (D) this(const ref Loc loc, OverloadSet s) { super(loc, EXP.overloadSet); //printf("OverExp(this = %p, '%s')\n", this, var.toChars()); vars = s; type = Type.tvoid; } override bool isLvalue() { return true; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Function/Delegate literal */ extern (C++) final class FuncExp : Expression { FuncLiteralDeclaration fd; TemplateDeclaration td; TOK tok; // TOK.reserved, TOK.delegate_, TOK.function_ extern (D) this(const ref Loc loc, Dsymbol s) { super(loc, EXP.function_); this.td = s.isTemplateDeclaration(); this.fd = s.isFuncLiteralDeclaration(); if (td) { assert(td.literal); assert(td.members && td.members.length == 1); fd = (*td.members)[0].isFuncLiteralDeclaration(); } tok = fd.tok; // save original kind of function/delegate/(infer) assert(fd.fbody); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto fe = e.isFuncExp()) { return fd == fe.fd; } return false; } extern (D) void genIdent(Scope* sc) { if (fd.ident == Id.empty) { const(char)[] s; if (fd.fes) s = "__foreachbody"; else if (fd.tok == TOK.reserved) s = "__lambda"; else if (fd.tok == TOK.delegate_) s = "__dgliteral"; else s = "__funcliteral"; DsymbolTable symtab; if (FuncDeclaration func = sc.parent.isFuncDeclaration()) { if (func.localsymtab is null) { // Inside template constraint, symtab is not set yet. // Initialize it lazily. func.localsymtab = new DsymbolTable(); } symtab = func.localsymtab; } else { ScopeDsymbol sds = sc.parent.isScopeDsymbol(); if (!sds.symtab) { // Inside template constraint, symtab may not be set yet. // Initialize it lazily. assert(sds.isTemplateInstance()); sds.symtab = new DsymbolTable(); } symtab = sds.symtab; } assert(symtab); Identifier id = Identifier.generateId(s, symtab.length() + 1); fd.ident = id; if (td) td.ident = id; symtab.insert(td ? cast(Dsymbol)td : cast(Dsymbol)fd); } } override FuncExp syntaxCopy() { if (td) return new FuncExp(loc, td.syntaxCopy(null)); else if (fd.semanticRun == PASS.initial) return new FuncExp(loc, fd.syntaxCopy(null)); else // https://issues.dlang.org/show_bug.cgi?id=13481 // Prevent multiple semantic analysis of lambda body. return new FuncExp(loc, fd); } extern (D) MATCH matchType(Type to, Scope* sc, FuncExp* presult, int flag = 0) { static MATCH cannotInfer(Expression e, Type to, int flag) { if (!flag) e.error("cannot infer parameter types from `%s`", to.toChars()); return MATCH.nomatch; } //printf("FuncExp::matchType('%s'), to=%s\n", type ? type.toChars() : "null", to.toChars()); if (presult) *presult = null; TypeFunction tof = null; if (to.ty == Tdelegate) { if (tok == TOK.function_) { if (!flag) error("cannot match function literal to delegate type `%s`", to.toChars()); return MATCH.nomatch; } tof = cast(TypeFunction)to.nextOf(); } else if (to.ty == Tpointer && (tof = to.nextOf().isTypeFunction()) !is null) { if (tok == TOK.delegate_) { if (!flag) error("cannot match delegate literal to function pointer type `%s`", to.toChars()); return MATCH.nomatch; } } if (td) { if (!tof) { return cannotInfer(this, to, flag); } // Parameter types inference from 'tof' assert(td._scope); TypeFunction tf = fd.type.isTypeFunction(); //printf("\ttof = %s\n", tof.toChars()); //printf("\ttf = %s\n", tf.toChars()); const dim = tf.parameterList.length; if (tof.parameterList.length != dim || tof.parameterList.varargs != tf.parameterList.varargs) return cannotInfer(this, to, flag); auto tiargs = new Objects(); tiargs.reserve(td.parameters.length); foreach (tp; *td.parameters) { size_t u = 0; foreach (i, p; tf.parameterList) { if (auto ti = p.type.isTypeIdentifier()) if (ti && ti.ident == tp.ident) break; ++u; } assert(u < dim); Parameter pto = tof.parameterList[u]; Type t = pto.type; if (t.ty == Terror) return cannotInfer(this, to, flag); tf.parameterList[u].storageClass = tof.parameterList[u].storageClass; tiargs.push(t); } // Set target of return type inference if (!tf.next && tof.next) fd.treq = to; auto ti = new TemplateInstance(loc, td, tiargs); Expression ex = (new ScopeExp(loc, ti)).expressionSemantic(td._scope); // Reset inference target for the later re-semantic fd.treq = null; if (ex.op == EXP.error) return MATCH.nomatch; if (auto ef = ex.isFuncExp()) return ef.matchType(to, sc, presult, flag); else return cannotInfer(this, to, flag); } if (!tof || !tof.next) return MATCH.nomatch; assert(type && type != Type.tvoid); if (fd.type.ty == Terror) return MATCH.nomatch; auto tfx = fd.type.isTypeFunction(); bool convertMatch = (type.ty != to.ty); if (fd.inferRetType && tfx.next.implicitConvTo(tof.next) == MATCH.convert) { /* If return type is inferred and covariant return, * tweak return statements to required return type. * * interface I {} * class C : Object, I{} * * I delegate() dg = delegate() { return new class C(); } */ convertMatch = true; auto tfy = new TypeFunction(tfx.parameterList, tof.next, tfx.linkage, STC.undefined_); tfy.mod = tfx.mod; tfy.trust = tfx.trust; tfy.isnothrow = tfx.isnothrow; tfy.isnogc = tfx.isnogc; tfy.purity = tfx.purity; tfy.isproperty = tfx.isproperty; tfy.isref = tfx.isref; tfy.isInOutParam = tfx.isInOutParam; tfy.isInOutQual = tfx.isInOutQual; tfy.deco = tfy.merge().deco; tfx = tfy; } Type tx; if (tok == TOK.delegate_ || tok == TOK.reserved && (type.ty == Tdelegate || type.ty == Tpointer && to.ty == Tdelegate)) { // Allow conversion from implicit function pointer to delegate tx = new TypeDelegate(tfx); tx.deco = tx.merge().deco; } else { assert(tok == TOK.function_ || tok == TOK.reserved && type.ty == Tpointer || fd.errors); tx = tfx.pointerTo(); } //printf("\ttx = %s, to = %s\n", tx.toChars(), to.toChars()); MATCH m = tx.implicitConvTo(to); if (m > MATCH.nomatch) { // MATCH.exact: exact type match // MATCH.constant: covairiant type match (eg. attributes difference) // MATCH.convert: context conversion m = convertMatch ? MATCH.convert : tx.equals(to) ? MATCH.exact : MATCH.constant; if (presult) { (*presult) = cast(FuncExp)copy(); (*presult).type = to; // https://issues.dlang.org/show_bug.cgi?id=12508 // Tweak function body for covariant returns. (*presult).fd.modifyReturns(sc, tof.next); } } else if (!flag) { auto ts = toAutoQualChars(tx, to); error("cannot implicitly convert expression `%s` of type `%s` to `%s`", toChars(), ts[0], ts[1]); } return m; } override const(char)* toChars() const { return fd.toChars(); } override bool checkType() { if (td) { error("template lambda has no type"); return true; } return false; } override bool checkValue() { if (td) { error("template lambda has no value"); return true; } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Declaration of a symbol * * D grammar allows declarations only as statements. However in AST representation * it can be part of any expression. This is used, for example, during internal * syntax re-writes to inject hidden symbols. */ extern (C++) final class DeclarationExp : Expression { Dsymbol declaration; extern (D) this(const ref Loc loc, Dsymbol declaration) { super(loc, EXP.declaration); this.declaration = declaration; } override DeclarationExp syntaxCopy() { return new DeclarationExp(loc, declaration.syntaxCopy(null)); } override bool hasCode() { if (auto vd = declaration.isVarDeclaration()) { return !(vd.storage_class & (STC.manifest | STC.static_)); } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * typeid(int) */ extern (C++) final class TypeidExp : Expression { RootObject obj; extern (D) this(const ref Loc loc, RootObject o) { super(loc, EXP.typeid_); this.obj = o; } override TypeidExp syntaxCopy() { return new TypeidExp(loc, objectSyntaxCopy(obj)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * __traits(identifier, args...) */ extern (C++) final class TraitsExp : Expression { Identifier ident; Objects* args; extern (D) this(const ref Loc loc, Identifier ident, Objects* args) { super(loc, EXP.traits); this.ident = ident; this.args = args; } override TraitsExp syntaxCopy() { return new TraitsExp(loc, ident, TemplateInstance.arraySyntaxCopy(args)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Generates a halt instruction * * `assert(0)` gets rewritten to this with `CHECKACTION.halt` */ extern (C++) final class HaltExp : Expression { extern (D) this(const ref Loc loc) { super(loc, EXP.halt); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * is(targ id tok tspec) * is(targ id == tok2) */ extern (C++) final class IsExp : Expression { Type targ; Identifier id; // can be null Type tspec; // can be null TemplateParameters* parameters; TOK tok; // ':' or '==' TOK tok2; // 'struct', 'union', etc. extern (D) this(const ref Loc loc, Type targ, Identifier id, TOK tok, Type tspec, TOK tok2, TemplateParameters* parameters) scope { super(loc, EXP.is_); this.targ = targ; this.id = id; this.tok = tok; this.tspec = tspec; this.tok2 = tok2; this.parameters = parameters; } override IsExp syntaxCopy() { // This section is identical to that in TemplateDeclaration::syntaxCopy() TemplateParameters* p = null; if (parameters) { p = new TemplateParameters(parameters.length); foreach (i, el; *parameters) (*p)[i] = el.syntaxCopy(); } return new IsExp(loc, targ.syntaxCopy(), id, tok, tspec ? tspec.syntaxCopy() : null, tok2, p); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Base class for unary operators * * https://dlang.org/spec/expression.html#unary-expression */ extern (C++) abstract class UnaExp : Expression { Expression e1; extern (D) this(const ref Loc loc, EXP op, Expression e1) scope { super(loc, op); this.e1 = e1; } override UnaExp syntaxCopy() { UnaExp e = cast(UnaExp)copy(); e.type = null; e.e1 = e.e1.syntaxCopy(); return e; } /******************************** * The type for a unary expression is incompatible. * Print error message. * Returns: * ErrorExp */ final Expression incompatibleTypes() { if (e1.type.toBasetype() == Type.terror) return e1; if (e1.op == EXP.type) { error("incompatible type for `%s(%s)`: cannot use `%s` with types", EXPtoString(op).ptr, e1.toChars(), EXPtoString(op).ptr); } else { error("incompatible type for `%s(%s)`: `%s`", EXPtoString(op).ptr, e1.toChars(), e1.type.toChars()); } return ErrorExp.get(); } /********************* * Mark the operand as will never be dereferenced, * which is useful info for @safe checks. * Do before semantic() on operands rewrites them. */ final void setNoderefOperand() { if (auto edi = e1.isDotIdExp()) edi.noderef = true; } override final Expression resolveLoc(const ref Loc loc, Scope* sc) { e1 = e1.resolveLoc(loc, sc); return this; } override void accept(Visitor v) { v.visit(this); } } alias fp_t = UnionExp function(const ref Loc loc, Type, Expression, Expression); alias fp2_t = bool function(const ref Loc loc, EXP, Expression, Expression); /*********************************************************** * Base class for binary operators */ extern (C++) abstract class BinExp : Expression { Expression e1; Expression e2; Type att1; // Save alias this type to detect recursion Type att2; // Save alias this type to detect recursion extern (D) this(const ref Loc loc, EXP op, Expression e1, Expression e2) scope { super(loc, op); this.e1 = e1; this.e2 = e2; } override BinExp syntaxCopy() { BinExp e = cast(BinExp)copy(); e.type = null; e.e1 = e.e1.syntaxCopy(); e.e2 = e.e2.syntaxCopy(); return e; } /******************************** * The types for a binary expression are incompatible. * Print error message. * Returns: * ErrorExp */ final Expression incompatibleTypes() { if (e1.type.toBasetype() == Type.terror) return e1; if (e2.type.toBasetype() == Type.terror) return e2; // CondExp uses 'a ? b : c' but we're comparing 'b : c' const(char)* thisOp = (op == EXP.question) ? ":" : EXPtoString(op).ptr; if (e1.op == EXP.type || e2.op == EXP.type) { error("incompatible types for `(%s) %s (%s)`: cannot use `%s` with types", e1.toChars(), thisOp, e2.toChars(), EXPtoString(op).ptr); } else if (e1.type.equals(e2.type)) { error("incompatible types for `(%s) %s (%s)`: both operands are of type `%s`", e1.toChars(), thisOp, e2.toChars(), e1.type.toChars()); } else { auto ts = toAutoQualChars(e1.type, e2.type); error("incompatible types for `(%s) %s (%s)`: `%s` and `%s`", e1.toChars(), thisOp, e2.toChars(), ts[0], ts[1]); } return ErrorExp.get(); } extern (D) final Expression checkOpAssignTypes(Scope* sc) { // At that point t1 and t2 are the merged types. type is the original type of the lhs. Type t1 = e1.type; Type t2 = e2.type; // T opAssign floating yields a floating. Prevent truncating conversions (float to int). // See issue 3841. // Should we also prevent double to float (type.isfloating() && type.size() < t2.size()) ? if (op == EXP.addAssign || op == EXP.minAssign || op == EXP.mulAssign || op == EXP.divAssign || op == EXP.modAssign || op == EXP.powAssign) { if ((type.isintegral() && t2.isfloating())) { warning("`%s %s %s` is performing truncating conversion", type.toChars(), EXPtoString(op).ptr, t2.toChars()); } } // generate an error if this is a nonsensical *=,/=, or %=, eg real *= imaginary if (op == EXP.mulAssign || op == EXP.divAssign || op == EXP.modAssign) { // Any multiplication by an imaginary or complex number yields a complex result. // r *= c, i*=c, r*=i, i*=i are all forbidden operations. const(char)* opstr = EXPtoString(op).ptr; if (t1.isreal() && t2.iscomplex()) { error("`%s %s %s` is undefined. Did you mean `%s %s %s.re`?", t1.toChars(), opstr, t2.toChars(), t1.toChars(), opstr, t2.toChars()); return ErrorExp.get(); } else if (t1.isimaginary() && t2.iscomplex()) { error("`%s %s %s` is undefined. Did you mean `%s %s %s.im`?", t1.toChars(), opstr, t2.toChars(), t1.toChars(), opstr, t2.toChars()); return ErrorExp.get(); } else if ((t1.isreal() || t1.isimaginary()) && t2.isimaginary()) { error("`%s %s %s` is an undefined operation", t1.toChars(), opstr, t2.toChars()); return ErrorExp.get(); } } // generate an error if this is a nonsensical += or -=, eg real += imaginary if (op == EXP.addAssign || op == EXP.minAssign) { // Addition or subtraction of a real and an imaginary is a complex result. // Thus, r+=i, r+=c, i+=r, i+=c are all forbidden operations. if ((t1.isreal() && (t2.isimaginary() || t2.iscomplex())) || (t1.isimaginary() && (t2.isreal() || t2.iscomplex()))) { error("`%s %s %s` is undefined (result is complex)", t1.toChars(), EXPtoString(op).ptr, t2.toChars()); return ErrorExp.get(); } if (type.isreal() || type.isimaginary()) { assert(global.errors || t2.isfloating()); e2 = e2.castTo(sc, t1); } } if (op == EXP.mulAssign) { if (t2.isfloating()) { if (t1.isreal()) { if (t2.isimaginary() || t2.iscomplex()) { e2 = e2.castTo(sc, t1); } } else if (t1.isimaginary()) { if (t2.isimaginary() || t2.iscomplex()) { switch (t1.ty) { case Timaginary32: t2 = Type.tfloat32; break; case Timaginary64: t2 = Type.tfloat64; break; case Timaginary80: t2 = Type.tfloat80; break; default: assert(0); } e2 = e2.castTo(sc, t2); } } } } else if (op == EXP.divAssign) { if (t2.isimaginary()) { if (t1.isreal()) { // x/iv = i(-x/v) // Therefore, the result is 0 e2 = new CommaExp(loc, e2, new RealExp(loc, CTFloat.zero, t1)); e2.type = t1; Expression e = new AssignExp(loc, e1, e2); e.type = t1; return e; } else if (t1.isimaginary()) { Type t3; switch (t1.ty) { case Timaginary32: t3 = Type.tfloat32; break; case Timaginary64: t3 = Type.tfloat64; break; case Timaginary80: t3 = Type.tfloat80; break; default: assert(0); } e2 = e2.castTo(sc, t3); Expression e = new AssignExp(loc, e1, e2); e.type = t1; return e; } } } else if (op == EXP.modAssign) { if (t2.iscomplex()) { error("cannot perform modulo complex arithmetic"); return ErrorExp.get(); } } return this; } extern (D) final bool checkIntegralBin() { bool r1 = e1.checkIntegral(); bool r2 = e2.checkIntegral(); return (r1 || r2); } extern (D) final bool checkArithmeticBin() { bool r1 = e1.checkArithmetic(); bool r2 = e2.checkArithmetic(); return (r1 || r2); } extern (D) final bool checkSharedAccessBin(Scope* sc) { const r1 = e1.checkSharedAccess(sc); const r2 = e2.checkSharedAccess(sc); return (r1 || r2); } /********************* * Mark the operands as will never be dereferenced, * which is useful info for @safe checks. * Do before semantic() on operands rewrites them. */ final void setNoderefOperands() { if (auto edi = e1.isDotIdExp()) edi.noderef = true; if (auto edi = e2.isDotIdExp()) edi.noderef = true; } final Expression reorderSettingAAElem(Scope* sc) { BinExp be = this; auto ie = be.e1.isIndexExp(); if (!ie) return be; if (ie.e1.type.toBasetype().ty != Taarray) return be; /* Fix evaluation order of setting AA element * https://issues.dlang.org/show_bug.cgi?id=3825 * Rewrite: * aa[k1][k2][k3] op= val; * as: * auto ref __aatmp = aa; * auto ref __aakey3 = k1, __aakey2 = k2, __aakey1 = k3; * auto ref __aaval = val; * __aatmp[__aakey3][__aakey2][__aakey1] op= __aaval; // assignment */ Expression e0; while (1) { Expression de; ie.e2 = extractSideEffect(sc, "__aakey", de, ie.e2); e0 = Expression.combine(de, e0); auto ie1 = ie.e1.isIndexExp(); if (!ie1 || ie1.e1.type.toBasetype().ty != Taarray) { break; } ie = ie1; } assert(ie.e1.type.toBasetype().ty == Taarray); Expression de; ie.e1 = extractSideEffect(sc, "__aatmp", de, ie.e1); e0 = Expression.combine(de, e0); be.e2 = extractSideEffect(sc, "__aaval", e0, be.e2, true); //printf("-e0 = %s, be = %s\n", e0.toChars(), be.toChars()); return Expression.combine(e0, be); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Binary operator assignment, `+=` `-=` `*=` etc. */ extern (C++) class BinAssignExp : BinExp { extern (D) this(const ref Loc loc, EXP op, Expression e1, Expression e2) scope { super(loc, op, e1, e2); } override final bool isLvalue() { return true; } override final Expression toLvalue(Scope* sc, Expression ex) { // Lvalue-ness will be handled in glue layer. return this; } override final Expression modifiableLvalue(Scope* sc, Expression e) { // should check e1.checkModifiable() ? return toLvalue(sc, this); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A string mixin, `mixin("x")` * * https://dlang.org/spec/expression.html#mixin_expressions */ extern (C++) final class MixinExp : Expression { Expressions* exps; extern (D) this(const ref Loc loc, Expressions* exps) { super(loc, EXP.mixin_); this.exps = exps; } override MixinExp syntaxCopy() { return new MixinExp(loc, arraySyntaxCopy(exps)); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto ce = e.isMixinExp()) { if (exps.length != ce.exps.length) return false; foreach (i, e1; *exps) { auto e2 = (*ce.exps)[i]; if (e1 != e2 && (!e1 || !e2 || !e1.equals(e2))) return false; } return true; } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * An import expression, `import("file.txt")` * * Not to be confused with module imports, `import std.stdio`, which is an `ImportStatement` * * https://dlang.org/spec/expression.html#import_expressions */ extern (C++) final class ImportExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.import_, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * An assert expression, `assert(x == y)` * * https://dlang.org/spec/expression.html#assert_expressions */ extern (C++) final class AssertExp : UnaExp { Expression msg; extern (D) this(const ref Loc loc, Expression e, Expression msg = null) { super(loc, EXP.assert_, e); this.msg = msg; } override AssertExp syntaxCopy() { return new AssertExp(loc, e1.syntaxCopy(), msg ? msg.syntaxCopy() : null); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `throw <e1>` as proposed by DIP 1034. * * Replacement for the deprecated `ThrowStatement` that can be nested * in other expression. */ extern (C++) final class ThrowExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.throw_, e); this.type = Type.tnoreturn; } override ThrowExp syntaxCopy() { return new ThrowExp(loc, e1.syntaxCopy()); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotIdExp : UnaExp { Identifier ident; bool noderef; // true if the result of the expression will never be dereferenced bool wantsym; // do not replace Symbol with its initializer during semantic() bool arrow; // ImportC: if -> instead of . extern (D) this(const ref Loc loc, Expression e, Identifier ident) { super(loc, EXP.dotIdentifier, e); this.ident = ident; } static DotIdExp create(const ref Loc loc, Expression e, Identifier ident) { return new DotIdExp(loc, e, ident); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class DotTemplateExp : UnaExp { TemplateDeclaration td; extern (D) this(const ref Loc loc, Expression e, TemplateDeclaration td) { super(loc, EXP.dotTemplateDeclaration, e); this.td = td; } override bool checkType() { error("%s `%s` has no type", td.kind(), toChars()); return true; } override bool checkValue() { error("%s `%s` has no value", td.kind(), toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotVarExp : UnaExp { Declaration var; bool hasOverloads; extern (D) this(const ref Loc loc, Expression e, Declaration var, bool hasOverloads = true) { if (var.isVarDeclaration()) hasOverloads = false; super(loc, EXP.dotVariable, e); //printf("DotVarExp()\n"); this.var = var; this.hasOverloads = hasOverloads; } override bool isLvalue() { if (e1.op != EXP.structLiteral) return true; auto vd = var.isVarDeclaration(); return !(vd && vd.isField()); } override Expression toLvalue(Scope* sc, Expression e) { //printf("DotVarExp::toLvalue(%s)\n", toChars()); if (sc && sc.flags & SCOPE.Cfile) { /* C11 6.5.2.3-3: A postfix expression followed by the '.' or '->' operator * is an lvalue if the first expression is an lvalue. */ if (!e1.isLvalue()) return Expression.toLvalue(sc, e); } if (!isLvalue()) return Expression.toLvalue(sc, e); if (e1.op == EXP.this_ && sc.ctorflow.fieldinit.length && !(sc.ctorflow.callSuper & CSX.any_ctor)) { if (VarDeclaration vd = var.isVarDeclaration()) { auto ad = vd.isMember2(); if (ad && ad.fields.length == sc.ctorflow.fieldinit.length) { foreach (i, f; ad.fields) { if (f == vd) { if (!(sc.ctorflow.fieldinit[i].csx & CSX.this_ctor)) { /* If the address of vd is taken, assume it is thereby initialized * https://issues.dlang.org/show_bug.cgi?id=15869 */ modifyFieldVar(loc, sc, vd, e1); } break; } } } } } return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { version (none) { printf("DotVarExp::modifiableLvalue(%s)\n", toChars()); printf("e1.type = %s\n", e1.type.toChars()); printf("var.type = %s\n", var.type.toChars()); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * foo.bar!(args) */ extern (C++) final class DotTemplateInstanceExp : UnaExp { TemplateInstance ti; extern (D) this(const ref Loc loc, Expression e, Identifier name, Objects* tiargs) { super(loc, EXP.dotTemplateInstance, e); //printf("DotTemplateInstanceExp()\n"); this.ti = new TemplateInstance(loc, name, tiargs); } extern (D) this(const ref Loc loc, Expression e, TemplateInstance ti) { super(loc, EXP.dotTemplateInstance, e); this.ti = ti; } override DotTemplateInstanceExp syntaxCopy() { return new DotTemplateInstanceExp(loc, e1.syntaxCopy(), ti.name, TemplateInstance.arraySyntaxCopy(ti.tiargs)); } bool findTempDecl(Scope* sc) { static if (LOGSEMANTIC) { printf("DotTemplateInstanceExp::findTempDecl('%s')\n", toChars()); } if (ti.tempdecl) return true; Expression e = new DotIdExp(loc, e1, ti.name); e = e.expressionSemantic(sc); if (e.op == EXP.dot) e = (cast(DotExp)e).e2; Dsymbol s = null; switch (e.op) { case EXP.overloadSet: s = (cast(OverExp)e).vars; break; case EXP.dotTemplateDeclaration: s = (cast(DotTemplateExp)e).td; break; case EXP.scope_: s = (cast(ScopeExp)e).sds; break; case EXP.dotVariable: s = (cast(DotVarExp)e).var; break; case EXP.variable: s = (cast(VarExp)e).var; break; default: return false; } return ti.updateTempDecl(sc, s); } override bool checkType() { // Same logic as ScopeExp.checkType() if (ti.tempdecl && ti.semantictiargsdone && ti.semanticRun == PASS.initial) { error("partial %s `%s` has no type", ti.kind(), toChars()); return true; } return false; } override bool checkValue() { if (ti.tempdecl && ti.semantictiargsdone && ti.semanticRun == PASS.initial) error("partial %s `%s` has no value", ti.kind(), toChars()); else error("%s `%s` has no value", ti.kind(), ti.toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DelegateExp : UnaExp { FuncDeclaration func; bool hasOverloads; VarDeclaration vthis2; // container for multi-context extern (D) this(const ref Loc loc, Expression e, FuncDeclaration f, bool hasOverloads = true, VarDeclaration vthis2 = null) { super(loc, EXP.delegate_, e); this.func = f; this.hasOverloads = hasOverloads; this.vthis2 = vthis2; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotTypeExp : UnaExp { Dsymbol sym; // symbol that represents a type extern (D) this(const ref Loc loc, Expression e, Dsymbol s) { super(loc, EXP.dotType, e); this.sym = s; } override void accept(Visitor v) { v.visit(this); } } /** * The arguments of a function call * * Contains a list of expressions. If it is a named argument, the `names` * list has a non-null entry at the same index. */ struct ArgumentList { Expressions* arguments; // function arguments Identifiers* names; // named argument identifiers size_t length() const @nogc nothrow pure @safe { return arguments ? arguments.length : 0; } /// Returns: whether this argument list contains any named arguments bool hasNames() const @nogc nothrow pure @safe { if (names is null) return false; foreach (name; *names) if (name !is null) return true; return false; } } /*********************************************************** */ extern (C++) final class CallExp : UnaExp { Expressions* arguments; // function arguments Identifiers* names; // named argument identifiers FuncDeclaration f; // symbol to call bool directcall; // true if a virtual call is devirtualized bool inDebugStatement; /// true if this was in a debug statement bool ignoreAttributes; /// don't enforce attributes (e.g. call @gc function in @nogc code) bool isUfcsRewrite; /// the first argument was pushed in here by a UFCS rewrite VarDeclaration vthis2; // container for multi-context /// Puts the `arguments` and `names` into an `ArgumentList` for easily passing them around. /// The fields are still separate for backwards compatibility extern (D) ArgumentList argumentList() { return ArgumentList(arguments, names); } extern (D) this(const ref Loc loc, Expression e, Expressions* exps, Identifiers* names = null) { super(loc, EXP.call, e); this.arguments = exps; this.names = names; } extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.call, e); } extern (D) this(const ref Loc loc, Expression e, Expression earg1) { super(loc, EXP.call, e); this.arguments = new Expressions(); if (earg1) this.arguments.push(earg1); } extern (D) this(const ref Loc loc, Expression e, Expression earg1, Expression earg2) { super(loc, EXP.call, e); auto arguments = new Expressions(2); (*arguments)[0] = earg1; (*arguments)[1] = earg2; this.arguments = arguments; } /*********************************************************** * Instatiates a new function call expression * Params: * loc = location * fd = the declaration of the function to call * earg1 = the function argument */ extern(D) this(const ref Loc loc, FuncDeclaration fd, Expression earg1) { this(loc, new VarExp(loc, fd, false), earg1); this.f = fd; } static CallExp create(const ref Loc loc, Expression e, Expressions* exps) { return new CallExp(loc, e, exps); } static CallExp create(const ref Loc loc, Expression e) { return new CallExp(loc, e); } static CallExp create(const ref Loc loc, Expression e, Expression earg1) { return new CallExp(loc, e, earg1); } /*********************************************************** * Creates a new function call expression * Params: * loc = location * fd = the declaration of the function to call * earg1 = the function argument */ static CallExp create(const ref Loc loc, FuncDeclaration fd, Expression earg1) { return new CallExp(loc, fd, earg1); } override CallExp syntaxCopy() { return new CallExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments), names ? names.copy() : null); } override bool isLvalue() { Type tb = e1.type.toBasetype(); if (tb.ty == Tdelegate || tb.ty == Tpointer) tb = tb.nextOf(); auto tf = tb.isTypeFunction(); if (tf && tf.isref) { if (auto dve = e1.isDotVarExp()) if (dve.var.isCtorDeclaration()) return false; return true; // function returns a reference } return false; } override Expression toLvalue(Scope* sc, Expression e) { if (isLvalue()) return this; return Expression.toLvalue(sc, e); } override Expression addDtorHook(Scope* sc) { /* Only need to add dtor hook if it's a type that needs destruction. * Use same logic as VarDeclaration::callScopeDtor() */ if (auto tf = e1.type.isTypeFunction()) { if (tf.isref) return this; } Type tv = type.baseElemOf(); if (auto ts = tv.isTypeStruct()) { StructDeclaration sd = ts.sym; if (sd.dtor) { /* Type needs destruction, so declare a tmp * which the back end will recognize and call dtor on */ auto tmp = copyToTemp(0, Id.__tmpfordtor.toString(), this); auto de = new DeclarationExp(loc, tmp); auto ve = new VarExp(loc, tmp); Expression e = new CommaExp(loc, de, ve); e = e.expressionSemantic(sc); return e; } } return this; } override void accept(Visitor v) { v.visit(this); } } /** * Get the called function type from a call expression * Params: * ce = function call expression. Must have had semantic analysis done. * Returns: called function type, or `null` if error / no semantic analysis done */ TypeFunction calledFunctionType(CallExp ce) { Type t = ce.e1.type; if (!t) return null; t = t.toBasetype(); if (auto tf = t.isTypeFunction()) return tf; else if (auto td = t.isTypeDelegate()) return td.nextOf().isTypeFunction(); else return null; } FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) { if (auto ae = e.isAddrExp()) { auto ae1 = ae.e1; if (auto ve = ae1.isVarExp()) { if (hasOverloads) *hasOverloads = ve.hasOverloads; return ve.var.isFuncDeclaration(); } if (auto dve = ae1.isDotVarExp()) { if (hasOverloads) *hasOverloads = dve.hasOverloads; return dve.var.isFuncDeclaration(); } } else { if (auto soe = e.isSymOffExp()) { if (hasOverloads) *hasOverloads = soe.hasOverloads; return soe.var.isFuncDeclaration(); } if (auto dge = e.isDelegateExp()) { if (hasOverloads) *hasOverloads = dge.hasOverloads; return dge.func.isFuncDeclaration(); } } return null; } /*********************************************************** * The 'address of' operator, `&p` */ extern (C++) final class AddrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.address, e); } extern (D) this(const ref Loc loc, Expression e, Type t) { this(loc, e); type = t; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The pointer dereference operator, `*p` */ extern (C++) final class PtrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.star, e); //if (e.type) // type = ((TypePointer *)e.type).next; } extern (D) this(const ref Loc loc, Expression e, Type t) { super(loc, EXP.star, e); type = t; } override bool isLvalue() { return true; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { //printf("PtrExp::modifiableLvalue() %s, type %s\n", toChars(), type.toChars()); Declaration var; if (auto se = e1.isSymOffExp()) var = se.var; else if (auto ve = e1.isVarExp()) var = ve.var; if (var && var.type.isFunction_Delegate_PtrToFunction()) { if (var.type.isTypeFunction()) error("function `%s` is not an lvalue and cannot be modified", var.toChars()); else error("function pointed to by `%s` is not an lvalue and cannot be modified", var.toChars()); return ErrorExp.get(); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The negation operator, `-x` */ extern (C++) final class NegExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.negate, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The unary add operator, `+x` */ extern (C++) final class UAddExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) scope { super(loc, EXP.uadd, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The bitwise complement operator, `~x` */ extern (C++) final class ComExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.tilde, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The logical not operator, `!x` */ extern (C++) final class NotExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, EXP.not, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The delete operator, `delete x` (deprecated) * * https://dlang.org/spec/expression.html#delete_expressions */ extern (C++) final class DeleteExp : UnaExp { bool isRAII; // true if called automatically as a result of scoped destruction extern (D) this(const ref Loc loc, Expression e, bool isRAII) { super(loc, EXP.delete_, e); this.isRAII = isRAII; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The type cast operator, `cast(T) x` * * It's possible to cast to one type while painting to another type * * https://dlang.org/spec/expression.html#cast_expressions */ extern (C++) final class CastExp : UnaExp { Type to; // type to cast to ubyte mod = cast(ubyte)~0; // MODxxxxx extern (D) this(const ref Loc loc, Expression e, Type t) { super(loc, EXP.cast_, e); this.to = t; } /* For cast(const) and cast(immutable) */ extern (D) this(const ref Loc loc, Expression e, ubyte mod) { super(loc, EXP.cast_, e); this.mod = mod; } override CastExp syntaxCopy() { return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) : new CastExp(loc, e1.syntaxCopy(), mod); } override bool isLvalue() { //printf("e1.type = %s, to.type = %s\n", e1.type.toChars(), to.toChars()); if (!e1.isLvalue()) return false; return (to.ty == Tsarray && (e1.type.ty == Tvector || e1.type.ty == Tsarray)) || e1.type.mutableOf().unSharedOf().equals(to.mutableOf().unSharedOf()); } override Expression toLvalue(Scope* sc, Expression e) { if (sc && sc.flags & SCOPE.Cfile) { /* C11 6.5.4-5: A cast does not yield an lvalue. */ return Expression.toLvalue(sc, e); } if (isLvalue()) return this; return Expression.toLvalue(sc, e); } override Expression addDtorHook(Scope* sc) { if (to.toBasetype().ty == Tvoid) // look past the cast(void) e1 = e1.addDtorHook(sc); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class VectorExp : UnaExp { TypeVector to; // the target vector type before semantic() uint dim = ~0; // number of elements in the vector OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, Expression e, Type t) { super(loc, EXP.vector, e); assert(t.ty == Tvector); to = cast(TypeVector)t; } static VectorExp create(const ref Loc loc, Expression e, Type t) { return new VectorExp(loc, e, t); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, const ref Loc loc, Expression e, Type type) { emplaceExp!(VectorExp)(pue, loc, e, type); } override VectorExp syntaxCopy() { return new VectorExp(loc, e1.syntaxCopy(), to.syntaxCopy()); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1.array property for vectors. * * https://dlang.org/spec/simd.html#properties */ extern (C++) final class VectorArrayExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, EXP.vectorArray, e1); } override bool isLvalue() { return e1.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e1 = e1.toLvalue(sc, e); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1 [lwr .. upr] * * https://dlang.org/spec/expression.html#slice_expressions */ extern (C++) final class SliceExp : UnaExp { Expression upr; // null if implicit 0 Expression lwr; // null if implicit [length - 1] VarDeclaration lengthVar; private extern(D) static struct BitFields { bool upperIsInBounds; // true if upr <= e1.length bool lowerIsLessThanUpper; // true if lwr <= upr bool arrayop; // an array operation, rather than a slice } import dmd.common.bitfields : generateBitFields; mixin(generateBitFields!(BitFields, ubyte)); /************************************************************/ extern (D) this(const ref Loc loc, Expression e1, IntervalExp ie) { super(loc, EXP.slice, e1); this.upr = ie ? ie.upr : null; this.lwr = ie ? ie.lwr : null; } extern (D) this(const ref Loc loc, Expression e1, Expression lwr, Expression upr) { super(loc, EXP.slice, e1); this.upr = upr; this.lwr = lwr; } override SliceExp syntaxCopy() { auto se = new SliceExp(loc, e1.syntaxCopy(), lwr ? lwr.syntaxCopy() : null, upr ? upr.syntaxCopy() : null); se.lengthVar = this.lengthVar; // bug7871 return se; } override bool isLvalue() { /* slice expression is rvalue in default, but * conversion to reference of static array is only allowed. */ return (type && type.toBasetype().ty == Tsarray); } override Expression toLvalue(Scope* sc, Expression e) { //printf("SliceExp::toLvalue(%s) type = %s\n", toChars(), type ? type.toChars() : NULL); return (type && type.toBasetype().ty == Tsarray) ? this : Expression.toLvalue(sc, e); } override Expression modifiableLvalue(Scope* sc, Expression e) { error("slice expression `%s` is not a modifiable lvalue", toChars()); return this; } override Optional!bool toBool() { return e1.toBool(); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `.length` property of an array */ extern (C++) final class ArrayLengthExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, EXP.arrayLength, e1); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1 [ a0, a1, a2, a3 ,... ] * * https://dlang.org/spec/expression.html#index_expressions */ extern (C++) final class ArrayExp : UnaExp { Expressions* arguments; // Array of Expression's a0..an size_t currentDimension; // for opDollar VarDeclaration lengthVar; extern (D) this(const ref Loc loc, Expression e1, Expression index = null) { super(loc, EXP.array, e1); arguments = new Expressions(); if (index) arguments.push(index); } extern (D) this(const ref Loc loc, Expression e1, Expressions* args) { super(loc, EXP.array, e1); arguments = args; } override ArrayExp syntaxCopy() { auto ae = new ArrayExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments)); ae.lengthVar = this.lengthVar; // bug7871 return ae; } override bool isLvalue() { if (type && type.toBasetype().ty == Tvoid) return false; return true; } override Expression toLvalue(Scope* sc, Expression e) { if (type && type.toBasetype().ty == Tvoid) error("`void`s have no value"); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.dot, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class CommaExp : BinExp { /// This is needed because AssignExp rewrites CommaExp, hence it needs /// to trigger the deprecation. const bool isGenerated; /// Temporary variable to enable / disable deprecation of comma expression /// depending on the context. /// Since most constructor calls are rewritting, the only place where /// false will be passed will be from the parser. bool allowCommaExp; extern (D) this(const ref Loc loc, Expression e1, Expression e2, bool generated = true) { super(loc, EXP.comma, e1, e2); allowCommaExp = isGenerated = generated; } override bool isLvalue() { return e2.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e2 = e2.toLvalue(sc, null); return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { e2 = e2.modifiableLvalue(sc, e); return this; } override Optional!bool toBool() { return e2.toBool(); } override Expression addDtorHook(Scope* sc) { e2 = e2.addDtorHook(sc); return this; } override void accept(Visitor v) { v.visit(this); } /** * If the argument is a CommaExp, set a flag to prevent deprecation messages * * It's impossible to know from CommaExp.semantic if the result will * be used, hence when there is a result (type != void), a deprecation * message is always emitted. * However, some construct can produce a result but won't use it * (ExpStatement and for loop increment). Those should call this function * to prevent unwanted deprecations to be emitted. * * Params: * exp = An expression that discards its result. * If the argument is null or not a CommaExp, nothing happens. */ static void allow(Expression exp) { if (exp) if (auto ce = exp.isCommaExp()) ce.allowCommaExp = true; } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class IntervalExp : Expression { Expression lwr; Expression upr; extern (D) this(const ref Loc loc, Expression lwr, Expression upr) { super(loc, EXP.interval); this.lwr = lwr; this.upr = upr; } override Expression syntaxCopy() { return new IntervalExp(loc, lwr.syntaxCopy(), upr.syntaxCopy()); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `dg.ptr` property, pointing to the delegate's 'context' * * c.f.`DelegateFuncptrExp` for the delegate's function pointer `dg.funcptr` */ extern (C++) final class DelegatePtrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, EXP.delegatePointer, e1); } override bool isLvalue() { return e1.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e1 = e1.toLvalue(sc, e); return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { if (sc.setUnsafe(false, this.loc, "cannot modify delegate pointer in `@safe` code `%s`", this)) { return ErrorExp.get(); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `dg.funcptr` property, pointing to the delegate's function * * c.f.`DelegatePtrExp` for the delegate's function pointer `dg.ptr` */ extern (C++) final class DelegateFuncptrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, EXP.delegateFunctionPointer, e1); } override bool isLvalue() { return e1.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e1 = e1.toLvalue(sc, e); return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { if (sc.setUnsafe(false, this.loc, "cannot modify delegate function pointer in `@safe` code `%s`", this)) { return ErrorExp.get(); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1 [ e2 ] */ extern (C++) final class IndexExp : BinExp { VarDeclaration lengthVar; bool modifiable = false; // assume it is an rvalue bool indexIsInBounds; // true if 0 <= e2 && e2 <= e1.length - 1 extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.index, e1, e2); //printf("IndexExp::IndexExp('%s')\n", toChars()); } extern (D) this(const ref Loc loc, Expression e1, Expression e2, bool indexIsInBounds) { super(loc, EXP.index, e1, e2); this.indexIsInBounds = indexIsInBounds; //printf("IndexExp::IndexExp('%s')\n", toChars()); } override IndexExp syntaxCopy() { auto ie = new IndexExp(loc, e1.syntaxCopy(), e2.syntaxCopy()); ie.lengthVar = this.lengthVar; // bug7871 return ie; } override bool isLvalue() { if (e1.op == EXP.assocArrayLiteral) return false; if (e1.type.ty == Tsarray || (e1.op == EXP.index && e1.type.ty != Tarray)) { return e1.isLvalue(); } return true; } override Expression toLvalue(Scope* sc, Expression e) { if (isLvalue()) return this; return Expression.toLvalue(sc, e); } override Expression modifiableLvalue(Scope* sc, Expression e) { //printf("IndexExp::modifiableLvalue(%s)\n", toChars()); Expression ex = markSettingAAElem(); if (ex.op == EXP.error) return ex; return Expression.modifiableLvalue(sc, e); } extern (D) Expression markSettingAAElem() { if (e1.type.toBasetype().ty == Taarray) { Type t2b = e2.type.toBasetype(); if (t2b.ty == Tarray && t2b.nextOf().isMutable()) { error("associative arrays can only be assigned values with immutable keys, not `%s`", e2.type.toChars()); return ErrorExp.get(); } modifiable = true; if (auto ie = e1.isIndexExp()) { Expression ex = ie.markSettingAAElem(); if (ex.op == EXP.error) return ex; assert(ex == e1); } } return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The postfix increment/decrement operator, `i++` / `i--` */ extern (C++) final class PostExp : BinExp { extern (D) this(EXP op, const ref Loc loc, Expression e) { super(loc, op, e, IntegerExp.literal!1); assert(op == EXP.minusMinus || op == EXP.plusPlus); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The prefix increment/decrement operator, `++i` / `--i` */ extern (C++) final class PreExp : UnaExp { extern (D) this(EXP op, const ref Loc loc, Expression e) { super(loc, op, e); assert(op == EXP.preMinusMinus || op == EXP.prePlusPlus); } override void accept(Visitor v) { v.visit(this); } } enum MemorySet { none = 0, // simple assignment blockAssign = 1, // setting the contents of an array referenceInit = 2, // setting the reference of STC.ref_ variable } /*********************************************************** * The assignment / initialization operator, `=` * * Note: operator assignment `op=` has a different base class, `BinAssignExp` */ extern (C++) class AssignExp : BinExp { MemorySet memset; /************************************************************/ /* op can be EXP.assign, EXP.construct, or EXP.blit */ extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.assign, e1, e2); } this(const ref Loc loc, EXP tok, Expression e1, Expression e2) { super(loc, tok, e1, e2); } override final bool isLvalue() { // Array-op 'x[] = y[]' should make an rvalue. // Setting array length 'x.length = v' should make an rvalue. if (e1.op == EXP.slice || e1.op == EXP.arrayLength) { return false; } return true; } override final Expression toLvalue(Scope* sc, Expression ex) { if (e1.op == EXP.slice || e1.op == EXP.arrayLength) { return Expression.toLvalue(sc, ex); } /* In front-end level, AssignExp should make an lvalue of e1. * Taking the address of e1 will be handled in low level layer, * so this function does nothing. */ return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * When an assignment expression is lowered to a druntime call * this class is used to store the lowering. * It essentially behaves the same as an AssignExp, but it is * used to not waste space for other AssignExp that are not * lowered to anything. */ extern (C++) final class LoweredAssignExp : AssignExp { Expression lowering; extern (D) this(AssignExp exp, Expression lowering) { super(exp.loc, EXP.loweredAssignExp, exp.e1, exp.e2); this.lowering = lowering; } override const(char)* toChars() const { return lowering.toChars(); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ConstructExp : AssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.construct, e1, e2); } // Internal use only. If `v` is a reference variable, the assignment // will become a reference initialization automatically. extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2) { auto ve = new VarExp(loc, v); assert(v.type && ve.type); super(loc, EXP.construct, ve, e2); if (v.isReference()) memset = MemorySet.referenceInit; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A bit-for-bit copy from `e2` to `e1` */ extern (C++) final class BlitExp : AssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.blit, e1, e2); } // Internal use only. If `v` is a reference variable, the assinment // will become a reference rebinding automatically. extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2) { auto ve = new VarExp(loc, v); assert(v.type && ve.type); super(loc, EXP.blit, ve, e2); if (v.isReference()) memset = MemorySet.referenceInit; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x += y` */ extern (C++) final class AddAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.addAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x -= y` */ extern (C++) final class MinAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.minAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x *= y` */ extern (C++) final class MulAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.mulAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x /= y` */ extern (C++) final class DivAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.divAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x %= y` */ extern (C++) final class ModAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.modAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x &= y` */ extern (C++) final class AndAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.andAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x |= y` */ extern (C++) final class OrAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.orAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x ^= y` */ extern (C++) final class XorAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.xorAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x ^^= y` */ extern (C++) final class PowAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.powAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x <<= y` */ extern (C++) final class ShlAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.leftShiftAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x >>= y` */ extern (C++) final class ShrAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.rightShiftAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `x >>>= y` */ extern (C++) final class UshrAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.unsignedRightShiftAssign, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `~=` operator. * * It can have one of the following operators: * * EXP.concatenateAssign - appending T[] to T[] * EXP.concatenateElemAssign - appending T to T[] * EXP.concatenateDcharAssign - appending dchar to T[] * * The parser initially sets it to EXP.concatenateAssign, and semantic() later decides which * of the three it will be set to. */ extern (C++) class CatAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.concatenateAssign, e1, e2); } extern (D) this(const ref Loc loc, EXP tok, Expression e1, Expression e2) { super(loc, tok, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `~=` operator when appending a single element */ extern (C++) final class CatElemAssignExp : CatAssignExp { extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2) { super(loc, EXP.concatenateElemAssign, e1, e2); this.type = type; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `~=` operator when appending a single `dchar` */ extern (C++) final class CatDcharAssignExp : CatAssignExp { extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2) { super(loc, EXP.concatenateDcharAssign, e1, e2); this.type = type; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The addition operator, `x + y` * * https://dlang.org/spec/expression.html#add_expressions */ extern (C++) final class AddExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.add, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The minus operator, `x - y` * * https://dlang.org/spec/expression.html#add_expressions */ extern (C++) final class MinExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.min, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The concatenation operator, `x ~ y` * * https://dlang.org/spec/expression.html#cat_expressions */ extern (C++) final class CatExp : BinExp { Expression lowering; // call to druntime hook `_d_arraycatnTX` extern (D) this(const ref Loc loc, Expression e1, Expression e2) scope { super(loc, EXP.concatenate, e1, e2); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { e1 = e1.resolveLoc(loc, sc); e2 = e2.resolveLoc(loc, sc); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The multiplication operator, `x * y` * * https://dlang.org/spec/expression.html#mul_expressions */ extern (C++) final class MulExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.mul, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The division operator, `x / y` * * https://dlang.org/spec/expression.html#mul_expressions */ extern (C++) final class DivExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.div, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The modulo operator, `x % y` * * https://dlang.org/spec/expression.html#mul_expressions */ extern (C++) final class ModExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.mod, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The 'power' operator, `x ^^ y` * * https://dlang.org/spec/expression.html#pow_expressions */ extern (C++) final class PowExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.pow, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The 'shift left' operator, `x << y` * * https://dlang.org/spec/expression.html#shift_expressions */ extern (C++) final class ShlExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.leftShift, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The 'shift right' operator, `x >> y` * * https://dlang.org/spec/expression.html#shift_expressions */ extern (C++) final class ShrExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.rightShift, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The 'unsigned shift right' operator, `x >>> y` * * https://dlang.org/spec/expression.html#shift_expressions */ extern (C++) final class UshrExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.unsignedRightShift, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The bitwise 'and' operator, `x & y` * * https://dlang.org/spec/expression.html#and_expressions */ extern (C++) final class AndExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.and, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The bitwise 'or' operator, `x | y` * * https://dlang.org/spec/expression.html#or_expressions */ extern (C++) final class OrExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.or, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The bitwise 'xor' operator, `x ^ y` * * https://dlang.org/spec/expression.html#xor_expressions */ extern (C++) final class XorExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.xor, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The logical 'and' / 'or' operator, `X && Y` / `X || Y` * * https://dlang.org/spec/expression.html#andand_expressions * https://dlang.org/spec/expression.html#oror_expressions */ extern (C++) final class LogicalExp : BinExp { extern (D) this(const ref Loc loc, EXP op, Expression e1, Expression e2) { super(loc, op, e1, e2); assert(op == EXP.andAnd || op == EXP.orOr); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * A comparison operator, `<` `<=` `>` `>=` * * `op` is one of: * EXP.lessThan, EXP.lessOrEqual, EXP.greaterThan, EXP.greaterOrEqual * * https://dlang.org/spec/expression.html#relation_expressions */ extern (C++) final class CmpExp : BinExp { extern (D) this(EXP op, const ref Loc loc, Expression e1, Expression e2) { super(loc, op, e1, e2); assert(op == EXP.lessThan || op == EXP.lessOrEqual || op == EXP.greaterThan || op == EXP.greaterOrEqual); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `in` operator, `"a" in ["a": 1]` * * Note: `x !in y` is rewritten to `!(x in y)` in the parser * * https://dlang.org/spec/expression.html#in_expressions */ extern (C++) final class InExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.in_, e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Associative array removal, `aa.remove(arg)` * * This deletes the key e1 from the associative array e2 */ extern (C++) final class RemoveExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, EXP.remove, e1, e2); type = Type.tbool; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `==` and `!=` * * EXP.equal and EXP.notEqual * * https://dlang.org/spec/expression.html#equality_expressions */ extern (C++) final class EqualExp : BinExp { extern (D) this(EXP op, const ref Loc loc, Expression e1, Expression e2) { super(loc, op, e1, e2); assert(op == EXP.equal || op == EXP.notEqual); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `is` and `!is` * * EXP.identity and EXP.notIdentity * * https://dlang.org/spec/expression.html#identity_expressions */ extern (C++) final class IdentityExp : BinExp { extern (D) this(EXP op, const ref Loc loc, Expression e1, Expression e2) { super(loc, op, e1, e2); assert(op == EXP.identity || op == EXP.notIdentity); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The ternary operator, `econd ? e1 : e2` * * https://dlang.org/spec/expression.html#conditional_expressions */ extern (C++) final class CondExp : BinExp { Expression econd; extern (D) this(const ref Loc loc, Expression econd, Expression e1, Expression e2) scope { super(loc, EXP.question, e1, e2); this.econd = econd; } override CondExp syntaxCopy() { return new CondExp(loc, econd.syntaxCopy(), e1.syntaxCopy(), e2.syntaxCopy()); } override bool isLvalue() { return e1.isLvalue() && e2.isLvalue(); } override Expression toLvalue(Scope* sc, Expression ex) { // convert (econd ? e1 : e2) to *(econd ? &e1 : &e2) CondExp e = cast(CondExp)copy(); e.e1 = e1.toLvalue(sc, null).addressOf(); e.e2 = e2.toLvalue(sc, null).addressOf(); e.type = type.pointerTo(); return new PtrExp(loc, e, type); } override Expression modifiableLvalue(Scope* sc, Expression e) { if (!e1.isLvalue() && !e2.isLvalue()) { error("conditional expression `%s` is not a modifiable lvalue", toChars()); return ErrorExp.get(); } e1 = e1.modifiableLvalue(sc, e1); e2 = e2.modifiableLvalue(sc, e2); return toLvalue(sc, this); } void hookDtors(Scope* sc) { extern (C++) final class DtorVisitor : StoppableVisitor { alias visit = typeof(super).visit; public: Scope* sc; CondExp ce; VarDeclaration vcond; bool isThen; extern (D) this(Scope* sc, CondExp ce) { this.sc = sc; this.ce = ce; } override void visit(Expression e) { //printf("(e = %s)\n", e.toChars()); } override void visit(DeclarationExp e) { auto v = e.declaration.isVarDeclaration(); if (v && !v.isDataseg()) { if (v._init) { if (auto ei = v._init.isExpInitializer()) walkPostorder(ei.exp, this); } if (v.edtor) walkPostorder(v.edtor, this); if (v.needsScopeDtor()) { if (!vcond) { vcond = copyToTemp(STC.volatile_ | STC.const_, "__cond", ce.econd); vcond.dsymbolSemantic(sc); Expression de = new DeclarationExp(ce.econd.loc, vcond); de = de.expressionSemantic(sc); Expression ve = new VarExp(ce.econd.loc, vcond); ce.econd = Expression.combine(de, ve); } //printf("\t++v = %s, v.edtor = %s\n", v.toChars(), v.edtor.toChars()); Expression ve = new VarExp(vcond.loc, vcond); if (isThen) v.edtor = new LogicalExp(v.edtor.loc, EXP.andAnd, ve, v.edtor); else v.edtor = new LogicalExp(v.edtor.loc, EXP.orOr, ve, v.edtor); v.edtor = v.edtor.expressionSemantic(sc); //printf("\t--v = %s, v.edtor = %s\n", v.toChars(), v.edtor.toChars()); } } } } scope DtorVisitor v = new DtorVisitor(sc, this); //printf("+%s\n", toChars()); v.isThen = true; walkPostorder(e1, v); v.isThen = false; walkPostorder(e2, v); //printf("-%s\n", toChars()); } override void accept(Visitor v) { v.visit(this); } } /// Returns: if this token is the `op` for a derived `DefaultInitExp` class. bool isDefaultInitOp(EXP op) pure nothrow @safe @nogc { return op == EXP.prettyFunction || op == EXP.functionString || op == EXP.line || op == EXP.moduleString || op == EXP.file || op == EXP.fileFullPath ; } /*********************************************************** * A special keyword when used as a function's default argument * * When possible, special keywords are resolved in the parser, but when * appearing as a default argument, they result in an expression deriving * from this base class that is resolved for each function call. * * --- * const x = __LINE__; // resolved in the parser * void foo(string file = __FILE__, int line = __LINE__); // DefaultInitExp * --- * * https://dlang.org/spec/expression.html#specialkeywords */ extern (C++) class DefaultInitExp : Expression { extern (D) this(const ref Loc loc, EXP op) { super(loc, op); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `__FILE__` token as a default argument */ extern (C++) final class FileInitExp : DefaultInitExp { extern (D) this(const ref Loc loc, EXP tok) { super(loc, tok); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { //printf("FileInitExp::resolve() %s\n", toChars()); const(char)* s; if (op == EXP.fileFullPath) s = FileName.toAbsolute(loc.isValid() ? loc.filename : sc._module.srcfile.toChars()); else s = loc.isValid() ? loc.filename : sc._module.ident.toChars(); Expression e = new StringExp(loc, s.toDString()); return e.expressionSemantic(sc); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `__LINE__` token as a default argument */ extern (C++) final class LineInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, EXP.line); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { Expression e = new IntegerExp(loc, loc.linnum, Type.tint32); return e.expressionSemantic(sc); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `__MODULE__` token as a default argument */ extern (C++) final class ModuleInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, EXP.moduleString); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { const auto s = (sc.callsc ? sc.callsc : sc)._module.toPrettyChars().toDString(); Expression e = new StringExp(loc, s); return e.expressionSemantic(sc); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `__FUNCTION__` token as a default argument */ extern (C++) final class FuncInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, EXP.functionString); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { const(char)* s; if (sc.callsc && sc.callsc.func) s = sc.callsc.func.Dsymbol.toPrettyChars(); else if (sc.func) s = sc.func.Dsymbol.toPrettyChars(); else s = ""; Expression e = new StringExp(loc, s.toDString()); return e.expressionSemantic(sc); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The `__PRETTY_FUNCTION__` token as a default argument */ extern (C++) final class PrettyFuncInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, EXP.prettyFunction); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { FuncDeclaration fd = (sc.callsc && sc.callsc.func) ? sc.callsc.func : sc.func; const(char)* s; if (fd) { const funcStr = fd.Dsymbol.toPrettyChars(); OutBuffer buf; functionToBufferWithIdent(fd.type.isTypeFunction(), &buf, funcStr, fd.isStatic); s = buf.extractChars(); } else { s = ""; } Expression e = new StringExp(loc, s.toDString()); e = e.expressionSemantic(sc); e.type = Type.tstring; return e; } override void accept(Visitor v) { v.visit(this); } } /** * Objective-C class reference expression. * * Used to get the metaclass of an Objective-C class, `NSObject.Class`. */ extern (C++) final class ObjcClassReferenceExp : Expression { ClassDeclaration classDeclaration; extern (D) this(const ref Loc loc, ClassDeclaration classDeclaration) { super(loc, EXP.objcClassReference); this.classDeclaration = classDeclaration; type = objc.getRuntimeMetaclass(classDeclaration).getType(); } override void accept(Visitor v) { v.visit(this); } } /******************* * C11 6.5.1.1 Generic Selection * For ImportC */ extern (C++) final class GenericExp : Expression { Expression cntlExp; /// controlling expression of a generic selection (not evaluated) Types* types; /// type-names for generic associations (null entry for `default`) Expressions* exps; /// 1:1 mapping of typeNames to exps extern (D) this(const ref Loc loc, Expression cntlExp, Types* types, Expressions* exps) { super(loc, EXP._Generic); this.cntlExp = cntlExp; this.types = types; this.exps = exps; assert(types.length == exps.length); // must be the same and >=1 } override GenericExp syntaxCopy() { return new GenericExp(loc, cntlExp.syntaxCopy(), Type.arraySyntaxCopy(types), Expression.arraySyntaxCopy(exps)); } override void accept(Visitor v) { v.visit(this); } } /*************************************** * Parameters: * sc: scope * flag: 1: do not issue error message for invalid modification 2: the exp is a DotVarExp and a subfield of the leftmost variable is modified * Returns: * Whether the type is modifiable */ extern(D) Modifiable checkModifiable(Expression exp, Scope* sc, ModifyFlags flag = ModifyFlags.none) { switch(exp.op) { case EXP.variable: auto varExp = cast(VarExp)exp; //printf("VarExp::checkModifiable %s", varExp.toChars()); assert(varExp.type); return varExp.var.checkModify(varExp.loc, sc, null, flag); case EXP.dotVariable: auto dotVarExp = cast(DotVarExp)exp; //printf("DotVarExp::checkModifiable %s %s\n", dotVarExp.toChars(), dotVarExp.type.toChars()); if (dotVarExp.e1.op == EXP.this_) return dotVarExp.var.checkModify(dotVarExp.loc, sc, dotVarExp.e1, flag); /* https://issues.dlang.org/show_bug.cgi?id=12764 * If inside a constructor and an expression of type `this.field.var` * is encountered, where `field` is a struct declaration with * default construction disabled, we must make sure that * assigning to `var` does not imply that `field` was initialized */ if (sc.func && sc.func.isCtorDeclaration()) { // if inside a constructor scope and e1 of this DotVarExp // is another DotVarExp, then check if the leftmost expression is a `this` identifier if (auto dve = dotVarExp.e1.isDotVarExp()) { // Iterate the chain of DotVarExp to find `this` // Keep track whether access to fields was limited to union members // s.t. one can initialize an entire struct inside nested unions // (but not its members) bool onlyUnion = true; while (true) { auto v = dve.var.isVarDeclaration(); assert(v); // Accessing union member? auto t = v.type.isTypeStruct(); if (!t || !t.sym.isUnionDeclaration()) onlyUnion = false; // Another DotVarExp left? if (!dve.e1 || dve.e1.op != EXP.dotVariable) break; dve = cast(DotVarExp) dve.e1; } if (dve.e1.op == EXP.this_) { scope v = dve.var.isVarDeclaration(); /* if v is a struct member field with no initializer, no default construction * and v wasn't intialized before */ if (v && v.isField() && !v._init && !v.ctorinit) { if (auto ts = v.type.isTypeStruct()) { if (ts.sym.noDefaultCtor) { /* checkModify will consider that this is an initialization * of v while it is actually an assignment of a field of v */ scope modifyLevel = v.checkModify(dotVarExp.loc, sc, dve.e1, !onlyUnion ? (flag | ModifyFlags.fieldAssign) : flag); if (modifyLevel == Modifiable.initialization) { // https://issues.dlang.org/show_bug.cgi?id=22118 // v is a union type field that was assigned // a variable, therefore it counts as initialization if (v.ctorinit) return Modifiable.initialization; return Modifiable.yes; } return modifyLevel; } } } } } } //printf("\te1 = %s\n", e1.toChars()); return dotVarExp.e1.checkModifiable(sc, flag); case EXP.star: auto ptrExp = cast(PtrExp)exp; if (auto se = ptrExp.e1.isSymOffExp()) { return se.var.checkModify(ptrExp.loc, sc, null, flag); } else if (auto ae = ptrExp.e1.isAddrExp()) { return ae.e1.checkModifiable(sc, flag); } return Modifiable.yes; case EXP.slice: auto sliceExp = cast(SliceExp)exp; //printf("SliceExp::checkModifiable %s\n", sliceExp.toChars()); auto e1 = sliceExp.e1; if (e1.type.ty == Tsarray || (e1.op == EXP.index && e1.type.ty != Tarray) || e1.op == EXP.slice) { return e1.checkModifiable(sc, flag); } return Modifiable.yes; case EXP.comma: return (cast(CommaExp)exp).e2.checkModifiable(sc, flag); case EXP.index: auto indexExp = cast(IndexExp)exp; auto e1 = indexExp.e1; if (e1.type.ty == Tsarray || e1.type.ty == Taarray || (e1.op == EXP.index && e1.type.ty != Tarray) || e1.op == EXP.slice) { return e1.checkModifiable(sc, flag); } return Modifiable.yes; case EXP.question: auto condExp = cast(CondExp)exp; if (condExp.e1.checkModifiable(sc, flag) != Modifiable.no && condExp.e2.checkModifiable(sc, flag) != Modifiable.no) return Modifiable.yes; return Modifiable.no; default: return exp.type ? Modifiable.yes : Modifiable.no; // default modifiable } } /** * Verify if the given identifier is any of * _d_array{ctor,setctor,setassign,assign_l, assign_r}. * * Params: * id = the identifier to verify * * Returns: * `true` if the identifier corresponds to a construction of assignement * runtime hook, `false` otherwise. */ bool isArrayConstructionOrAssign(const Identifier id) { import dmd.id : Id; return id == Id._d_arrayctor || id == Id._d_arraysetctor || id == Id._d_arrayassign_l || id == Id._d_arrayassign_r || id == Id._d_arraysetassign; } /****************************** * Provide efficient way to implement isUnaExp(), isBinExp(), isBinAssignExp() */ private immutable ubyte[EXP.max + 1] exptab = () { ubyte[EXP.max + 1] tab; with (EXPFLAGS) { foreach (i; Eunary) { tab[i] |= unary; } foreach (i; Ebinary) { tab[i] |= unary | binary; } foreach (i; EbinaryAssign) { tab[i] |= unary | binary | binaryAssign; } } return tab; } (); private enum EXPFLAGS : ubyte { unary = 1, binary = 2, binaryAssign = 4, } private enum Eunary = [ EXP.import_, EXP.assert_, EXP.throw_, EXP.dotIdentifier, EXP.dotTemplateDeclaration, EXP.dotVariable, EXP.dotTemplateInstance, EXP.delegate_, EXP.dotType, EXP.call, EXP.address, EXP.star, EXP.negate, EXP.uadd, EXP.tilde, EXP.not, EXP.delete_, EXP.cast_, EXP.vector, EXP.vectorArray, EXP.slice, EXP.arrayLength, EXP.array, EXP.delegatePointer, EXP.delegateFunctionPointer, EXP.preMinusMinus, EXP.prePlusPlus, ]; private enum Ebinary = [ EXP.dot, EXP.comma, EXP.index, EXP.minusMinus, EXP.plusPlus, EXP.assign, EXP.add, EXP.min, EXP.concatenate, EXP.mul, EXP.div, EXP.mod, EXP.pow, EXP.leftShift, EXP.rightShift, EXP.unsignedRightShift, EXP.and, EXP.or, EXP.xor, EXP.andAnd, EXP.orOr, EXP.lessThan, EXP.lessOrEqual, EXP.greaterThan, EXP.greaterOrEqual, EXP.in_, EXP.remove, EXP.equal, EXP.notEqual, EXP.identity, EXP.notIdentity, EXP.question, EXP.construct, EXP.blit, ]; private enum EbinaryAssign = [ EXP.addAssign, EXP.minAssign, EXP.mulAssign, EXP.divAssign, EXP.modAssign, EXP.andAssign, EXP.orAssign, EXP.xorAssign, EXP.powAssign, EXP.leftShiftAssign, EXP.rightShiftAssign, EXP.unsignedRightShiftAssign, EXP.concatenateAssign, EXP.concatenateElemAssign, EXP.concatenateDcharAssign, ]; /// Given a member of the EXP enum, get the class instance size of the corresponding Expression class. /// Needed because the classes are `extern(C++)` private immutable ubyte[EXP.max+1] expSize = [ EXP.reserved: 0, EXP.negate: __traits(classInstanceSize, NegExp), EXP.cast_: __traits(classInstanceSize, CastExp), EXP.null_: __traits(classInstanceSize, NullExp), EXP.assert_: __traits(classInstanceSize, AssertExp), EXP.array: __traits(classInstanceSize, ArrayExp), EXP.call: __traits(classInstanceSize, CallExp), EXP.address: __traits(classInstanceSize, AddrExp), EXP.type: __traits(classInstanceSize, TypeExp), EXP.throw_: __traits(classInstanceSize, ThrowExp), EXP.new_: __traits(classInstanceSize, NewExp), EXP.delete_: __traits(classInstanceSize, DeleteExp), EXP.star: __traits(classInstanceSize, PtrExp), EXP.symbolOffset: __traits(classInstanceSize, SymOffExp), EXP.variable: __traits(classInstanceSize, VarExp), EXP.dotVariable: __traits(classInstanceSize, DotVarExp), EXP.dotIdentifier: __traits(classInstanceSize, DotIdExp), EXP.dotTemplateInstance: __traits(classInstanceSize, DotTemplateInstanceExp), EXP.dotType: __traits(classInstanceSize, DotTypeExp), EXP.slice: __traits(classInstanceSize, SliceExp), EXP.arrayLength: __traits(classInstanceSize, ArrayLengthExp), EXP.dollar: __traits(classInstanceSize, DollarExp), EXP.template_: __traits(classInstanceSize, TemplateExp), EXP.dotTemplateDeclaration: __traits(classInstanceSize, DotTemplateExp), EXP.declaration: __traits(classInstanceSize, DeclarationExp), EXP.dSymbol: __traits(classInstanceSize, DsymbolExp), EXP.typeid_: __traits(classInstanceSize, TypeidExp), EXP.uadd: __traits(classInstanceSize, UAddExp), EXP.remove: __traits(classInstanceSize, RemoveExp), EXP.newAnonymousClass: __traits(classInstanceSize, NewAnonClassExp), EXP.arrayLiteral: __traits(classInstanceSize, ArrayLiteralExp), EXP.assocArrayLiteral: __traits(classInstanceSize, AssocArrayLiteralExp), EXP.structLiteral: __traits(classInstanceSize, StructLiteralExp), EXP.classReference: __traits(classInstanceSize, ClassReferenceExp), EXP.thrownException: __traits(classInstanceSize, ThrownExceptionExp), EXP.delegatePointer: __traits(classInstanceSize, DelegatePtrExp), EXP.delegateFunctionPointer: __traits(classInstanceSize, DelegateFuncptrExp), EXP.lessThan: __traits(classInstanceSize, CmpExp), EXP.greaterThan: __traits(classInstanceSize, CmpExp), EXP.lessOrEqual: __traits(classInstanceSize, CmpExp), EXP.greaterOrEqual: __traits(classInstanceSize, CmpExp), EXP.equal: __traits(classInstanceSize, EqualExp), EXP.notEqual: __traits(classInstanceSize, EqualExp), EXP.identity: __traits(classInstanceSize, IdentityExp), EXP.notIdentity: __traits(classInstanceSize, IdentityExp), EXP.index: __traits(classInstanceSize, IndexExp), EXP.is_: __traits(classInstanceSize, IsExp), EXP.leftShift: __traits(classInstanceSize, ShlExp), EXP.rightShift: __traits(classInstanceSize, ShrExp), EXP.leftShiftAssign: __traits(classInstanceSize, ShlAssignExp), EXP.rightShiftAssign: __traits(classInstanceSize, ShrAssignExp), EXP.unsignedRightShift: __traits(classInstanceSize, UshrExp), EXP.unsignedRightShiftAssign: __traits(classInstanceSize, UshrAssignExp), EXP.concatenate: __traits(classInstanceSize, CatExp), EXP.concatenateAssign: __traits(classInstanceSize, CatAssignExp), EXP.concatenateElemAssign: __traits(classInstanceSize, CatElemAssignExp), EXP.concatenateDcharAssign: __traits(classInstanceSize, CatDcharAssignExp), EXP.add: __traits(classInstanceSize, AddExp), EXP.min: __traits(classInstanceSize, MinExp), EXP.addAssign: __traits(classInstanceSize, AddAssignExp), EXP.minAssign: __traits(classInstanceSize, MinAssignExp), EXP.mul: __traits(classInstanceSize, MulExp), EXP.div: __traits(classInstanceSize, DivExp), EXP.mod: __traits(classInstanceSize, ModExp), EXP.mulAssign: __traits(classInstanceSize, MulAssignExp), EXP.divAssign: __traits(classInstanceSize, DivAssignExp), EXP.modAssign: __traits(classInstanceSize, ModAssignExp), EXP.and: __traits(classInstanceSize, AndExp), EXP.or: __traits(classInstanceSize, OrExp), EXP.xor: __traits(classInstanceSize, XorExp), EXP.andAssign: __traits(classInstanceSize, AndAssignExp), EXP.orAssign: __traits(classInstanceSize, OrAssignExp), EXP.xorAssign: __traits(classInstanceSize, XorAssignExp), EXP.assign: __traits(classInstanceSize, AssignExp), EXP.not: __traits(classInstanceSize, NotExp), EXP.tilde: __traits(classInstanceSize, ComExp), EXP.plusPlus: __traits(classInstanceSize, PostExp), EXP.minusMinus: __traits(classInstanceSize, PostExp), EXP.construct: __traits(classInstanceSize, ConstructExp), EXP.blit: __traits(classInstanceSize, BlitExp), EXP.dot: __traits(classInstanceSize, DotExp), EXP.comma: __traits(classInstanceSize, CommaExp), EXP.question: __traits(classInstanceSize, CondExp), EXP.andAnd: __traits(classInstanceSize, LogicalExp), EXP.orOr: __traits(classInstanceSize, LogicalExp), EXP.prePlusPlus: __traits(classInstanceSize, PreExp), EXP.preMinusMinus: __traits(classInstanceSize, PreExp), EXP.identifier: __traits(classInstanceSize, IdentifierExp), EXP.string_: __traits(classInstanceSize, StringExp), EXP.this_: __traits(classInstanceSize, ThisExp), EXP.super_: __traits(classInstanceSize, SuperExp), EXP.halt: __traits(classInstanceSize, HaltExp), EXP.tuple: __traits(classInstanceSize, TupleExp), EXP.error: __traits(classInstanceSize, ErrorExp), EXP.void_: __traits(classInstanceSize, VoidInitExp), EXP.int64: __traits(classInstanceSize, IntegerExp), EXP.float64: __traits(classInstanceSize, RealExp), EXP.complex80: __traits(classInstanceSize, ComplexExp), EXP.import_: __traits(classInstanceSize, ImportExp), EXP.delegate_: __traits(classInstanceSize, DelegateExp), EXP.function_: __traits(classInstanceSize, FuncExp), EXP.mixin_: __traits(classInstanceSize, MixinExp), EXP.in_: __traits(classInstanceSize, InExp), EXP.break_: __traits(classInstanceSize, CTFEExp), EXP.continue_: __traits(classInstanceSize, CTFEExp), EXP.goto_: __traits(classInstanceSize, CTFEExp), EXP.scope_: __traits(classInstanceSize, ScopeExp), EXP.traits: __traits(classInstanceSize, TraitsExp), EXP.overloadSet: __traits(classInstanceSize, OverExp), EXP.line: __traits(classInstanceSize, LineInitExp), EXP.file: __traits(classInstanceSize, FileInitExp), EXP.fileFullPath: __traits(classInstanceSize, FileInitExp), EXP.moduleString: __traits(classInstanceSize, ModuleInitExp), EXP.functionString: __traits(classInstanceSize, FuncInitExp), EXP.prettyFunction: __traits(classInstanceSize, PrettyFuncInitExp), EXP.pow: __traits(classInstanceSize, PowExp), EXP.powAssign: __traits(classInstanceSize, PowAssignExp), EXP.vector: __traits(classInstanceSize, VectorExp), EXP.voidExpression: __traits(classInstanceSize, CTFEExp), EXP.cantExpression: __traits(classInstanceSize, CTFEExp), EXP.showCtfeContext: __traits(classInstanceSize, CTFEExp), EXP.objcClassReference: __traits(classInstanceSize, ObjcClassReferenceExp), EXP.vectorArray: __traits(classInstanceSize, VectorArrayExp), EXP.compoundLiteral: __traits(classInstanceSize, CompoundLiteralExp), EXP._Generic: __traits(classInstanceSize, GenericExp), EXP.interval: __traits(classInstanceSize, IntervalExp), EXP.loweredAssignExp : __traits(classInstanceSize, LoweredAssignExp), ];
D
# FIXED OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/common/osal_cbtimer.c OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/limits.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/comdef.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdint.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_stdint40.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/stdint.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/cdefs.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_types.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_types.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_stdint.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_stdint.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdbool.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_defs.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_memory.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_timers.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdlib.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_ti_config.h OSAL/osal_cbtimer.obj: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/linkage.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_assert.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_tasks.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_mcu.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_nvic.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_ints.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_types.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/../inc/hw_chip_def.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_gpio.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_memmap.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/systick.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/debug.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/interrupt.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/cpu.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_cpu_scs.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../driverlib/rom.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/uart.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_uart.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/gpio.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/flash.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_flash.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_sysctl.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_fcfg1.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/ioc.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ioc.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_cbtimer.h OSAL/osal_cbtimer.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/inc/bcomdef.h C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/common/osal_cbtimer.c: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/limits.h: 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/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdint.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_stdint40.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/stdint.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/cdefs.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_types.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_types.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_stdint.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_stdint.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.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_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/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdlib.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_ti_config.h: C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.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/osal/src/inc/osal_tasks.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_mcu.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/devices/cc26x0r2/inc/hw_nvic.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_ints.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_types.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/../inc/hw_chip_def.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_gpio.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_memmap.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/systick.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/debug.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/interrupt.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/cpu.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_cpu_scs.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../driverlib/rom.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/uart.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_uart.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/gpio.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/flash.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_flash.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_sysctl.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_fcfg1.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/ioc.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ioc.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_cbtimer.h: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/inc/bcomdef.h:
D
a basic generalization that is accepted as true and that can be used as a basis for reasoning or conduct a rule or standard especially of good behavior a basic truth or law or assumption a rule or law concerning a natural phenomenon or the function of a complex system rule of personal conduct (law) an explanation of the fundamental reasons (especially an explanation of the working of some device in terms of laws of nature
D
/*#D*/ // Copyright 2012-2013, Bernard Helyer. // SPDX-License-Identifier: BSL-1.0 module volt.lowerer.typeidreplacer; import watt.text.format : format; import ir = volta.ir; import volta.util.util; import volt.exceptions; import volt.interfaces; import volta.visitor.visitor; import volt.semantic.mangle; import volt.semantic.lookup; import volt.semantic.typeinfo; /*! * Replaces typeid(...) expressions with a call * to the TypeInfo's constructor. */ class TypeidReplacer : NullVisitor, Pass { public: LanguagePass lp; ir.Struct typeinfoVtable; ir.Module thisModule; public: this(LanguagePass lp) { this.lp = lp; } override void transform(ir.Module m) { thisModule = m; accept(m, this); } override void close() { } override Status enter(ref ir.Exp exp, ir.Typeid _typeid) { assert(_typeid.type !is null); auto literalVar = getTypeInfo(lp, thisModule, _typeid.type); exp = buildExpReference(/*#ref*/exp.loc, literalVar, literalVar.name); return Continue; } }
D
// D import file generated from 'src/librabbitmq_client.d' private { import tango.io.Stdout; } private { import tango.stdc.string; } private { import tango.net.device.Socket; } private { import tango.stdc.stringz; } private { import tango.stdc.stdio; } private { import mom_client; } private { import amqp_base; } private { import amqp; } private { import amqp_framing; } private { import amqp_private; } private { import amqp_connection; } private { import amqp_socket; } private { import amqp_api; } private { import amqp_mem; } private { import Log; } private { import tango.core.Thread; } class librabbitmq_client : mom_client { amqp_connection_state_t* conn; char[] vhost; char[] login; char[] passw; char* bindingkey = null; char* exchange = cast(char*)"\x00"; int waiting_for_login = 5; Socket socket; char[] hostname; int port; void function(byte* txt, ulong size, mom_client from_client) message_acceptor; this(char[] _hostname, int _port, char[] _login, char[] _passw, char[] _queue, char[] _vhost) { hostname = _hostname; port = _port; login = _login; passw = _passw; bindingkey = cast(char*)_queue; vhost = _vhost; } void set_callback(void function(byte* txt, ulong size, mom_client from_client) _message_acceptor) { message_acceptor = _message_acceptor; } int send(char* routingkey, char* messagebody); char* get_message() { return null; } void listener(); }
D
/root/pkg/portex_pkg/simulation/service/target/release/deps/c2_chacha-918a31f67b6b8407.rmeta: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/lib.rs /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/guts.rs /root/pkg/portex_pkg/simulation/service/target/release/deps/libc2_chacha-918a31f67b6b8407.rlib: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/lib.rs /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/guts.rs /root/pkg/portex_pkg/simulation/service/target/release/deps/c2_chacha-918a31f67b6b8407.d: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/lib.rs /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/guts.rs /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/lib.rs: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/c2-chacha-0.2.3/src/guts.rs:
D
//***************************************************************************** // // Sketching plugging LUA to game engine. // //***************************************************************************** import engine; import engine.util.lua: Lua; //***************************************************************************** // // How I want it to work (sketch): // // main.d: // // auto skybox = SkyBox("path/to/skybox.lua"); // // skybox1.lua: // // cubemap = Cubemap("img1", "img2", ...); // return SkyBox(cubemap); // //***************************************************************************** import std.variant: Variant; void printout(Variant[] args) { foreach(arg; args) format(" %s", arg.to!string) >> Log; } void printout(Variant arg) { printout([arg]); } void printout(string prefix, Variant[] args) { Log << prefix; printout(args); } void printout(string prefix, Variant arg) { printout(prefix, [arg]); } //----------------------------------------------------------------------------- class TestClass1 { string name; this(string name) { this.name = name; } } class TestClass2 { string name; this(string name) { this.name = name; } } //----------------------------------------------------------------------------- extern(C) nothrow int bounceback(lua_State *L) { try { auto lua = Lua.attach(L); auto args = lua.args(); Log("called: bounce(%s)", args); return lua.result(args); } catch(Throwable e) { try e >> Log; catch(Throwable) {} assert(0); } } luaL_Reg[] bouncelib = [ luaL_Reg("bounceback", &bounceback), luaL_Reg(null, null) ]; //----------------------------------------------------------------------------- // Creating interface for LUA to access D functions //----------------------------------------------------------------------------- auto test() { auto lua = new Lua(); scope(exit) { lua.destroy(); } //------------------------------------------------------------------------- lua["_VERSION"].value >> Log; lua.load("data/test.lua").to!string >> Log; //------------------------------------------------------------------------- // Get reference to string, and use it to call format //------------------------------------------------------------------------- { auto luashow = lua["show"]; luashow.call("1", "2", "3"); luashow.call("4", "5", "6"); auto multiret = lua["multiret"]; printout("luashow", luashow.call("7", "8", "9")); } { lua["string"]["format"].call("Test: %s %d", "test", 1) >> Log; auto stringlib = lua["string"]; auto stringfmt = stringlib["format"]; stringlib.to!string >> Log; stringlib["format"].to!string >> Log; stringfmt.to!string >> Log; stringlib["format"].call("%s.%s (%d)", "string", "format", 2) >> Log; stringfmt.call("%s.%s (%d)", "string", "format", 1) >> Log; } static if(0) { //------------------------------------------------------------------------- // Sending and receiving D objects //------------------------------------------------------------------------- { auto a = new TestClass2("a"); lua["print"].call(a); auto r = lua.call(&bounceback, a); r >> Log; //r[0].get!(Object*) >> Log; //(cast(Object)r[0].get!(void*)).classinfo.toString >> Log; //(cast(TestClass1)r[0].get!(void*)).name >> Log; } //------------------------------------------------------------------------- // These are "equal" (one is Ref, another is Variant(Ref) //------------------------------------------------------------------------- lua["math"] >> Log; // Ref 2 table lua["math"].value >> Log; // Variant(Ref 2 table) //------------------------------------------------------------------------- // These are not. First is Ref, another is Variant(3.14) //------------------------------------------------------------------------- lua["math"]["pi"] >> Log; // Ref 2 number lua["math"]["pi"].value >> Log; // Variant(3.14) //lua["math"]["abs"]["x"] = 1; // Should crash //------------------------------------------------------------------------- // Inspect table created in lua file //------------------------------------------------------------------------- //lua["mytable"].value(); printout("mytable['a'] = ", lua["mytable"]["a"].value); printout("mytable['c'][1] = ", lua["mytable"]["c"][1].value); printout("mytable[1] = ", lua["mytable"][1].value); printout("mytable['1'] = ", lua["mytable"]["1"].value); //------------------------------------------------------------------------- lua["a"] = 101; lua["a"].value() >> Log; lua["mytable"]["c"][1] = "c"; lua["mytable"]["c"][1].value() >> Log; lua["show"].call(1, 2, 3) >> Log; //------------------------------------------------------------------------- // Call lua function: //------------------------------------------------------------------------- printout("show:", lua["show"].call(1, 2, lua["math"])); printout("show:", lua["show"].call(4, 5, lua["math"]["abs"])); printout("show:", lua["show"].call("A", 8, "B")); //printout("show:", lua["show"].call(&bounceback, 2, 3)); //------------------------------------------------------------------------- // Check multi return //------------------------------------------------------------------------- printout("multiret:", lua["multiret"].call()); //------------------------------------------------------------------------- // Inspect tables //------------------------------------------------------------------------- printout("Keys:", lua["mytable"].keys()); printout("_G:", lua["_G"].keys()); //------------------------------------------------------------------------- // Call function via table: string.format //------------------------------------------------------------------------- printout("string.format:", lua["string"]["format"].call("Test %d", 12)); //------------------------------------------------------------------------- // Register function and call it //------------------------------------------------------------------------- lua["gbounce"] = &bounceback; lua["gbounce"].call("global", "bounce") >> Log; lua["mytable"]["bounce"] = &bounceback; lua["mytable"]["bounce"].call("mytable", "bounce") >> Log; lua["bounce"] = bouncelib; lua["bounce"]["bounceback"].call("bounce", "lib") >> Log; printout("callbounce:", lua["callbounce"].call(1)); //------------------------------------------------------------------------- // Fixed: Leaves carbage to stack //------------------------------------------------------------------------- lua["show"]; //------------------------------------------------------------------------- // howdy() returns table, check it //------------------------------------------------------------------------- /* auto howdy = lua["howdy"]; writeln("howdy = ", howdy.type); auto ret = howdy(); printout("howdy():", ret); ret[0].dumptable(); /**/ } //------------------------------------------------------------------------- "Done." >> Log; //------------------------------------------------------------------------- // Another way to get ref out from scope. //------------------------------------------------------------------------- //return lua["mytable"]; } void main() { vfs.fallback = true; test(); // It might be good idea to run GC after assets are loaded (I // think it will produce lots of memory allocations). Track.GC.run(); debug Track.report(); "All done." >> Log; }
D
/home/ankit/pandora/substrate-node-template/target/release/deps/subtle-3518910b8651a592.rmeta: /home/ankit/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.0/src/lib.rs /home/ankit/pandora/substrate-node-template/target/release/deps/libsubtle-3518910b8651a592.rlib: /home/ankit/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.0/src/lib.rs /home/ankit/pandora/substrate-node-template/target/release/deps/subtle-3518910b8651a592.d: /home/ankit/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.0/src/lib.rs /home/ankit/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.0/src/lib.rs:
D
int* p; int[3] s; int[] a; p.length; // error, length not known for pointer s.length; // compile time constant 3 a.length; // runtime value p.dup; // error, length not known s.dup; // creates an array of 3 elements, copies // elements s into it a.dup; // creates an array of a.length elements, copies // elements of a into it
D
module dcompute.driver.ocl.raw120; public import dcompute.driver.ocl.raw120.types; public import dcompute.driver.ocl.raw120.functions; public import dcompute.driver.ocl.raw120.enums; public import derelict.opencl.cl;
D
any cold-blooded vertebrate of the class Reptilia including tortoises, turtles, snakes, lizards, alligators, crocodiles, and extinct forms of or relating to the class Reptilia
D
module http_server; import std.stdio; import lifx_gateway; import vibe.vibe; class HTTPServer { public this() { m_gateway = new LIFXGateway(); auto settings = new HTTPServerSettings; settings.port = 8080; auto router = new URLRouter; router.get("/socket", handleWebSockets(&handleConn)); router.get("/", serveStaticFile("./public/index.html")); router.get("*", serveStaticFiles("./public/")); router.get("*", serveStaticFile("./public/index.html")); listenHTTP(settings, router); } private string encode_packet(string type, Json params = null) { Json result = Json.emptyObject; result.message = type; result.params = params; return serializeToJson(result).toString(); } private void handleConn(WebSocket socket) { // TODO: Register ourselves for the various broadcasts // Perhaps means we should break out as a separate object too, we'll see while (socket.connected) { auto packet_string = socket.receiveText(); writeln("Websockets: " ~ packet_string); auto packet = parseJsonString(packet_string); // TODO: We could do some sort of hashed dispatch to delegates... MEH for now if (packet.message == "get_light_state") { socket.send(encode_packet("light_state", m_gateway.get_light_state())); } else if (packet.message == "toggle_power") { writeln("Toggling light power state!"); m_gateway.toggle_power(packet.params["id"].get!string); } } } private LIFXGateway m_gateway; }
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 vtkMemoryLimitImageDataStreamer; 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 vtkImageDataStreamer; class vtkMemoryLimitImageDataStreamer : vtkImageDataStreamer.vtkImageDataStreamer { private void* swigCPtr; public this(void* cObject, bool ownCObject) { super(vtkd_im.vtkMemoryLimitImageDataStreamer_Upcast(cObject), ownCObject); swigCPtr = cObject; } public static void* swigGetCPtr(vtkMemoryLimitImageDataStreamer 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 vtkMemoryLimitImageDataStreamer New() { void* cPtr = vtkd_im.vtkMemoryLimitImageDataStreamer_New(); vtkMemoryLimitImageDataStreamer ret = (cPtr is null) ? null : new vtkMemoryLimitImageDataStreamer(cPtr, false); return ret; } public static int IsTypeOf(string type) { auto ret = vtkd_im.vtkMemoryLimitImageDataStreamer_IsTypeOf((type ? std.string.toStringz(type) : null)); return ret; } public static vtkMemoryLimitImageDataStreamer SafeDownCast(vtkObjectBase.vtkObjectBase o) { void* cPtr = vtkd_im.vtkMemoryLimitImageDataStreamer_SafeDownCast(vtkObjectBase.vtkObjectBase.swigGetCPtr(o)); vtkMemoryLimitImageDataStreamer ret = (cPtr is null) ? null : new vtkMemoryLimitImageDataStreamer(cPtr, false); return ret; } public vtkMemoryLimitImageDataStreamer NewInstance() const { void* cPtr = vtkd_im.vtkMemoryLimitImageDataStreamer_NewInstance(cast(void*)swigCPtr); vtkMemoryLimitImageDataStreamer ret = (cPtr is null) ? null : new vtkMemoryLimitImageDataStreamer(cPtr, false); return ret; } alias vtkImageDataStreamer.vtkImageDataStreamer.NewInstance NewInstance; public void SetMemoryLimit(core.stdc.config.c_ulong _arg) { vtkd_im.vtkMemoryLimitImageDataStreamer_SetMemoryLimit(cast(void*)swigCPtr, _arg); } public core.stdc.config.c_ulong GetMemoryLimit() { auto ret = vtkd_im.vtkMemoryLimitImageDataStreamer_GetMemoryLimit(cast(void*)swigCPtr); return ret; } }
D
func void ZS_ClearRoom () { PrintDebugNpc (PD_ZS_FRAME, "ZS_ClearRoom" ); Npc_PercEnable (self, PERC_ASSESSDAMAGE , ZS_ReactToDamage ); Npc_PercEnable (self, PERC_ASSESSMAGIC , B_AssessMagic ); Npc_PercEnable (self, PERC_ASSESSENTERROOM , B_ClearRoomEnterRoom); Npc_PercEnable (self, PERC_ASSESSUSEMOB , B_ClearRoomUseMob ); Npc_PercEnable (self, PERC_ASSESSFIGHTSOUND , B_AssessFightSound ); Npc_PercEnable (self, PERC_MOVENPC , B_StopGotoHero ); C_ZSInit(); B_WhirlAround (self, other); AI_PointAtNpc (self, other); B_Say (self, other, "$HEYYOU"); AI_StopPointAt (self); AI_SetWalkmode (self, NPC_RUN); Npc_SetTarget (self, other); }; func int ZS_ClearRoom_Loop () { PrintDebugNpc (PD_ZS_LOOP, "ZS_ClearRoom_Loop" ); Npc_GetTarget (self); //-------- SC hat mittlerweile den Raum verlassen -------- var int portalguild; portalguild = Wld_GetPlayerPortalGuild(); PrintGuild (PD_ZS_CHECK, portalguild); if (portalguild == GIL_NONE) || (Wld_GetGuildAttitude(self.guild, portalguild) != ATT_FRIENDLY) || (Npc_GetAttitude(self,other) == ATT_FRIENDLY) { B_FullStop (self); AI_ContinueRoutine(self); return LOOP_END; }; //-------- NSC hat den SC erreicht ! -------- if (Npc_GetDistToNpc(self, other) < PERC_DIST_DIALOG && Npc_CanSeeNpc (self, other) ) { B_FullStop (self); return LOOP_END; }; AI_GotoNpc (self, other); AI_Wait (self, 0.5); return LOOP_CONTINUE; }; func void ZS_ClearRoom_End () { PrintDebugNpc (PD_ZS_FRAME, "ZS_ClearRoom_End" ); AI_TurnToNpc (self, other); if (C_AmIStronger (self, other)) { PrintDebugNpc (PD_ZS_CHECK, "...Nsc ist stärker!"); B_DrawWeapon (self, other); B_Say (self, other, "$GETOUTOFHERE"); AI_StartState (self, ZS_ClearRoomWait, 0, ""); } else { PrintDebugNpc (PD_ZS_CHECK, "...Nsc ist schwächer!"); B_Say (self, other, "$WHYAREYOUINHERE "); AI_StartState (self, ZS_ClearRoomWait, 0, ""); }; }; func void ZS_ClearRoomWait () { PrintDebugNpc (PD_ZS_FRAME, "ZS_ClearRoomWait" ); Npc_PercEnable (self, PERC_ASSESSDAMAGE , ZS_ReactToDamage ); Npc_PercEnable (self, PERC_ASSESSMAGIC , B_AssessMagic ); Npc_PercEnable (self, PERC_ASSESSENTERROOM , B_ClearRoomEnterRoom); Npc_PercEnable (self, PERC_ASSESSUSEMOB , B_ClearRoomUseMob ); Npc_PercEnable (self, PERC_ASSESSFIGHTSOUND , B_AssessFightSound ); C_ZSInit(); }; func void ZS_ClearRoomWait_Loop () { /* if (other.aivar[AIV_DIDWAITTOCLEARROOM] == 1) { other.aivar[AIV_DIDWAITTOCLEARROOM] = 0; AI_ContinueRoutine ( self); }; */ PrintDebugNpc (PD_ZS_LOOP, "ZS_ClearRoomWait_Loop" ); if (Npc_GetStateTime(self) > 8) { PrintDebugNpc (PD_ZS_CHECK, "...NSC wartet seit 8 Sekunden!"); if (Wld_GetPlayerPortalGuild () == GIL_NONE) || (Npc_GetAttitude(self, other) == ATT_FRIENDLY) { if (C_AmIStronger(self,other)) { AI_TurnToNpc(self, other); B_Say (self, other, "$WISEMOVE"); }; AI_ContinueRoutine(self); } else if (C_AmIStronger (self,other)) { B_Say (self, other, "$YOUASKEDFORIT"); B_SetAttackReason (self, AIV_AR_INTRUDER); // für bessere Abfrage bei ZS_Attack Npc_SetTarget (self,other); AI_StartState (self, ZS_Attack, 0, ""); } else { AI_StartState (self, ZS_CallGuardsOnEnterRoom, 0, ""); }; }; AI_Wait (self, 1); }; func void ZS_ClearRoomWait_End () { PrintDebugNpc (PD_ZS_FRAME, "ZS_ClearRoomWait_End" ); }; func void B_ClearRoomEnterRoom() { PrintDebugNpc (PD_ZS_FRAME, "B_ClearRoomEnterRoom" ); B_FullStop ( self); if (Npc_CanSeeNpcFreeLOS(self,other)) { PrintDebugNpc (PD_ZS_CHECK, "...NSC kann SC sehen!"); if (Wld_GetPlayerPortalGuild () == GIL_NONE ) { PrintDebugNpc (PD_ZS_CHECK, "...SC nicht mehr im Raum!"); if (C_AmIStronger(self,other)) { AI_TurnToNpc(self, other); B_Say (self, other, "$WISEMOVE"); }; AI_ContinueRoutine(self); } else { PrintDebugNpc (PD_ZS_CHECK, "...SC wieder im Raum!"); if (C_AmIStronger(self,other)) { PrintDebugNpc (PD_ZS_CHECK, "...stronger"); AI_TurnToNpc(self, other); B_Say (self, other, "$YOUASKEDFORIT"); B_SetAttackReason (self, AIV_AR_INTRUDER); // für bessere Abfrage bei ZS_Attack Npc_SetTarget (self,other); AI_StartState (self, ZS_Attack, 0, ""); } else { PrintDebugNpc (PD_ZS_CHECK, "...not stronger--> CallGuards"); AI_StartState (self, ZS_CallGuardsOnEnterRoom, 0, ""); }; }; }; }; func void B_ClearRoomUseMob() { PrintDebugNpc (PD_ZS_FRAME, "B_ClearRoomUseMob"); if Npc_IsDetectedMobOwnedByNpc(other, self) || Npc_IsDetectedMobOwnedByGuild(other, self.guild) { PrintDebugNpc (PD_ZS_CHECK, "...MOB gehört NSC oder seiner Gilde!"); B_FullStop (self); Npc_PercDisable (self, PERC_ASSESSUSEMOB); B_AssessAndMemorize (NEWS_THEFT, NEWS_SOURCE_WITNESS, self, other, self); if (C_AmIStronger(self,other)) { B_Say (self, other, "$DIRTYTHIEF"); Npc_SetTarget (self, other); AI_StartState (self, ZS_Attack, 0, ""); } else { AI_StartState (self, ZS_CallGuardsOnEnterRoom, 0, ""); }; }; };
D
/** ... Copyright: © 2012 Matthias Dondorff License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. Authors: Matthias Dondorff */ module dub.internal.utils; import dub.internal.vibecompat.core.file; import dub.internal.vibecompat.core.log; import dub.internal.vibecompat.data.json; import dub.internal.vibecompat.inet.url; import dub.version_; // todo: cleanup imports. import std.algorithm : startsWith; import std.array; import std.conv; import std.exception; import std.file; import std.process; import std.string; import std.typecons; import std.zip; version(DubUseCurl) import std.net.curl; Path getTempDir() { auto tmp = environment.get("TEMP"); if( !tmp.length ) tmp = environment.get("TMP"); if( !tmp.length ){ version(Posix) tmp = "/tmp/"; else tmp = "./"; } return Path(tmp); } bool isEmptyDir(Path p) { foreach(DirEntry e; dirEntries(p.toNativeString(), SpanMode.shallow)) return false; return true; } bool isWritableDir(Path p, bool create_if_missing = false) { import std.random; auto fname = p ~ format("__dub_write_test_%08X", uniform(0, uint.max)); if (create_if_missing && !exists(p.toNativeString())) mkdirRecurse(p.toNativeString()); try openFile(fname, FileMode.CreateTrunc).close(); catch (Exception) return false; remove(fname.toNativeString()); return true; } Json jsonFromFile(Path file, bool silent_fail = false) { if( silent_fail && !existsFile(file) ) return Json.emptyObject; auto f = openFile(file.toNativeString(), FileMode.Read); scope(exit) f.close(); auto text = stripUTF8Bom(cast(string)f.readAll()); return parseJsonString(text, file.toNativeString()); } Json jsonFromZip(Path zip, string filename) { auto f = openFile(zip, FileMode.Read); ubyte[] b = new ubyte[cast(size_t)f.size]; f.rawRead(b); f.close(); auto archive = new ZipArchive(b); auto text = stripUTF8Bom(cast(string)archive.expand(archive.directory[filename])); return parseJsonString(text, zip.toNativeString~"/"~filename); } void writeJsonFile(Path path, Json json) { auto f = openFile(path, FileMode.CreateTrunc); scope(exit) f.close(); f.writePrettyJsonString(json); } bool isPathFromZip(string p) { enforce(p.length > 0); return p[$-1] == '/'; } bool existsDirectory(Path path) { if( !existsFile(path) ) return false; auto fi = getFileInfo(path); return fi.isDirectory; } void runCommands(in string[] commands, string[string] env = null) { foreach(cmd; commands){ logDiagnostic("Running %s", cmd); Pid pid; if( env !is null ) pid = spawnShell(cmd, env); else pid = spawnShell(cmd); auto exitcode = pid.wait(); enforce(exitcode == 0, "Command failed with exit code "~to!string(exitcode)); } } /** Downloads a file from the specified URL. Any redirects will be followed until the actual file resource is reached or if the redirection limit of 10 is reached. Note that only HTTP(S) is currently supported. */ void download(string url, string filename) { version(DubUseCurl) { auto conn = HTTP(); setupHTTPClient(conn); logDebug("Storing %s...", url); std.net.curl.download(url, filename, conn); enforce(conn.statusLine.code < 400, format("Failed to download %s: %s %s", url, conn.statusLine.code, conn.statusLine.reason)); } else version (Have_vibe_d) { import vibe.inet.urltransfer; vibe.inet.urltransfer.download(url, filename); } else assert(false); } /// ditto void download(URL url, Path filename) { download(url.toString(), filename.toNativeString()); } /// ditto ubyte[] download(string url) { version(DubUseCurl) { auto conn = HTTP(); setupHTTPClient(conn); logDebug("Getting %s...", url); auto ret = cast(ubyte[])get(url, conn); enforce(conn.statusLine.code < 400, format("Failed to GET %s: %s %s", url, conn.statusLine.code, conn.statusLine.reason)); return ret; } else version (Have_vibe_d) { import vibe.inet.urltransfer; import vibe.stream.operations; ubyte[] ret; download(url, (scope input) { ret = input.readAll(); }); return ret; } else assert(false); } /// ditto ubyte[] download(URL url) { return download(url.toString()); } /// Returns the current DUB version in semantic version format string getDUBVersion() { import dub.version_; // convert version string to valid SemVer format auto verstr = dubVersion; if (verstr.startsWith("v")) verstr = verstr[1 .. $]; auto parts = verstr.split("-"); if (parts.length >= 3) { // detect GIT commit suffix if (parts[$-1].length == 8 && parts[$-1][1 .. $].isHexNumber() && parts[$-2].isNumber()) verstr = parts[0 .. $-2].join("-") ~ "+" ~ parts[$-2 .. $].join("-"); } return verstr; } version(DubUseCurl) { void setupHTTPClient(ref HTTP conn) { static if( is(typeof(&conn.verifyPeer)) ) conn.verifyPeer = false; auto proxy = environment.get("http_proxy", null); if (proxy.length) conn.proxy = proxy; conn.addRequestHeader("User-Agent", "dub/"~getDUBVersion()~" (std.net.curl; +https://github.com/rejectedsoftware/dub)"); } } string stripUTF8Bom(string str) { if( str.length >= 3 && str[0 .. 3] == [0xEF, 0xBB, 0xBF] ) return str[3 ..$]; return str; } private bool isNumber(string str) { foreach (ch; str) switch (ch) { case '0': .. case '9': break; default: return false; } return true; } private bool isHexNumber(string str) { foreach (ch; str) switch (ch) { case '0': .. case '9': break; case 'a': .. case 'f': break; case 'A': .. case 'F': break; default: return false; } return true; } /** Get the closest match of $(D input) in the $(D array), where $(D distance) is the maximum levenshtein distance allowed between the compared strings. Returns $(D null) if no closest match is found. */ string getClosestMatch(string[] array, string input, size_t distance) { import std.algorithm : countUntil, map, levenshteinDistance; import std.uni : toUpper; auto distMap = array.map!(elem => levenshteinDistance!((a, b) => toUpper(a) == toUpper(b))(elem, input)); auto idx = distMap.countUntil!(a => a <= distance); return (idx == -1) ? null : array[idx]; }
D
module si_tm2; import si; import std.stream; import std.stdio; import std.intrinsic; import std.path; import std.file; import std.process; align(1) struct TIM2Header { char[4] FileId = "TIM2"; // ID of the File (must be 'T', 'I', 'M' and '2') ubyte FormatVersion; // Version number of the format ubyte FormatId; // ID of the format ushort Pictures; // Number of picture data ubyte[8] pad; // Padding (must be 0x00) } align(1) struct TIM2EntryHeader { uint TotalSize; // Total size of the picture data in bytes uint ClutSize; // CLUT data size in bytes uint ImageSize; // Image data size in bytes ushort HeaderSize; // Header size in bytes ushort ClutColors; // Total color number in CLUT data ubyte PictFormat; // ID of the picture format (must be 0) ubyte MipMapTexs; // Number of MIPMAP texture ubyte ClutType; // Type of the CLUT data ubyte ImageType; // Type of the Image data ushort ImageWidth; // Width of the picture ushort ImageHeight; // Height of the picture ubyte GsTex0[8]; // Data for GS TEX0 register ubyte GsTex1[8]; // Data for GS TEX1 register uint GsRegs; // Data for GS TEXA, FBA, PABE register uint GsTexClut; // Data for GS TEXCLUT register } align(1) struct TIM2MipMapHeader{ ulong GsMiptbp1; ulong GsMiptbp2; uint MMImageSize[0]; } align(1) struct TIM2ExtHeader { ubyte[4] ExHeaderId = ['e', 'X', 't', 0]; uint UserSpaceSize; uint UserDataSize; uint Reserved; } //debug = tm2_stream; class ImageFileFormat_TM2 : ImageFileFormat { override char[] identifier() { return "tm2"; } char[] header = "TIM2"; override bool update(Image i, Stream s) { return false; } override Image read(Stream s) { Image ic = new Bitmap8(1, 1); TIM2Header h; s.read(TA(h)); if (h.FileId != "TIM2") throw(new Exception("File isn't a TIM2 one")); int pcount = h.Pictures; while (pcount--) { ubyte[] palette; ubyte[] dimage; // Leemos el header TIM2EntryHeader teh; s.read(TA(teh)); s.seek(teh.HeaderSize - teh.sizeof, SeekPos.Current); // Leemos la imagen dimage.length = teh.ImageSize; s.read(dimage); //writefln(teh.ImageType); switch (teh.ImageType) { default: throw(new Exception(std.string.format("Unknown TIM2 Image Type 0x%02X", teh.ImageType))); case 0x05: // con paleta (4 bits) 8bpp Bitmap8 i = new Bitmap8(teh.ImageWidth, teh.ImageHeight); switch (teh.ClutType) { default: throw(new Exception(std.string.format("Unknown TIM2 Clut Type 0x%02X", teh.ClutType))); case 0x02: case 0x03: uint pbpp = (teh.ClutType + 1); //writefln("TYPE:", pbpp); //s.seek(teh.ClutSize - pbpp * 0x10, SeekPos.Current); // Leemos la paleta palette.length = teh.ClutSize; s.read(palette); //writefln("%d", teh.ClutColors); i.ncolor = teh.ClutColors; for (int y = 0, n = 0; y < teh.ImageHeight; y++) { for (int x = 0; x < teh.ImageWidth; x++, n++) { i.set(x, y, dimage[n]); } } for (int n = 0; n < i.ncolor; n++) { RGBA c = RGBA(palette[n * pbpp + 0], palette[n * pbpp + 1], palette[n * pbpp + 2]); if (pbpp > 3) c.a = palette[n * pbpp + 3]; i.color(n, c); } // Unswizzle for (int n = 8; n < 256; n += 4 * 8) for (int m = 0; m < 8; m++) i.colorSwap(n + m, n + m + 8); break; } ic.childs ~= i; break; case 0x04: // con paleta (4 bits) 4bpp Bitmap8 i = new Bitmap8(teh.ImageWidth, teh.ImageHeight); switch (teh.ClutType) { default: throw(new Exception(std.string.format("Unknown TIM2 Clut Type 0x%02X", teh.ClutType))); case 0x02: case 0x03: uint pbpp = (teh.ClutType + 1); palette.length = teh.ClutSize; s.read(palette); i.ncolor = teh.ClutColors; for (int y = 0, n = 0; y < teh.ImageHeight; y++) { for (int x = 0; x < teh.ImageWidth; x += 2, n++) { i.set(x + 0, y, (dimage[n] & 0x0F) >> 0); i.set(x + 1, y, (dimage[n] & 0xF0) >> 4); } } for (int n = 0; n < i.ncolor; n++) { RGBA c = RGBA(palette[n * pbpp + 0], palette[n * pbpp + 1], palette[n * pbpp + 2]); if (pbpp > 3) c.a = palette[n * pbpp + 3]; i.color(n, c); //writefln("%02X%02X%02X%02X", c.r, c.g, c.b, c.a); } break; } ic.childs ~= i; break; case 0x03: // a 32 bits Bitmap32 i = new Bitmap32(teh.ImageWidth, teh.ImageHeight); for (int y = 0, n = 0; y < teh.ImageHeight; y++) { for (int x = 0; x < teh.ImageWidth; x++, n += 4) { RGBA c = RGBA(dimage[n + 0], dimage[n + 1], dimage[n + 2], dimage[n + 3]); i.set(x, y, c.v); } } ic.childs ~= i; break; } } return ic; } override int check(Stream s) { return (s.readString(header.length) == header) ? 10 : 0; } } static this() { ImageFileFormatProvider.registerFormat(new ImageFileFormat_TM2); }
D
instance NOV_1354_Novize(Npc_Default) { name[0] = NAME_Novize; npcType = npctype_ambient; guild = GIL_NOV; level = 3; flags = 0; voice = 5; id = 1354; attribute[ATR_STRENGTH] = 20; attribute[ATR_DEXTERITY] = 20; attribute[ATR_MANA_MAX] = 0; attribute[ATR_MANA] = 0; attribute[ATR_HITPOINTS_MAX] = 106; attribute[ATR_HITPOINTS] = 106; Mdl_SetVisual(self,"HUMANS.MDS"); Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds"); Mdl_SetVisualBody(self,"hum_body_Naked0",1,1,"Hum_Head_FatBald",33,2,nov_armor_l); B_Scale(self); Mdl_SetModelFatness(self,-1); fight_tactic = FAI_HUMAN_COWARD; EquipItem(self,ItMw_1H_Hatchet_01); daily_routine = Rtn_start_1354; }; func void Rtn_start_1354() { TA_Sleep(2,0,7,35,"PSI_19_HUT_IN"); TA_Smalltalk(7,35,2,0,"PSI_19_HUT_EX"); };
D
/* * This file has been automatically generated by Soupply and released under the MIT license. */ module soupply.java316; public import soupply.java316.packet; public import soupply.java316.types; public import soupply.java316.protocol; public import soupply.java316.metadata;
D
instance PIR_1320_Addon_Greg (Npc_Default) { // ------ NSC ------ name = "Greg"; guild = GIL_PIR; id = 1320; voice = 1; flags = NPC_FLAG_IMMORTAL; npctype = NPCTYPE_MAIN; // ------ Attribute ------ B_SetAttributesToChapter (self, 5); //setzt Attribute und LEVEL entsprechend dem angegebenen Kapitel (1-6) self.aivar[AIV_IGNORE_Murder] = TRUE; self.aivar[AIV_IGNORE_Theft] = TRUE; self.aivar[AIV_IGNORE_Sheepkiller] = TRUE; self.aivar[AIV_ToughGuy] = TRUE; // ------ Kampf-Taktik ------ fight_tactic = FAI_HUMAN_MASTER; // MASTER / STRONG / COWARD // ------ Equippte Waffen ------ //Munition wird automatisch generiert, darf aber angegeben werden EquipItem (self, ItMw_Piratensaebel); //EquipItem (self, ItRw_Bow_H_01); // ------ Inventory ------ B_CreateAmbientInv (self); // ------ visuals ------ //Muss NACH Attributen kommen, weil in B_SetNpcVisual die Breite abh. v. STR skaliert wird B_SetNpcVisual (self, MALE, "Hum_Head_Thief", Face_P_Greg, BodyTex_P, ITAR_PIR_H_Addon); Mdl_SetModelFatness (self, 1); Mdl_ApplyOverlayMds (self, "Humans_Relaxed.mds"); // Tired / Militia / Mage / Arrogance / Relaxed // ------ NSC-relevante Talente vergeben ------ B_GiveNpcTalents (self); // ------ Kampf-Talente ------ //Der enthaltene B_AddFightSkill setzt Talent-Ani abhängig von TrefferChance% - alle Kampftalente werden gleichhoch gesetzt B_SetFightSkills (self, 80); //Grenzen für Talent-Level liegen bei 30 und 60 // ------ TA anmelden ------ daily_routine = Rtn_Start_1320; }; FUNC VOID Rtn_Start_1320 () { TA_Stand_WP (05,00,20,00,"ADW_PIRATECAMP_GREG"); TA_Stand_WP (20,00,05,00,"ADW_PIRATECAMP_GREG"); }; FUNC VOID Rtn_HOME_1320 () { TA_Sit_Bench (22,00,12,00,"ADW_PIRATECAMP_HUT4_01"); TA_Sit_Bench (12,00,22,00,"ADW_PIRATECAMP_HUT4_01"); };
D
module foobar; import std.stdio; void main(string[] args) { foreach(a; args) { writeln(a); } immutable(char)[] s = "asd"; }
D
feel admiration for look at with admiration
D
deprecated("Using hunt.http.HttpField instead.") module hunt.http.codec.http.model.HttpField; public import hunt.http.HttpField;
D
module dpromise.internal.libuv; import deimos.libuv.uv; package(dpromise): package(dpromise) { uv_loop_t* localLoop; } static this() { localLoop = castMalloc!(uv_loop_t); uv_loop_init(localLoop); } static ~this() { uv_loop_close(localLoop); } @nogc nothrow T* castMalloc(T)() { import core.stdc.stdlib : malloc; return cast(T*)malloc(T.sizeof); } nothrow Exception factory(int err, string file = __FILE__, size_t line = __LINE__) { if(err == 0) return null; import std.string : fromStringz; import std.format : format; try { auto msg = format("%s:%s", uv_err_name(err).fromStringz, uv_strerror(err).fromStringz); return new IOException(msg, file, line); } catch(Exception e) { return e; } } /++ Errors thrown when libuv error. +/ public final class IOException : Exception { /// Creates a new instance of $(D IOException). pure nothrow @nogc @safe this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { super(msg, file, line, next); } } version (X86) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 01000 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else version (X86_64) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 01000 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else version (MIPS32) { enum O_CREAT = 0x0100; enum O_EXCL = 0x0400; enum O_NOCTTY = 0x0800; enum O_TRUNC = 0x0200; enum O_APPEND = 0x0008; enum O_DSYNC = O_SYNC; enum O_NONBLOCK = 0x0080; enum O_RSYNC = O_SYNC; enum O_SYNC = 0x0010; } else version (MIPS64) { enum O_CREAT = 0x0100; enum O_EXCL = 0x0400; enum O_NOCTTY = 0x0800; enum O_TRUNC = 0x0200; enum O_APPEND = 0x0008; enum O_DSYNC = 0x0010; enum O_NONBLOCK = 0x0080; enum O_RSYNC = O_SYNC; enum O_SYNC = 0x4010; } else version (PPC) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 01000 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else version (PPC64) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 010 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else version (ARM) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 01000 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else version (AArch64) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 01000 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else version (SystemZ) { enum O_CREAT = 0x40; // octal 0100 enum O_EXCL = 0x80; // octal 0200 enum O_NOCTTY = 0x100; // octal 0400 enum O_TRUNC = 0x200; // octal 01000 enum O_APPEND = 0x400; // octal 02000 enum O_NONBLOCK = 0x800; // octal 04000 enum O_SYNC = 0x101000; // octal 04010000 enum O_DSYNC = 0x1000; // octal 010000 enum O_RSYNC = O_SYNC; } else static assert(0, "unimplemented"); enum O_ACCMODE = 0x3; enum O_RDONLY = 0x0; enum O_WRONLY = 0x1; enum O_RDWR = 0x2; enum S_IRUSR = 0x100; // octal 0400 enum S_IWUSR = 0x080; // octal 0200 enum S_IXUSR = 0x040; // octal 0100 enum S_IRWXU = S_IRUSR | S_IWUSR | S_IXUSR; enum S_IRGRP = S_IRUSR >> 3; enum S_IWGRP = S_IWUSR >> 3; enum S_IXGRP = S_IXUSR >> 3; enum S_IRWXG = S_IRWXU >> 3; enum S_IROTH = S_IRGRP >> 3; enum S_IWOTH = S_IWGRP >> 3; enum S_IXOTH = S_IXGRP >> 3; enum S_IRWXO = S_IRWXG >> 3; enum S_ISUID = 0x800; // octal 04000 enum S_ISGID = 0x400; // octal 02000 enum S_ISVTX = 0x200; // octal 01000
D
/Users/sleira/Personal/Projects/rust-coding-dojo/get-started/hello-rust/target/release/deps/atty-51b65cf5314b55c2.rmeta: /Users/sleira/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs /Users/sleira/Personal/Projects/rust-coding-dojo/get-started/hello-rust/target/release/deps/libatty-51b65cf5314b55c2.rlib: /Users/sleira/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs /Users/sleira/Personal/Projects/rust-coding-dojo/get-started/hello-rust/target/release/deps/atty-51b65cf5314b55c2.d: /Users/sleira/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs /Users/sleira/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs:
D
/Users/K/study/rust/rust_web_programming/timer/target/debug/build/syn-1a2a23c0007da50e/build_script_build-1a2a23c0007da50e: /Users/K/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.73/build.rs /Users/K/study/rust/rust_web_programming/timer/target/debug/build/syn-1a2a23c0007da50e/build_script_build-1a2a23c0007da50e.d: /Users/K/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.73/build.rs /Users/K/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.73/build.rs:
D
/** * * THIS FILE IS AUTO-GENERATED BY ./parse_specs.d FOR MCU atmega48pb WITH ARCHITECTURE avr4 * */ module avr.specs.specs_atmega48pb; enum __AVR_ARCH__ = 4; enum __AVR_ASM_ONLY__ = false; enum __AVR_ENHANCED__ = true; enum __AVR_HAVE_MUL__ = true; enum __AVR_HAVE_JMP_CALL__ = false; enum __AVR_MEGA__ = false; enum __AVR_HAVE_LPMX__ = true; enum __AVR_HAVE_MOVW__ = true; enum __AVR_HAVE_ELPM__ = false; enum __AVR_HAVE_ELPMX__ = false; enum __AVR_HAVE_EIJMP_EICALL_ = false; enum __AVR_2_BYTE_PC__ = true; enum __AVR_3_BYTE_PC__ = false; enum __AVR_XMEGA__ = false; enum __AVR_HAVE_RAMPX__ = false; enum __AVR_HAVE_RAMPY__ = false; enum __AVR_HAVE_RAMPZ__ = false; enum __AVR_HAVE_RAMPD__ = false; enum __AVR_TINY__ = false; enum __AVR_PM_BASE_ADDRESS__ = 0; enum __AVR_SFR_OFFSET__ = 32; enum __AVR_DEVICE_NAME__ = "atmega48pb";
D
// This file is part of Visual D // // Visual D integrates the D programming language into Visual Studio // Copyright (c) 2010 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 visuald.propertypage; import visuald.windows; import sdk.win32.objbase; import sdk.vsi.vsshell; import sdk.vsi.vsshell80; import visuald.comutil; import visuald.logutil; import visuald.dpackage; import visuald.dproject; import visuald.dllmain; import visuald.config; import visuald.winctrl; import visuald.hierarchy; import visuald.hierutil; import visuald.chiernode; import stdext.array; import std.string; import std.conv; /*debug*/ version = DParser; class PropertyWindow : Window { this(Widget parent, uint style, string title, PropertyPage page) { mPropertyPage = page; super(parent, style, title); } override int WindowProc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam) { import sdk.win32.commctrl; switch (uMsg) { case WM_SIZE: int w = LOWORD(lParam); mPropertyPage.updateSizes(w); break; case TCN_SELCHANGING: case TCN_SELCHANGE: // Return FALSE to allow the selection to change. auto tc = cast(TabControl) this; return FALSE; default: break; } return super.WindowProc(hWnd, uMsg, wParam, lParam); } PropertyPage mPropertyPage; } abstract class PropertyPage : DisposingComObject, IPropertyPage, IVsPropertyPage, IVsPropertyPage2 { /*const*/ int kPageWidth = 370; /*const*/ int kPageHeight = 210; /*const*/ int kMargin = 4; /*const*/ int kLabelWidth = 120; /*const*/ int kTextHeight = 20; /*const*/ int kLineHeight = 23; /*const*/ int kLineSpacing = 2; /*const*/ int kNeededLines = 10; override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(queryInterface!(IPropertyPage) (this, riid, pvObject)) return S_OK; if(queryInterface!(IVsPropertyPage) (this, riid, pvObject)) return S_OK; if(queryInterface!(IVsPropertyPage2) (this, riid, pvObject)) return S_OK; return super.QueryInterface(riid, pvObject); } override void Dispose() { mSite = release(mSite); foreach(obj; mObjects) release(obj); mObjects.length = 0; mResizableWidgets = mResizableWidgets.init; mDlgFont = deleteDialogFont(mDlgFont); } override int SetPageSite( /* [in] */ IPropertyPageSite pPageSite) { mixin(LogCallMix); mSite = release(mSite); mSite = addref(pPageSite); return S_OK; } override int Activate( /* [in] */ in HWND hWndParent, /* [in] */ in RECT *pRect, /* [in] */ in BOOL bModal) { mixin(LogCallMix); if(mWindow) return returnError(E_FAIL); return _Activate(new Window(hWndParent), pRect, bModal); } int _Activate( /* [in] */ Window win, /* [in] */ in RECT *pRect, /* [in] */ in BOOL bModal) { if(pRect) logCall("_Activate(" ~ to!string(*pRect) ~ ")"); RECT pr; win.GetWindowRect(&pr); logCall(" parent.rect = " ~ to!string(pr) ~ ""); if(HWND phwnd = GetParent(win.hwnd)) { GetWindowRect(phwnd, &pr); logCall(" parent.parent.rect = " ~ to!string(pr) ~ ""); } if(pRect) kPageWidth = pRect.right - pRect.left; updateEnvironmentFont(); if(!mDlgFont) mDlgFont = newDialogFont(); mWindow = win; mCanvas = new Window(mWindow); DWORD color = GetSysColor(COLOR_BTNFACE); mCanvas.setBackground(color); mCanvas.setRect(kMargin, kMargin, kPageWidth - 2 * kMargin, kPageHeight - 2 * kMargin); mResizableWidgets ~= mCanvas; // avoid closing canvas (but not dialog) if pressing esc in MultiLineEdit controls //mCanvas.cancelCloseDelegate ~= delegate bool(Widget c) { return true; }; class DelegateWrapper { void OnCommand(Widget w, int cmd) { UpdateDirty(true); } } DelegateWrapper delegateWrapper = new DelegateWrapper; mCanvas.commandDelegate = &delegateWrapper.OnCommand; CreateControls(); UpdateControls(); mEnableUpdateDirty = true; return S_OK; } override int Deactivate() { mixin(LogCallMix); if(mWindow) { mWindow.Dispose(); mWindow = null; mCanvas = null; } return S_OK; //return returnError(E_NOTIMPL); } void updateSizes(int width) { foreach(w; mResizableWidgets) { RECT r; if(w && w.hwnd) { w.GetWindowRect(&r); r.right = width - kMargin; w.SetWindowPos(null, &r, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } } } void calcMetric() { updateEnvironmentFont(); kMargin = 4; if(!mDlgFont) mDlgFont = newDialogFont(); HWND hwnd = GetDesktopWindow(); HDC dc = GetDC(hwnd); SelectObject(dc, mDlgFont); TEXTMETRIC tm; GetTextMetrics(dc, &tm); ReleaseDC(hwnd, dc); int fHeight = tm.tmHeight; int fWidth = tm.tmAveCharWidth; kPageWidth = fWidth * 75 + 2 * kMargin; kLabelWidth = fWidth * 22; mUnindentCheckBox = kLabelWidth; kLineSpacing = 2; kTextHeight = fHeight + 4; kLineHeight = kTextHeight + kLineSpacing + 1; kPageHeight = kLineHeight * kNeededLines + 2 * kMargin; } override int GetPageInfo( /* [out] */ PROPPAGEINFO *pPageInfo) { mixin(LogCallMix); if(pPageInfo.cb < PROPPAGEINFO.sizeof) return E_INVALIDARG; calcMetric(); pPageInfo.cb = PROPPAGEINFO.sizeof; pPageInfo.pszTitle = string2OLESTR("Title"); pPageInfo.size = visuald.comutil.SIZE(kPageWidth, kPageHeight); pPageInfo.pszHelpFile = string2OLESTR("HelpFile"); pPageInfo.pszDocString = string2OLESTR("DocString"); pPageInfo.dwHelpContext = 0; return S_OK; } override int SetObjects( /* [in] */ in ULONG cObjects, /* [size_is][in] */ IUnknown *ppUnk) { mixin(LogCallMix2); foreach(obj; mObjects) release(obj); mObjects.length = 0; for(uint i = 0; i < cObjects; i++) mObjects ~= addref(ppUnk[i]); if(mWindow) { mEnableUpdateDirty = false; UpdateControls(); mEnableUpdateDirty = true; } return S_OK; } override int Show( /* [in] */ in UINT nCmdShow) { logCall("%s.Show(nCmdShow=%s)", this, _toLog(nCmdShow)); if(mWindow) mWindow.setVisible(true); return S_OK; //return returnError(E_NOTIMPL); } override int Move( /* [in] */ in RECT *pRect) { mixin(LogCallMix); return returnError(E_NOTIMPL); } override int Help( /* [in] */ in wchar* pszHelpDir) { logCall("%s.Help(pszHelpDir=%s)", this, _toLog(pszHelpDir)); return returnError(E_NOTIMPL); } override int TranslateAccelerator( /* [in] */ in MSG *pMsg) { mixin(LogCallMix2); if(mSite) return mSite.TranslateAccelerator(pMsg); return returnError(E_NOTIMPL); } // IVsPropertyPage override int CategoryTitle( /* [in] */ in UINT iLevel, /* [retval][out] */ BSTR *pbstrCategory) { logCall("%s.get_CategoryTitle(iLevel=%s, pbstrCategory=%s)", this, _toLog(iLevel), _toLog(pbstrCategory)); switch(iLevel) { case 0: if(GetCategoryName().length == 0) return S_FALSE; *pbstrCategory = allocBSTR(GetCategoryName()); break; case 1: return S_FALSE; //*pbstrCategory = allocBSTR("CategoryTitle1"); default: break; } return S_OK; } // IVsPropertyPage2 override int GetProperty( /* [in] */ in VSPPPID propid, /* [out] */ VARIANT *pvar) { mixin(LogCallMix); switch(propid) { case VSPPPID_PAGENAME: pvar.vt = VT_BSTR; pvar.bstrVal = allocBSTR(GetPageName()); return S_OK; default: break; } return returnError(DISP_E_MEMBERNOTFOUND); } override int SetProperty( /* [in] */ in VSPPPID propid, /* [in] */ in VARIANT var) { mixin(LogCallMix); return returnError(E_NOTIMPL); } /////////////////////////////////////// void UpdateDirty(bool bDirty) { if(mEnableUpdateDirty && mSite) mSite.OnStatusChange(PROPPAGESTATUS_DIRTY | PROPPAGESTATUS_VALIDATE); } void AddControl(string label, Widget w) { int x = kLabelWidth; auto cb = cast(CheckBox) w; auto tc = cast(TabControl) w; auto mt = cast(MultiLineText) w; //if(cb) // cb.cmd = 1; // enable actionDelegate int lines = 1; if(mt || tc) lines = mLinesPerMultiLine; int labelWidth = 0; if(label.length) { Label lab = new Label(w ? w.parent : null, label); int off = ((kLineHeight - kLineSpacing) - 16) / 2; labelWidth = w ? kLabelWidth : kPageWidth - 2*kMargin; lab.setRect(0, mLines*kLineHeight + off, labelWidth, kLineHeight - kLineSpacing); } else if (cb || tc) { x -= mUnindentCheckBox; } int h = lines * kLineHeight - kLineSpacing; if(cast(Text) w && lines == 1) { h = kTextHeight; } else if(cb) h -= 2; //else if(cast(ComboBox) w) // h -= 4; int y = mLines*kLineHeight + (lines * kLineHeight - kLineSpacing - h) / 2; if(w) w.setRect(x, y, kPageWidth - 2*kMargin - labelWidth, h); mLines += lines; if(w) mResizableWidgets ~= w; } int changeOption(V)(V val, ref V optval, ref V refval) { if(refval == val) return 0; optval = val; return 1; } int changeOptionDg(V)(V val, void delegate (V optval) setdg, V refval) { if(refval == val) return 0; setdg(val); return 1; } abstract void CreateControls(); abstract void UpdateControls(); abstract string GetCategoryName(); abstract string GetPageName(); Widget[] mResizableWidgets; HFONT mDlgFont; IUnknown[] mObjects; IPropertyPageSite mSite; Window mWindow; Window mCanvas; bool mEnableUpdateDirty; int mLines; int mLinesPerMultiLine = 4; int mUnindentCheckBox = 120; //16; } /////////////////////////////////////////////////////////////////////////////// class ProjectPropertyPage : PropertyPage, ConfigModifiedListener { abstract void SetControls(ProjectOptions options); abstract int DoApply(ProjectOptions options, ProjectOptions refoptions); override HRESULT QueryInterface(in IID* riid, void** pvObject) { //if(queryInterface!(ConfigModifiedListener) (this, riid, pvObject)) // return S_OK; return super.QueryInterface(riid, pvObject); } override void UpdateControls() { if(ProjectOptions options = GetProjectOptions()) SetControls(options); } override void Dispose() { if(auto cfg = GetConfig()) cfg.RemoveModifiedListener(this); super.Dispose(); } override void OnConfigModified() { } override int SetObjects(/* [in] */ in ULONG cObjects, /* [size_is][in] */ IUnknown *ppUnk) { if(auto cfg = GetConfig()) cfg.RemoveModifiedListener(this); int rc = super.SetObjects(cObjects, ppUnk); if(auto cfg = GetConfig()) cfg.AddModifiedListener(this); return rc; } Config GetConfig() { if(mObjects.length > 0) { auto config = ComPtr!(Config)(mObjects[0]); return config; } return null; } ProjectOptions GetProjectOptions() { if(auto cfg = GetConfig()) return cfg.GetProjectOptions(); return null; } /*override*/ int IsPageDirty() { mixin(LogCallMix); if(mWindow) if(ProjectOptions options = GetProjectOptions()) { scope ProjectOptions opt = new ProjectOptions(false, false); return DoApply(opt, options) > 0 ? S_OK : S_FALSE; } return S_FALSE; } /*override*/ int Apply() { mixin(LogCallMix); if(ProjectOptions refoptions = GetProjectOptions()) { // make a copy, otherwise changes will no longer be detected after the first configuration auto refopt = clone(refoptions); for(int i = 0; i < mObjects.length; i++) { auto config = ComPtr!(Config)(mObjects[i]); if(config) { DoApply(config.ptr.GetProjectOptions(), refopt); config.SetDirty(); } } return S_OK; } return returnError(E_FAIL); } } class NodePropertyPage : PropertyPage { abstract void SetControls(CFileNode node); abstract int DoApply(CFileNode node, CFileNode refnode); override void UpdateControls() { if(CFileNode node = GetNode()) SetControls(node); } CFileNode GetNode() { if(mObjects.length > 0) { auto node = ComPtr!(CFileNode)(mObjects[0]); if(node) return node; } return null; } /*override*/ int IsPageDirty() { mixin(LogCallMix); if(mWindow) if(CFileNode node = GetNode()) { scope CFileNode n = newCom!CFileNode(""); return DoApply(n, node) > 0 ? S_OK : S_FALSE; } return S_FALSE; } /*override*/ int Apply() { mixin(LogCallMix); if(CFileNode refnode = GetNode()) { for(int i = 0; i < mObjects.length; i++) { auto node = ComPtr!(CFileNode)(mObjects[i]); if(node) { DoApply(node, refnode); if(CProjectNode pn = cast(CProjectNode) node.GetRootNode()) pn.SetProjectFileDirty(true); } } return S_OK; } return returnError(E_FAIL); } } class GlobalPropertyPage : PropertyPage { abstract void SetControls(GlobalOptions options); abstract int DoApply(GlobalOptions options, GlobalOptions refoptions); this(GlobalOptions options) { mOptions = options; } override void UpdateControls() { if(GlobalOptions options = GetGlobalOptions()) SetControls(options); } GlobalOptions GetGlobalOptions() { return mOptions; } void SetWindowSize(int x, int y, int w, int h) { mixin(LogCallMix); if(mCanvas) mCanvas.setRect(x, y, w, h); } /*override*/ int IsPageDirty() { mixin(LogCallMix); if(mWindow) if(GlobalOptions options = GetGlobalOptions()) { scope GlobalOptions opt = new GlobalOptions; return DoApply(opt, options) > 0 ? S_OK : S_FALSE; } return S_FALSE; } /*override*/ int Apply() { mixin(LogCallMix); if(GlobalOptions options = GetGlobalOptions()) { DoApply(options, options); options.saveToRegistry(); return S_OK; } return returnError(E_FAIL); } GlobalOptions mOptions; } /////////////////////////////////////////////////////////////////////////////// class CommonPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return ""; } override string GetPageName() { return "General"; } override void CreateControls() { AddControl("Build System", mCbBuildSystem = new ComboBox(mCanvas, [ "Visual D", "dsss", "rebuild" ], false)); mCbBuildSystem.setSelection(0); mCbBuildSystem.setEnabled(false); } override void SetControls(ProjectOptions options) { } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { return 0; } ComboBox mCbBuildSystem; } class GeneralPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return ""; } override string GetPageName() { return "General"; } __gshared const float[] selectableVersions = [ 1, 2 ]; override void CreateControls() { string[] versions; foreach(ver; selectableVersions) versions ~= "D" ~ to!(string)(ver); //versions[$-1] ~= "+"; AddControl("Compiler", mCompiler = new ComboBox(mCanvas, [ "DMD", "GDC", "LDC" ], false)); AddControl("D-Version", mDVersion = new ComboBox(mCanvas, versions, false)); AddControl("Output Type", mCbOutputType = new ComboBox(mCanvas, [ "Executable", "Library", "DLL" ], false)); AddControl("Subsystem", mCbSubsystem = new ComboBox(mCanvas, [ "Not set", "Console", "Windows", "Native", "Posix" ], false)); AddControl("Output Path", mOutputPath = new Text(mCanvas)); AddControl("Intermediate Path", mIntermediatePath = new Text(mCanvas)); AddControl("Files to clean", mFilesToClean = new Text(mCanvas)); AddControl("", mOtherDMD = new CheckBox(mCanvas, "Use other compiler")); AddControl("Compiler Path", mCompilerPath = new Text(mCanvas)); AddControl("Compilation", mSingleFileComp = new ComboBox(mCanvas, [ "Combined compile and link", "Single file compilation", "Separate compile and link", "Compile only (use Post-build command to link)" ], false)); } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); EnableControls(); } void EnableControls() { mCompilerPath.setEnabled(mOtherDMD.isChecked()); } override void SetControls(ProjectOptions options) { int ver = 0; while(ver < selectableVersions.length - 1 && selectableVersions[ver+1] <= options.Dversion) ver++; mDVersion.setSelection(ver); mOtherDMD.setChecked(options.otherDMD); mCompiler.setSelection(options.compiler); mSingleFileComp.setSelection(options.compilationModel); mCbOutputType.setSelection(options.lib); mCbSubsystem.setSelection(options.subsystem); mCompilerPath.setText(options.program); mOutputPath.setText(options.outdir); mIntermediatePath.setText(options.objdir); mFilesToClean.setText(options.filesToClean); EnableControls(); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { float ver = selectableVersions[mDVersion.getSelection()]; int changes = 0; changes += changeOption(mOtherDMD.isChecked(), options.otherDMD, refoptions.otherDMD); changes += changeOption(cast(ubyte) mCompiler.getSelection(), options.compiler, refoptions.compiler); changes += changeOption(cast(uint) mSingleFileComp.getSelection(), options.compilationModel, refoptions.compilationModel); changes += changeOption(cast(ubyte) mCbOutputType.getSelection(), options.lib, refoptions.lib); changes += changeOption(cast(ubyte) mCbSubsystem.getSelection(), options.subsystem, refoptions.subsystem); changes += changeOption(mCompilerPath.getText(), options.program, refoptions.program); changes += changeOption(ver, options.Dversion, refoptions.Dversion); changes += changeOption(mOutputPath.getText(), options.outdir, refoptions.outdir); changes += changeOption(mIntermediatePath.getText(), options.objdir, refoptions.objdir); changes += changeOption(mFilesToClean.getText(), options.filesToClean, refoptions.filesToClean); return changes; } CheckBox mOtherDMD; ComboBox mCompiler; ComboBox mSingleFileComp; Text mCompilerPath; ComboBox mCbOutputType; ComboBox mCbSubsystem; ComboBox mDVersion; Text mOutputPath; Text mIntermediatePath; Text mFilesToClean; } class DebuggingPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return ""; } override string GetPageName() { return "Debugging"; } override void CreateControls() { Label lbl; AddControl("Command", mCommand = new Text(mCanvas)); AddControl("Command Arguments", mArguments = new Text(mCanvas)); AddControl("Working Directory", mWorkingDir = new Text(mCanvas)); AddControl("", mAttach = new CheckBox(mCanvas, "Attach to running process")); AddControl("Remote Machine", mRemote = new Text(mCanvas)); AddControl("Debugger", mDebugEngine = new ComboBox(mCanvas, [ "Visual Studio", "Mago", "Visual Studio (x86 Mixed Mode)" ], false)); AddControl("", mStdOutToOutputWindow = new CheckBox(mCanvas, "Redirect stdout to output window")); AddControl("Run without debugging", lbl = new Label(mCanvas, "")); AddControl("", mPauseAfterRunning = new CheckBox(mCanvas, "Pause when program finishes")); lbl.AddWindowExStyle(WS_EX_STATICEDGE); lbl.AddWindowStyle(SS_ETCHEDFRAME, SS_TYPEMASK); int left, top, w, h; if(lbl.getRect(left, top, w, h)) lbl.setRect(left, top + h / 2 - 1, w, 2); } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); EnableControls(); } void EnableControls() { mStdOutToOutputWindow.setEnabled(mDebugEngine.getSelection() != 1); } override void SetControls(ProjectOptions options) { mCommand.setText(options.debugtarget); mArguments.setText(options.debugarguments); mWorkingDir.setText(options.debugworkingdir); mAttach.setChecked(options.debugattach); mRemote.setText(options.debugremote); mDebugEngine.setSelection(options.debugEngine); mStdOutToOutputWindow.setChecked(options.debugStdOutToOutputWindow); mPauseAfterRunning.setChecked(options.pauseAfterRunning); EnableControls(); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mCommand.getText(), options.debugtarget, refoptions.debugtarget); changes += changeOption(mArguments.getText(), options.debugarguments, refoptions.debugarguments); changes += changeOption(mWorkingDir.getText(), options.debugworkingdir, refoptions.debugworkingdir); changes += changeOption(mAttach.isChecked(), options.debugattach, options.debugattach); changes += changeOption(mRemote.getText(), options.debugremote, refoptions.debugremote); changes += changeOption(cast(ubyte)mDebugEngine.getSelection(), options.debugEngine, refoptions.debugEngine); changes += changeOption(mStdOutToOutputWindow.isChecked(), options.debugStdOutToOutputWindow, options.debugStdOutToOutputWindow); changes += changeOption(mPauseAfterRunning.isChecked(), options.pauseAfterRunning, options.pauseAfterRunning); return changes; } Text mCommand; Text mArguments; Text mWorkingDir; Text mRemote; CheckBox mAttach; ComboBox mDebugEngine; CheckBox mStdOutToOutputWindow; CheckBox mPauseAfterRunning; } class DmdGeneralPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Compiler"; } override string GetPageName() { return "General"; } override void CreateControls() { //AddControl("", mUseStandard = new CheckBox(mCanvas, "Use Standard Import Paths")); AddControl("Additional Imports", mAddImports = new Text(mCanvas)); AddControl("String Imports", mStringImports = new Text(mCanvas)); AddControl("Version Identifiers", mVersionIdentifiers = new Text(mCanvas)); AddControl("Debug Identifiers", mDebugIdentifiers = new Text(mCanvas)); } override void SetControls(ProjectOptions options) { //mUseStandard.setChecked(true); //mUseStandard.setEnabled(false); mAddImports.setText(options.imppath); mStringImports.setText(options.fileImppath); mVersionIdentifiers.setText(options.versionids); mDebugIdentifiers.setText(options.debugids); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mAddImports.getText(), options.imppath, refoptions.imppath); changes += changeOption(mStringImports.getText(), options.fileImppath, refoptions.fileImppath); changes += changeOption(mVersionIdentifiers.getText(), options.versionids, refoptions.versionids); changes += changeOption(mDebugIdentifiers.getText(), options.debugids, refoptions.debugids); return changes; } //CheckBox mUseStandard; Text mAddImports; Text mStringImports; Text mVersionIdentifiers; Text mDebugIdentifiers; } class DmdDebugPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Compiler"; } override string GetPageName() { return "Debug"; } override void CreateControls() { AddControl("Debug Mode", mDebugMode = new ComboBox(mCanvas, [ "Off (release)", "On" ], false)); AddControl("Debug Info", mDebugInfo = new ComboBox(mCanvas, [ "None", "Symbolic", "Symbolic (pretend to be C)" ], false)); AddControl("", mRunCv2pdb = new CheckBox(mCanvas, "Run cv2pdb to Convert Debug Info")); AddControl("Path to cv2pdb", mPathCv2pdb = new Text(mCanvas)); AddControl("", mCv2pdbPre2043 = new CheckBox(mCanvas, "Assume old associative array implementation (before dmd 2.043)")); AddControl("", mCv2pdbNoDemangle = new CheckBox(mCanvas, "Do not demangle symbols")); AddControl("", mCv2pdbEnumType = new CheckBox(mCanvas, "Use enumerator types")); AddControl("More options", mCv2pdbOptions = new Text(mCanvas)); } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); EnableControls(); } void EnableControls() { mPathCv2pdb.setEnabled(mRunCv2pdb.isChecked()); mCv2pdbOptions.setEnabled(mRunCv2pdb.isChecked()); mCv2pdbEnumType.setEnabled(mRunCv2pdb.isChecked()); mCv2pdbPre2043.setEnabled(mRunCv2pdb.isChecked()); mCv2pdbNoDemangle.setEnabled(mRunCv2pdb.isChecked()); } override void SetControls(ProjectOptions options) { mDebugMode.setSelection(options.release ? 0 : 1); mDebugInfo.setSelection(options.symdebug); mRunCv2pdb.setChecked(options.runCv2pdb); mPathCv2pdb.setText(options.pathCv2pdb); mCv2pdbOptions.setText(options.cv2pdbOptions); mCv2pdbPre2043.setChecked(options.cv2pdbPre2043); mCv2pdbNoDemangle.setChecked(options.cv2pdbNoDemangle); mCv2pdbEnumType.setChecked(options.cv2pdbEnumType); EnableControls(); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mDebugMode.getSelection() == 0, options.release, refoptions.release); changes += changeOption(cast(ubyte) mDebugInfo.getSelection(), options.symdebug, refoptions.symdebug); changes += changeOption(mRunCv2pdb.isChecked(), options.runCv2pdb, refoptions.runCv2pdb); changes += changeOption(mPathCv2pdb.getText(), options.pathCv2pdb, refoptions.pathCv2pdb); changes += changeOption(mCv2pdbOptions.getText(), options.cv2pdbOptions, refoptions.cv2pdbOptions); changes += changeOption(mCv2pdbPre2043.isChecked(), options.cv2pdbPre2043, refoptions.cv2pdbPre2043); changes += changeOption(mCv2pdbNoDemangle.isChecked(), options.cv2pdbNoDemangle, refoptions.cv2pdbNoDemangle); changes += changeOption(mCv2pdbEnumType.isChecked(), options.cv2pdbEnumType, refoptions.cv2pdbEnumType); return changes; } ComboBox mDebugMode; ComboBox mDebugInfo; CheckBox mRunCv2pdb; Text mPathCv2pdb; CheckBox mCv2pdbPre2043; CheckBox mCv2pdbNoDemangle; CheckBox mCv2pdbEnumType; Text mCv2pdbOptions; } class DmdCodeGenPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Compiler"; } override string GetPageName() { return "Code Generation"; } override void CreateControls() { mUnindentCheckBox = kLabelWidth; AddControl("", mProfiling = new CheckBox(mCanvas, "Insert Profiling Hooks")); AddControl("", mCodeCov = new CheckBox(mCanvas, "Generate Code Coverage")); AddControl("", mOptimizer = new CheckBox(mCanvas, "Run Optimizer")); AddControl("", mNoboundscheck = new CheckBox(mCanvas, "No Array Bounds Checking")); AddControl("", mUnitTests = new CheckBox(mCanvas, "Generate Unittest Code")); AddControl("", mInline = new CheckBox(mCanvas, "Expand Inline Functions")); AddControl("", mNoFloat = new CheckBox(mCanvas, "No Floating Point Support")); AddControl("", mGenStackFrame = new CheckBox(mCanvas, "Always generate stack frame (DMD 2.056+)")); } override void SetControls(ProjectOptions options) { mProfiling.setChecked(options.trace); mCodeCov.setChecked(options.cov); mOptimizer.setChecked(options.optimize); mNoboundscheck.setChecked(options.noboundscheck); mUnitTests.setChecked(options.useUnitTests); mInline.setChecked(options.useInline); mNoFloat.setChecked(options.nofloat); mGenStackFrame.setChecked(options.genStackFrame); mNoboundscheck.setEnabled(options.Dversion > 1); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mCodeCov.isChecked(), options.cov, refoptions.cov); changes += changeOption(mProfiling.isChecked(), options.trace, refoptions.trace); changes += changeOption(mOptimizer.isChecked(), options.optimize, refoptions.optimize); changes += changeOption(mNoboundscheck.isChecked(), options.noboundscheck, refoptions.noboundscheck); changes += changeOption(mUnitTests.isChecked(), options.useUnitTests, refoptions.useUnitTests); changes += changeOption(mInline.isChecked(), options.useInline, refoptions.useInline); changes += changeOption(mNoFloat.isChecked(), options.nofloat, refoptions.nofloat); changes += changeOption(mGenStackFrame.isChecked(), options.genStackFrame, refoptions.genStackFrame); return changes; } CheckBox mCodeCov; CheckBox mProfiling; CheckBox mOptimizer; CheckBox mNoboundscheck; CheckBox mUnitTests; CheckBox mInline; CheckBox mNoFloat; CheckBox mGenStackFrame; } class DmdMessagesPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Compiler"; } override string GetPageName() { return "Messages"; } override void CreateControls() { mUnindentCheckBox = kLabelWidth; AddControl("", mWarnings = new CheckBox(mCanvas, "Enable Warnings")); AddControl("", mInfoWarnings = new CheckBox(mCanvas, "Enable Informational Warnings (DMD 2.041+)")); AddControl("", mQuiet = new CheckBox(mCanvas, "Suppress Non-Error Messages")); AddControl("", mVerbose = new CheckBox(mCanvas, "Verbose Compile")); AddControl("", mVtls = new CheckBox(mCanvas, "Show TLS Variables")); AddControl("", mUseDeprecated = new CheckBox(mCanvas, "Silently Allow Deprecated Features")); AddControl("", mErrDeprecated = new CheckBox(mCanvas, "Use of Deprecated Features causes Error (DMD 2.061+)")); AddControl("", mIgnorePragmas = new CheckBox(mCanvas, "Ignore Unsupported Pragmas")); AddControl("", mCheckProperty = new CheckBox(mCanvas, "Enforce Property Syntax (DMD 2.055+)")); } override void SetControls(ProjectOptions options) { mWarnings.setChecked(options.warnings); mInfoWarnings.setChecked(options.infowarnings); mQuiet.setChecked(options.quiet); mVerbose.setChecked(options.verbose); mVtls.setChecked(options.vtls); mUseDeprecated.setChecked(options.useDeprecated); mErrDeprecated.setChecked(options.errDeprecated); mIgnorePragmas.setChecked(options.ignoreUnsupportedPragmas); mCheckProperty.setChecked(options.checkProperty); mVtls.setEnabled(options.Dversion > 1); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mWarnings.isChecked(), options.warnings, refoptions.warnings); changes += changeOption(mInfoWarnings.isChecked(), options.infowarnings, refoptions.infowarnings); changes += changeOption(mQuiet.isChecked(), options.quiet, refoptions.quiet); changes += changeOption(mVerbose.isChecked(), options.verbose, refoptions.verbose); changes += changeOption(mVtls.isChecked(), options.vtls, refoptions.vtls); changes += changeOption(mUseDeprecated.isChecked(), options.useDeprecated, refoptions.useDeprecated); changes += changeOption(mErrDeprecated.isChecked(), options.errDeprecated, refoptions.errDeprecated); changes += changeOption(mIgnorePragmas.isChecked(), options.ignoreUnsupportedPragmas, refoptions.ignoreUnsupportedPragmas); changes += changeOption(mCheckProperty.isChecked(), options.checkProperty, refoptions.checkProperty); return changes; } CheckBox mWarnings; CheckBox mInfoWarnings; CheckBox mQuiet; CheckBox mVerbose; CheckBox mVtls; CheckBox mUseDeprecated; CheckBox mErrDeprecated; CheckBox mIgnorePragmas; CheckBox mCheckProperty; } class DmdDocPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Compiler"; } override string GetPageName() { return "Documentation"; } override void CreateControls() { AddControl("", mGenDoc = new CheckBox(mCanvas, "Generate documentation")); AddControl("Documentation file", mDocFile = new Text(mCanvas)); AddControl("Documentation dir", mDocDir = new Text(mCanvas)); AddControl("CanDyDOC module", mModulesDDoc = new Text(mCanvas)); AddControl("", mGenHdr = new CheckBox(mCanvas, "Generate interface headers")); AddControl("Header file", mHdrFile = new Text(mCanvas)); AddControl("Header directory", mHdrDir = new Text(mCanvas)); AddControl("", mGenJSON = new CheckBox(mCanvas, "Generate JSON file")); AddControl("JSON file", mJSONFile = new Text(mCanvas)); } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); EnableControls(); } void EnableControls() { mDocDir.setEnabled(mGenDoc.isChecked()); mDocFile.setEnabled(mGenDoc.isChecked()); mModulesDDoc.setEnabled(mGenDoc.isChecked()); mHdrDir.setEnabled(mGenHdr.isChecked()); mHdrFile.setEnabled(mGenHdr.isChecked()); mJSONFile.setEnabled(mGenJSON.isChecked()); } override void SetControls(ProjectOptions options) { mGenDoc.setChecked(options.doDocComments); mDocDir.setText(options.docdir); mDocFile.setText(options.docname); mModulesDDoc.setText(options.modules_ddoc); mGenHdr.setChecked(options.doHdrGeneration); mHdrDir.setText(options.hdrdir); mHdrFile.setText(options.hdrname); mGenJSON.setChecked(options.doXGeneration); mJSONFile.setText(options.xfilename); EnableControls(); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mGenDoc.isChecked(), options.doDocComments, refoptions.doDocComments); changes += changeOption(mDocDir.getText(), options.docdir, refoptions.docdir); changes += changeOption(mDocFile.getText(), options.docname, refoptions.docname); changes += changeOption(mModulesDDoc.getText(), options.modules_ddoc, refoptions.modules_ddoc); changes += changeOption(mGenHdr.isChecked(), options.doHdrGeneration, refoptions.doHdrGeneration); changes += changeOption(mHdrDir.getText(), options.hdrdir, refoptions.hdrdir); changes += changeOption(mHdrFile.getText(), options.hdrname, refoptions.hdrname); changes += changeOption(mGenJSON.isChecked(), options.doXGeneration, refoptions.doXGeneration); changes += changeOption(mJSONFile.getText(), options.xfilename, refoptions.xfilename); return changes; } CheckBox mGenDoc; Text mDocDir; Text mDocFile; Text mModulesDDoc; CheckBox mGenHdr; Text mHdrDir; Text mHdrFile; CheckBox mGenJSON; Text mJSONFile; } class DmdOutputPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Compiler"; } override string GetPageName() { return "Output"; } override void CreateControls() { mUnindentCheckBox = kLabelWidth; AddControl("", mMultiObj = new CheckBox(mCanvas, "Multiple Object Files")); AddControl("", mPreservePaths = new CheckBox(mCanvas, "Keep Path From Source File")); } override void SetControls(ProjectOptions options) { mMultiObj.setChecked(options.multiobj); mPreservePaths.setChecked(options.preservePaths); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mMultiObj.isChecked(), options.multiobj, refoptions.multiobj); changes += changeOption(mPreservePaths.isChecked(), options.preservePaths, refoptions.preservePaths); return changes; } CheckBox mMultiObj; CheckBox mPreservePaths; } class DmdLinkerPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return "Linker"; } override string GetPageName() { return "General"; } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); EnableControls(); } override void CreateControls() { AddControl("Output File", mExeFile = new Text(mCanvas)); AddControl("Object Files", mObjFiles = new Text(mCanvas)); AddControl("Library Files", mLibFiles = new Text(mCanvas)); AddControl("Library Search Path", mLibPaths = new Text(mCanvas)); //AddControl("Library search paths only work if you have modified sc.ini to include DMD_LIB!", null); AddControl("Definition File", mDefFile = new Text(mCanvas)); AddControl("Resource File", mResFile = new Text(mCanvas)); AddControl("Generate Map File", mGenMap = new ComboBox(mCanvas, [ "Minimum", "Symbols By Address", "Standard", "Full", "With cross references" ], false)); AddControl("", mImplib = new CheckBox(mCanvas, "Create import library")); AddControl("", mUseStdLibPath = new CheckBox(mCanvas, "Use global and standard library search paths")); AddControl("C Runtime", mCRuntime = new ComboBox(mCanvas, [ "None", "Static Release (LIBCMT)", "Static Debug (LIBCMTD)", "Dynamic Release (MSCVRT)", "Dynamic Debug (MSCVRTD)" ], false)); } void EnableControls() { if(ProjectOptions options = GetProjectOptions()) mCRuntime.setEnabled(options.isX86_64); } override void SetControls(ProjectOptions options) { mExeFile.setText(options.exefile); mObjFiles.setText(options.objfiles); mLibFiles.setText(options.libfiles); mLibPaths.setText(options.libpaths); mDefFile.setText(options.deffile); mResFile.setText(options.resfile); mGenMap.setSelection(options.mapverbosity); mImplib.setChecked(options.createImplib); mUseStdLibPath.setChecked(options.useStdLibPath); mCRuntime.setSelection(options.cRuntime); EnableControls(); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mExeFile.getText(), options.exefile, refoptions.exefile); changes += changeOption(mObjFiles.getText(), options.objfiles, refoptions.objfiles); changes += changeOption(mLibFiles.getText(), options.libfiles, refoptions.libfiles); changes += changeOption(mLibPaths.getText(), options.libpaths, refoptions.libpaths); changes += changeOption(mDefFile.getText(), options.deffile, refoptions.deffile); changes += changeOption(mResFile.getText(), options.resfile, refoptions.resfile); changes += changeOption(cast(uint) mGenMap.getSelection(), options.mapverbosity, refoptions.mapverbosity); changes += changeOption(mImplib.isChecked(), options.createImplib, refoptions.createImplib); changes += changeOption(mUseStdLibPath.isChecked(), options.useStdLibPath, refoptions.useStdLibPath); changes += changeOption(cast(uint) mCRuntime.getSelection(), options.cRuntime, refoptions.cRuntime); return changes; } Text mExeFile; Text mObjFiles; Text mLibFiles; Text mLibPaths; Text mDefFile; Text mResFile; ComboBox mGenMap; CheckBox mImplib; CheckBox mUseStdLibPath; ComboBox mCRuntime; } class DmdEventsPropertyPage : ProjectPropertyPage { override string GetCategoryName() { return ""; } override string GetPageName() { return "Build Events"; } override void CreateControls() { AddControl("Pre-Build Command", mPreCmd = new MultiLineText(mCanvas)); AddControl("Post-Build Command", mPostCmd = new MultiLineText(mCanvas)); Label lab = new Label(mCanvas, "Use \"if errorlevel 1 goto reportError\" to cancel on error"); lab.setRect(0, kPageHeight - kLineHeight, kPageWidth, kLineHeight); } override void SetControls(ProjectOptions options) { mPreCmd.setText(options.preBuildCommand); mPostCmd.setText(options.postBuildCommand); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mPreCmd.getText(), options.preBuildCommand, refoptions.preBuildCommand); changes += changeOption(mPostCmd.getText(), options.postBuildCommand, refoptions.postBuildCommand); return changes; } MultiLineText mPreCmd; MultiLineText mPostCmd; } class DmdCmdLinePropertyPage : ProjectPropertyPage { override string GetCategoryName() { return ""; } override string GetPageName() { return "Command line"; } override void CreateControls() { AddControl("Command line", mCmdLine = new MultiLineText(mCanvas, "", 0, true)); AddControl("Additional options", mAddOpt = new MultiLineText(mCanvas)); } override void OnConfigModified() { if(ProjectOptions options = GetProjectOptions()) if(mCmdLine && mCmdLine.hwnd) mCmdLine.setText(options.buildCommandLine(true, true, true)); } override void SetControls(ProjectOptions options) { mCmdLine.setText(options.buildCommandLine(true, true, true)); mAddOpt.setText(options.additionalOptions); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { int changes = 0; changes += changeOption(mAddOpt.getText(), options.additionalOptions, refoptions.additionalOptions); return changes; } MultiLineText mCmdLine; MultiLineText mAddOpt; } class ConfigNodePropertyPage : ProjectPropertyPage { abstract void SetControls(CFileNode node); abstract int DoApply(CFileNode node, CFileNode refnode, Config cfg); override void SetControls(ProjectOptions options) { if(auto node = GetNode()) SetControls(node); } override int DoApply(ProjectOptions options, ProjectOptions refoptions) { return 0; } CHierNode[] GetSelectedNodes() { if(auto cfg = GetConfig()) // any config works { auto prj = cfg.GetProject(); CHierNode[] nodes; prj.GetSelectedNodes(nodes); return nodes; } return null; } CFileNode GetNode() { auto nodes = GetSelectedNodes(); for(size_t i = 0; i < nodes.length; i++) if(auto node = cast(CFileNode)nodes[i]) return node; return null; } override int IsPageDirty() { mixin(LogCallMix); if(mWindow) if(CFileNode node = GetNode()) { Config cfg = GetConfig(); scope CFileNode n = newCom!CFileNode(""); return DoApply(n, node, cfg) > 0 ? S_OK : S_FALSE; } return S_FALSE; } override int Apply() { mixin(LogCallMix); if(CFileNode rnode = GetNode()) { auto refnode = rnode.cloneDeep(); auto nodes = GetSelectedNodes(); for(int i = 0; i < mObjects.length; i++) { auto config = ComPtr!(Config)(mObjects[i]); if(config) { for(size_t n = 0; n < nodes.length; n++) if(auto node = cast(CFileNode)nodes[n]) { DoApply(node, refnode, config); if(CProjectNode pn = cast(CProjectNode) node.GetRootNode()) pn.SetProjectFileDirty(true); } } return S_OK; } } return returnError(E_FAIL); } } class FilePropertyPage : ConfigNodePropertyPage { override string GetCategoryName() { return ""; } override string GetPageName() { return "File"; } override void CreateControls() { AddControl("", mPerConfig = new CheckBox(mCanvas, "per Configuration Options (apply and reopen dialog to update)")); AddControl("Build Tool", mTool = new ComboBox(mCanvas, [ "Auto", "DMD", kToolResourceCompiler, "Custom", "None" ], false)); AddControl("Build Command", mCustomCmd = new MultiLineText(mCanvas)); AddControl("Other Dependencies", mDependencies = new Text(mCanvas)); AddControl("Output File", mOutFile = new Text(mCanvas)); AddControl("", mLinkOut = new CheckBox(mCanvas, "Add output to link")); } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); enableControls(mTool.getText()); } void enableControls(string tool) { bool perConfigChanged = mInitPerConfig != mPerConfig.isChecked(); bool isCustom = (tool == "Custom"); bool isRc = (tool == kToolResourceCompiler); mTool.setEnabled(!perConfigChanged); mCustomCmd.setEnabled(!perConfigChanged && isCustom); mDependencies.setEnabled(!perConfigChanged && (isCustom || isRc)); mOutFile.setEnabled(!perConfigChanged && isCustom); mLinkOut.setEnabled(!perConfigChanged && isCustom); } string GetCfgName() { return GetConfig().getCfgName(); } override void SetControls(CFileNode node) { string cfgname = GetCfgName(); string tool = node.GetTool(cfgname); if(tool.length == 0) mTool.setSelection(0); else mTool.setSelection(mTool.findString(tool)); mInitPerConfig = node.GetPerConfigOptions(); mPerConfig.setChecked(mInitPerConfig); mCustomCmd.setText(node.GetCustomCmd(cfgname)); mDependencies.setText(node.GetDependencies(cfgname)); mOutFile.setText(node.GetOutFile(cfgname)); mLinkOut.setChecked(node.GetLinkOutput(cfgname)); enableControls(tool); } override int DoApply(CFileNode node, CFileNode refnode, Config cfg) { string cfgname = GetCfgName(); int changes = 0; string tool = mTool.getText(); if(tool == "Auto") tool = ""; changes += changeOptionDg!bool(mPerConfig.isChecked(), &node.SetPerConfigOptions, refnode.GetPerConfigOptions()); changes += changeOptionDg!string(tool, (s) => node.SetTool(cfgname, s), refnode.GetTool(cfgname)); changes += changeOptionDg!string(mCustomCmd.getText(), (s) => node.SetCustomCmd(cfgname, s), refnode.GetCustomCmd(cfgname)); changes += changeOptionDg!string(mDependencies.getText(), (s) => node.SetDependencies(cfgname, s), refnode.GetDependencies(cfgname)); changes += changeOptionDg!string(mOutFile.getText(), (s) => node.SetOutFile(cfgname, s), refnode.GetOutFile(cfgname)); changes += changeOptionDg!bool(mLinkOut.isChecked(), (b) => node.SetLinkOutput(cfgname, b), refnode.GetLinkOutput(cfgname)); enableControls(tool); return changes; } bool mInitPerConfig; CheckBox mPerConfig; ComboBox mTool; MultiLineText mCustomCmd; Text mDependencies; Text mOutFile; CheckBox mLinkOut; } /////////////////////////////////////////////////////////////////////////////// class DirPropertyPage : GlobalPropertyPage { this(GlobalOptions options) { super(options); kNeededLines = 13; } void dirCreateControls(string name, string overrideIni) { AddControl(name ~ " install path", mDmdPath = new Text(mCanvas)); mLinesPerMultiLine = 2; AddControl("Import paths", mImpPath = new MultiLineText(mCanvas)); mLinesPerMultiLine = 10; AddControl("", mTabArch = new TabControl(mCanvas, ["Win32", "x64"])); auto page32 = mTabArch.pages[0]; if(auto w = cast(Window)page32) w.commandDelegate = mCanvas.commandDelegate; mResizableWidgets ~= page32; kPageWidth -= 6; mLines = 0; mLinesPerMultiLine = 3; AddControl("Executable paths", mExePath = new MultiLineText(page32)); mLinesPerMultiLine = 2; AddControl("Library paths", mLibPath = new MultiLineText(page32)); auto page64 = mTabArch.pages[1]; if(auto w = cast(Window)page64) w.commandDelegate = mCanvas.commandDelegate; mResizableWidgets ~= page64; mLines = 0; mLinesPerMultiLine = 3; AddControl("Executable paths", mExePath64 = new MultiLineText(page64)); mLinesPerMultiLine = 2; AddControl("Library paths", mLibPath64 = new MultiLineText(page64)); if(overrideIni.length) { AddControl("", mOverrideIni64 = new CheckBox(page64, overrideIni)); AddControl("Linker", mLinkerExecutable64 = new Text(page64)); AddControl("Additional options", mLinkerOptions64 = new Text(page64)); } } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); enableControls(); } void enableControls() { if(mOverrideIni64) { mLinkerExecutable64.setEnabled(mOverrideIni64.isChecked()); mLinkerOptions64.setEnabled(mOverrideIni64.isChecked()); } } abstract CompilerDirectories* getCompilerOptions(GlobalOptions opts); override void SetControls(GlobalOptions opts) { CompilerDirectories* opt = getCompilerOptions(opts); mDmdPath.setText(opt.InstallDir); mExePath.setText(opt.ExeSearchPath); mImpPath.setText(opt.ImpSearchPath); mLibPath.setText(opt.LibSearchPath); mExePath64.setText(opt.ExeSearchPath64); mLibPath64.setText(opt.LibSearchPath64); if(mOverrideIni64) { mOverrideIni64.setChecked(opt.overrideIni64); mLinkerExecutable64.setText(opt.overrideLinker64); mLinkerOptions64.setText(opt.overrideOptions64); } enableControls(); } override int DoApply(GlobalOptions opts, GlobalOptions refopts) { CompilerDirectories* opt = getCompilerOptions(opts); CompilerDirectories* refopt = getCompilerOptions(refopts); int changes = 0; changes += changeOption(mDmdPath.getText(), opt.InstallDir, refopt.InstallDir); changes += changeOption(mExePath.getText(), opt.ExeSearchPath, refopt.ExeSearchPath); changes += changeOption(mImpPath.getText(), opt.ImpSearchPath, refopt.ImpSearchPath); changes += changeOption(mLibPath.getText(), opt.LibSearchPath, refopt.LibSearchPath); changes += changeOption(mExePath64.getText(), opt.ExeSearchPath64, refopt.ExeSearchPath64); changes += changeOption(mLibPath64.getText(), opt.LibSearchPath64, refopt.LibSearchPath64); if(mOverrideIni64) { changes += changeOption(mOverrideIni64.isChecked(), opt.overrideIni64, refopt.overrideIni64); changes += changeOption(mLinkerExecutable64.getText(), opt.overrideLinker64, refopt.overrideLinker64); changes += changeOption(mLinkerOptions64.getText(), opt.overrideOptions64, refopt.overrideOptions64); } return changes; } TabControl mTabArch; Text mDmdPath; MultiLineText mExePath; MultiLineText mImpPath; MultiLineText mLibPath; MultiLineText mExePath64; MultiLineText mLibPath64; CheckBox mOverrideIni64; Text mLinkerExecutable64; Text mLinkerOptions64; } /////////////////////////////////////////////////////////////////////////////// class DmdDirPropertyPage : DirPropertyPage { override string GetCategoryName() { return "D Options"; } override string GetPageName() { return "DMD Directories"; } this(GlobalOptions options) { super(options); } override void CreateControls() { dirCreateControls("DMD", "override linker settings from dmd configuration in sc.ini."); } override CompilerDirectories* getCompilerOptions(GlobalOptions opts) { return &opts.DMD; } } /////////////////////////////////////////////////////////////////////////////// class GdcDirPropertyPage : DirPropertyPage { override string GetCategoryName() { return "D Options"; } override string GetPageName() { return "GDC Directories"; } this(GlobalOptions options) { super(options); } override void CreateControls() { dirCreateControls("GDC", ""); } override CompilerDirectories* getCompilerOptions(GlobalOptions opts) { return &opts.GDC; } } /////////////////////////////////////////////////////////////////////////////// class LdcDirPropertyPage : DirPropertyPage { override string GetCategoryName() { return "D Options"; } override string GetPageName() { return "LDC Directories"; } this(GlobalOptions options) { super(options); } override void CreateControls() { dirCreateControls("LDC", ""); } override CompilerDirectories* getCompilerOptions(GlobalOptions opts) { return &opts.LDC; } } /////////////////////////////////////////////////////////////////////////////// class ToolsProperty2Page : GlobalPropertyPage { override string GetCategoryName() { return "Projects"; } override string GetPageName() { return "D Options"; } this(GlobalOptions options) { super(options); kNeededLines = 12; } override void CreateControls() { AddControl("", mSortProjects = new CheckBox(mCanvas, "Sort project items")); AddControl("", mShowUptodate = new CheckBox(mCanvas, "Show why a target is rebuilt")); AddControl("", mTimeBuilds = new CheckBox(mCanvas, "Show build time")); AddControl("", mStopSlnBuild = new CheckBox(mCanvas, "Stop solution build on error")); AddControl("", mDemangleError = new CheckBox(mCanvas, "Demangle names in link errors")); AddControl("", mOptlinkDeps = new CheckBox(mCanvas, "Monitor OPTLINK dependencies")); //AddControl("Remove project item", mDeleteFiles = // new ComboBox(mCanvas, [ "Do not delete file on disk", "Ask", "Delete file on disk" ])); AddControl("JSON paths", mJSNPath = new MultiLineText(mCanvas)); AddControl("Resource includes", mIncPath = new Text(mCanvas)); AddControl("Compile and Run options", mCompileAndRunOpts = new Text(mCanvas)); } override void SetControls(GlobalOptions opts) { mTimeBuilds.setChecked(opts.timeBuilds); mSortProjects.setChecked(opts.sortProjects); mShowUptodate.setChecked(opts.showUptodateFailure); mStopSlnBuild.setChecked(opts.stopSolutionBuild); mDemangleError.setChecked(opts.demangleError); mOptlinkDeps.setChecked(opts.optlinkDeps); //mDeleteFiles.setSelection(opts.deleteFiles + 1); mIncPath.setText(opts.IncSearchPath); mJSNPath.setText(opts.JSNSearchPath); mCompileAndRunOpts.setText(opts.compileAndRunOpts); } override int DoApply(GlobalOptions opts, GlobalOptions refopts) { int changes = 0; changes += changeOption(mTimeBuilds.isChecked(), opts.timeBuilds, refopts.timeBuilds); changes += changeOption(mSortProjects.isChecked(), opts.sortProjects, refopts.sortProjects); changes += changeOption(mShowUptodate.isChecked(), opts.showUptodateFailure, refopts.showUptodateFailure); changes += changeOption(mStopSlnBuild.isChecked(), opts.stopSolutionBuild, refopts.stopSolutionBuild); changes += changeOption(mDemangleError.isChecked(), opts.demangleError, refopts.demangleError); changes += changeOption(mOptlinkDeps.isChecked(), opts.optlinkDeps, refopts.optlinkDeps); //changes += changeOption(cast(byte) (mDeleteFiles.getSelection() - 1), opts.deleteFiles, refopts.deleteFiles); changes += changeOption(mIncPath.getText(), opts.IncSearchPath, refopts.IncSearchPath); changes += changeOption(mJSNPath.getText(), opts.JSNSearchPath, refopts.JSNSearchPath); changes += changeOption(mCompileAndRunOpts.getText(), opts.compileAndRunOpts, refopts.compileAndRunOpts); return changes; } CheckBox mTimeBuilds; CheckBox mSortProjects; CheckBox mShowUptodate; CheckBox mStopSlnBuild; CheckBox mDemangleError; CheckBox mOptlinkDeps; //ComboBox mDeleteFiles; Text mIncPath; Text mCompileAndRunOpts; MultiLineText mJSNPath; } /////////////////////////////////////////////////////////////////////////////// class ColorizerPropertyPage : GlobalPropertyPage { override string GetCategoryName() { return "Language"; } override string GetPageName() { return "Colorizer"; } this(GlobalOptions options) { super(options); kNeededLines = 11; } override void CreateControls() { AddControl("", mColorizeVersions = new CheckBox(mCanvas, "Colorize version and debug statements")); AddControl("", mColorizeCoverage = new CheckBox(mCanvas, "Colorize coverage from .LST file")); debug AddControl("", mShowCoverageMargin = new CheckBox(mCanvas, "Show coverage margin")); AddControl("", mAutoOutlining = new CheckBox(mCanvas, "Add outlining regions when opening D files")); AddControl("", mParseSource = new CheckBox(mCanvas, "Parse source for syntax errors")); AddControl("", mPasteIndent = new CheckBox(mCanvas, "Reindent new lines after paste")); AddControl("Colored types", mUserTypes = new MultiLineText(mCanvas)); } override void SetControls(GlobalOptions opts) { mColorizeVersions.setChecked(opts.ColorizeVersions); mColorizeCoverage.setChecked(opts.ColorizeCoverage); debug mShowCoverageMargin.setChecked(opts.showCoverageMargin); mAutoOutlining.setChecked(opts.autoOutlining); mParseSource.setChecked(opts.parseSource); mPasteIndent.setChecked(opts.pasteIndent); mUserTypes.setText(opts.UserTypesSpec); //mSemantics.setEnabled(false); } override int DoApply(GlobalOptions opts, GlobalOptions refopts) { int changes = 0; changes += changeOption(mColorizeVersions.isChecked(), opts.ColorizeVersions, refopts.ColorizeVersions); changes += changeOption(mColorizeCoverage.isChecked(), opts.ColorizeCoverage, refopts.ColorizeCoverage); debug changes += changeOption(mShowCoverageMargin.isChecked(), opts.showCoverageMargin, refopts.showCoverageMargin); changes += changeOption(mAutoOutlining.isChecked(), opts.autoOutlining, refopts.autoOutlining); changes += changeOption(mParseSource.isChecked(), opts.parseSource, refopts.parseSource); changes += changeOption(mPasteIndent.isChecked(), opts.pasteIndent, refopts.pasteIndent); changes += changeOption(mUserTypes.getText(), opts.UserTypesSpec, refopts.UserTypesSpec); return changes; } CheckBox mColorizeVersions; CheckBox mColorizeCoverage; debug CheckBox mShowCoverageMargin; CheckBox mAutoOutlining; CheckBox mParseSource; CheckBox mPasteIndent; MultiLineText mUserTypes; } /////////////////////////////////////////////////////////////////////////////// class IntellisensePropertyPage : GlobalPropertyPage { override string GetCategoryName() { return "Language"; } override string GetPageName() { return "Intellisense"; } this(GlobalOptions options) { super(options); } override void CreateControls() { AddControl("", mExpandSemantics = new CheckBox(mCanvas, "Expansions from semantic analysis")); AddControl("", mExpandFromBuffer = new CheckBox(mCanvas, "Expansions from text buffer")); AddControl("", mExpandFromJSON = new CheckBox(mCanvas, "Expansions from JSON browse information")); AddControl("Show expansion when", mExpandTrigger = new ComboBox(mCanvas, [ "pressing Ctrl+Space", "writing '.'", "writing an identifier" ], false)); AddControl("", mShowTypeInTooltip = new CheckBox(mCanvas, "Show type of expressions in tool tip")); AddControl("", mSemanticGotoDef = new CheckBox(mCanvas, "Use semantic analysis for \"Goto Definition\" (before trying JSON info)")); version(DParser) AddControl("", mUseDParser = new CheckBox(mCanvas, "Use Alexander Bothe's D parsing engine for semantic analysis")); AddControl("", mMixinAnalysis = new CheckBox(mCanvas, "Enable mixin analysis")); AddControl("", mUFCSExpansions = new CheckBox(mCanvas, "Enable UFCS expansions")); } override void UpdateDirty(bool bDirty) { super.UpdateDirty(bDirty); EnableControls(); } void EnableControls() { version(DParser) bool useDParser = mUseDParser.isChecked(); else bool useDParser = false; mMixinAnalysis.setEnabled(useDParser); mUFCSExpansions.setEnabled(useDParser); } override void SetControls(GlobalOptions opts) { mExpandSemantics.setChecked(opts.expandFromSemantics); mExpandFromBuffer.setChecked(opts.expandFromBuffer); mExpandFromJSON.setChecked(opts.expandFromJSON); mExpandTrigger.setSelection(opts.expandTrigger); mShowTypeInTooltip.setChecked(opts.showTypeInTooltip); mSemanticGotoDef.setChecked(opts.semanticGotoDef); version(DParser) mUseDParser.setChecked(opts.useDParser); mMixinAnalysis.setChecked(opts.mixinAnalysis); mUFCSExpansions.setChecked(opts.UFCSExpansions); //mExpandSemantics.setEnabled(false); } override int DoApply(GlobalOptions opts, GlobalOptions refopts) { int changes = 0; changes += changeOption(mExpandSemantics.isChecked(), opts.expandFromSemantics, refopts.expandFromSemantics); changes += changeOption(mExpandFromBuffer.isChecked(), opts.expandFromBuffer, refopts.expandFromBuffer); changes += changeOption(mExpandFromJSON.isChecked(), opts.expandFromJSON, refopts.expandFromJSON); changes += changeOption(cast(byte) mExpandTrigger.getSelection(), opts.expandTrigger, refopts.expandTrigger); changes += changeOption(mShowTypeInTooltip.isChecked(), opts.showTypeInTooltip, refopts.showTypeInTooltip); changes += changeOption(mSemanticGotoDef.isChecked(), opts.semanticGotoDef, refopts.semanticGotoDef); version(DParser) changes += changeOption(mUseDParser.isChecked(), opts.useDParser, refopts.useDParser); changes += changeOption(mMixinAnalysis.isChecked(), opts.mixinAnalysis, refopts.mixinAnalysis); changes += changeOption(mUFCSExpansions.isChecked(), opts.UFCSExpansions, refopts.UFCSExpansions); return changes; } CheckBox mExpandSemantics; CheckBox mExpandFromBuffer; CheckBox mExpandFromJSON; ComboBox mExpandTrigger; CheckBox mShowTypeInTooltip; CheckBox mSemanticGotoDef; version(DParser) CheckBox mUseDParser; CheckBox mUFCSExpansions; CheckBox mMixinAnalysis; } /////////////////////////////////////////////////////////////////////////////// // more guids in dpackage.d starting up to 980f const GUID g_GeneralPropertyPage = uuid("002a2de9-8bb6-484d-9810-7e4ad4084715"); const GUID g_DmdGeneralPropertyPage = uuid("002a2de9-8bb6-484d-9811-7e4ad4084715"); const GUID g_DmdDebugPropertyPage = uuid("002a2de9-8bb6-484d-9812-7e4ad4084715"); const GUID g_DmdCodeGenPropertyPage = uuid("002a2de9-8bb6-484d-9813-7e4ad4084715"); const GUID g_DmdMessagesPropertyPage = uuid("002a2de9-8bb6-484d-9814-7e4ad4084715"); const GUID g_DmdOutputPropertyPage = uuid("002a2de9-8bb6-484d-9815-7e4ad4084715"); const GUID g_DmdLinkerPropertyPage = uuid("002a2de9-8bb6-484d-9816-7e4ad4084715"); const GUID g_DmdEventsPropertyPage = uuid("002a2de9-8bb6-484d-9817-7e4ad4084715"); const GUID g_CommonPropertyPage = uuid("002a2de9-8bb6-484d-9818-7e4ad4084715"); const GUID g_DebuggingPropertyPage = uuid("002a2de9-8bb6-484d-9819-7e4ad4084715"); const GUID g_FilePropertyPage = uuid("002a2de9-8bb6-484d-981a-7e4ad4084715"); const GUID g_DmdDocPropertyPage = uuid("002a2de9-8bb6-484d-981b-7e4ad4084715"); const GUID g_DmdCmdLinePropertyPage = uuid("002a2de9-8bb6-484d-981c-7e4ad4084715"); // does not need to be registered, created explicitely by package const GUID g_DmdDirPropertyPage = uuid("002a2de9-8bb6-484d-9820-7e4ad4084715"); const GUID g_GdcDirPropertyPage = uuid("002a2de9-8bb6-484d-9824-7e4ad4084715"); const GUID g_LdcDirPropertyPage = uuid("002a2de9-8bb6-484d-9825-7e4ad4084715"); const GUID g_ToolsProperty2Page = uuid("002a2de9-8bb6-484d-9822-7e4ad4084715"); // registered under Languages\\Language Services\\D\\EditorToolsOptions\\Colorizer, created explicitely by package const GUID g_ColorizerPropertyPage = uuid("002a2de9-8bb6-484d-9821-7e4ad4084715"); const GUID g_IntellisensePropertyPage = uuid("002a2de9-8bb6-484d-9823-7e4ad4084715"); const GUID* guids_propertyPages[] = [ &g_GeneralPropertyPage, &g_DmdGeneralPropertyPage, &g_DmdDebugPropertyPage, &g_DmdCodeGenPropertyPage, &g_DmdMessagesPropertyPage, &g_DmdOutputPropertyPage, &g_DmdLinkerPropertyPage, &g_DmdEventsPropertyPage, &g_CommonPropertyPage, &g_DebuggingPropertyPage, &g_FilePropertyPage, &g_DmdDocPropertyPage, &g_DmdCmdLinePropertyPage, ]; class PropertyPageFactory : DComObject, IClassFactory { static PropertyPageFactory create(CLSID* rclsid) { foreach(id; guids_propertyPages) if(*id == *rclsid) return newCom!PropertyPageFactory(rclsid); return null; } this(CLSID* rclsid) { mClsid = *rclsid; } override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(queryInterface2!(IClassFactory) (this, IID_IClassFactory, riid, pvObject)) return S_OK; return super.QueryInterface(riid, pvObject); } override HRESULT CreateInstance(IUnknown UnkOuter, in IID* riid, void** pvObject) { PropertyPage ppp; assert(!UnkOuter); if(mClsid == g_GeneralPropertyPage) ppp = newCom!GeneralPropertyPage(); else if(mClsid == g_DebuggingPropertyPage) ppp = newCom!DebuggingPropertyPage(); else if(mClsid == g_DmdGeneralPropertyPage) ppp = newCom!DmdGeneralPropertyPage(); else if(mClsid == g_DmdDebugPropertyPage) ppp = newCom!DmdDebugPropertyPage(); else if(mClsid == g_DmdCodeGenPropertyPage) ppp = newCom!DmdCodeGenPropertyPage(); else if(mClsid == g_DmdMessagesPropertyPage) ppp = newCom!DmdMessagesPropertyPage(); else if(mClsid == g_DmdDocPropertyPage) ppp = newCom!DmdDocPropertyPage(); else if(mClsid == g_DmdOutputPropertyPage) ppp = newCom!DmdOutputPropertyPage(); else if(mClsid == g_DmdLinkerPropertyPage) ppp = newCom!DmdLinkerPropertyPage(); else if(mClsid == g_DmdEventsPropertyPage) ppp = newCom!DmdEventsPropertyPage(); else if(mClsid == g_DmdCmdLinePropertyPage) ppp = newCom!DmdCmdLinePropertyPage(); else if(mClsid == g_CommonPropertyPage) ppp = newCom!CommonPropertyPage(); else if(mClsid == g_FilePropertyPage) ppp = newCom!FilePropertyPage(); else return E_INVALIDARG; return ppp.QueryInterface(riid, pvObject); } override HRESULT LockServer(in BOOL fLock) { return S_OK; } static int GetProjectPages(CAUUID *pPages, bool addFile) { version(all) { pPages.cElems = (addFile ? 12 : 11); pPages.pElems = cast(GUID*)CoTaskMemAlloc(pPages.cElems*GUID.sizeof); if (!pPages.pElems) return E_OUTOFMEMORY; int idx = 0; if(addFile) pPages.pElems[idx++] = g_FilePropertyPage; pPages.pElems[idx++] = g_GeneralPropertyPage; pPages.pElems[idx++] = g_DebuggingPropertyPage; pPages.pElems[idx++] = g_DmdGeneralPropertyPage; pPages.pElems[idx++] = g_DmdDebugPropertyPage; pPages.pElems[idx++] = g_DmdCodeGenPropertyPage; pPages.pElems[idx++] = g_DmdMessagesPropertyPage; pPages.pElems[idx++] = g_DmdDocPropertyPage; pPages.pElems[idx++] = g_DmdOutputPropertyPage; pPages.pElems[idx++] = g_DmdLinkerPropertyPage; pPages.pElems[idx++] = g_DmdCmdLinePropertyPage; pPages.pElems[idx++] = g_DmdEventsPropertyPage; return S_OK; } else { return returnError(E_NOTIMPL); } } static int GetCommonPages(CAUUID *pPages) { pPages.cElems = 1; pPages.pElems = cast(GUID*)CoTaskMemAlloc(pPages.cElems*GUID.sizeof); if (!pPages.pElems) return E_OUTOFMEMORY; pPages.pElems[0] = g_CommonPropertyPage; return S_OK; } static int GetFilePages(CAUUID *pPages) { pPages.cElems = 1; pPages.pElems = cast(GUID*)CoTaskMemAlloc(pPages.cElems*GUID.sizeof); if (!pPages.pElems) return E_OUTOFMEMORY; pPages.pElems[0] = g_FilePropertyPage; return S_OK; } private: GUID mClsid; }
D
instance DJG_705_ANGAR_DI(NPC_DEFAULT) { name[0] = "Ангар"; guild = GIL_DJG; id = 70500; voice = 4; flags = 0; npctype = NPCTYPE_FRIEND; aivar[AIV_PARTYMEMBER] = TRUE; b_setattributestochapter(self,6); fight_tactic = FAI_HUMAN_MASTER; EquipItem(self,itmw_2h_sld_sword); CreateInvItems(self,itpo_health_02,6); CreateInvItems(self,itmi_oldcoin,1); b_createambientinv(self); b_setnpcvisual(self,MALE,"Hum_Head_Bald",FACE_B_CORANGAR,BODYTEX_TATTOO_B,itar_corangar); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); b_givenpctalents(self); b_setfightskills(self,80); daily_routine = rtn_start_70500; }; func void rtn_start_70500() { ta_stand_armscrossed(8,0,23,0,"SHIP_CREW_03"); ta_stand_armscrossed(23,0,8,0,"SHIP_CREW_03"); }; func void rtn_followdi_70500() { ta_follow_player(8,0,23,0,"SHIP_CREW_03"); ta_follow_player(23,0,8,0,"SHIP_CREW_03"); }; func void rtn_firedragonisland_70500() { ta_stand_armscrossed(8,0,23,0,"DI_DRACONIANAREA_16"); ta_stand_armscrossed(23,0,8,0,"DI_DRACONIANAREA_16"); }; func void rtn_orkoberst_di_70500() { ta_stand_armscrossed(8,0,23,0,"DI_ORKOBERST"); ta_stand_armscrossed(23,0,8,0,"DI_ORKOBERST"); }; func void rtn_troll_di_70500() { ta_stand_armscrossed(8,0,23,0,"DI_ORKAREA_TROLL"); ta_stand_armscrossed(23,0,8,0,"DI_ORKAREA_TROLL"); };
D
// ************ // SPL_FireBolt // ************ const int SPL_Cost_Firebolt = 2; const int SPL_Damage_Firebolt = 25; INSTANCE Spell_Firebolt (C_Spell_Proto) { time_per_mana = 0; damage_per_level = SPL_Damage_Firebolt; damageType = DAM_MAGIC; }; func int Spell_Logic_Firebolt (var int manaInvested) { if (Npc_GetActiveSpellIsScroll(self) && (self.attribute[ATR_MANA] >= SPL_Cost_Scroll)) { return SPL_SENDCAST; } else if (self.attribute[ATR_MANA] >= SPL_Cost_Firebolt) { return SPL_SENDCAST; } else //nicht genug Mana { return SPL_SENDSTOP; }; }; func void Spell_Cast_Firebolt() { if (Npc_GetActiveSpellIsScroll(self)) { self.attribute[ATR_MANA] = self.attribute[ATR_MANA] - SPL_Cost_Scroll; } else { self.attribute[ATR_MANA] = self.attribute[ATR_MANA] - SPL_Cost_Firebolt; }; self.aivar[AIV_SelectSpell] += 1; };
D
module pixelperfectengine.map.mapformat; /* * Copyright (C) 2015-2019, by Laszlo Szeremi under the Boost license. * * Pixel Perfect Engine, map.mapformat module */ import sdlang; import pixelperfectengine.graphics.layers; import pixelperfectengine.graphics.raster : PaletteContainer; import std.stdio; import std.exception : enforce; import std.typecons : BitFlags; import pixelperfectengine.system.etc : parseHex; import std.format : format; import std.conv : to; import collections.treemap; public import pixelperfectengine.map.mapdata; import pixelperfectengine.system.file; import pixelperfectengine.collision.objectcollision; import pixelperfectengine.system.exc : PPEException; /** * Serializes/deserializes XMF map data in SDLang format. * Each layer can contain objects (eg. for marking events, clipping, or sprites if applicable), tilemapping (not for SpriteLayers), embedded * data such as tilemapping or scripts, and so on. * * Also does some basic resource managing. * * Note on layer tags: * As of this version, additional tags within layers must have individual names. Subtags within a parent also need to have individual names. * Namespaces are reserved for internal use (eg. file sources, objects). */ public class MapFormat { public TreeMap!(int,Tag) layerData; ///Layerdata stored as SDLang tags. public TreeMap!(int,Layer) layeroutput;///Used to fast map and object data pullback in editors protected Tag metadata; ///Stores metadata. protected Tag root; ///Root tag for common information. public TileInfo[][int] tileDataFromExt;///Stores basic TileData that are loaded through extensions /** * Associative array used for rendering mode lookups in one way. */ public static immutable RenderingMode[string] renderingModeLookup; shared static this() { renderingModeLookup["null"] = RenderingMode.init; renderingModeLookup["Copy"] = RenderingMode.Copy; renderingModeLookup["Blitter"] = RenderingMode.Blitter; renderingModeLookup["AlphaBlend"] = RenderingMode.AlphaBlend; renderingModeLookup["Add"] = RenderingMode.Add; renderingModeLookup["AddBl"] = RenderingMode.AddBl; renderingModeLookup["Subtract"] = RenderingMode.Subtract; renderingModeLookup["SubtractBl"] = RenderingMode.SubtractBl; renderingModeLookup["Diff"] = RenderingMode.Diff; renderingModeLookup["DiffBl"] = RenderingMode.DiffBl; renderingModeLookup["Multiply"] = RenderingMode.Multiply; renderingModeLookup["MultiplyBl"] = RenderingMode.MultiplyBl; renderingModeLookup["Screen"] = RenderingMode.Screen; renderingModeLookup["ScreenBl"] = RenderingMode.ScreenBl; renderingModeLookup["AND"] = RenderingMode.AND; renderingModeLookup["OR"] = RenderingMode.OR; renderingModeLookup["XOR"] = RenderingMode.XOR; } /** * Creates new instance from scratch. */ public this(string name, int resX, int resY) @trusted { root = new Tag(); metadata = new Tag(root, null, "Metadata"); new Tag(metadata, null, "Version", [Value(1), Value(0)]); new Tag(metadata, null, "Name", [Value(name)]); new Tag(metadata, null, "Resolution", [Value(resX), Value(resY)]); } /** * Serializes itself from file. */ public this(F)(F file) @trusted { //File f = File(path, "rb"); char[] source; source.length = cast(size_t)file.size; source = file.rawRead(source); root = parseSource(cast(string)source); //Just quickly go through the tags and sort them out foreach (Tag t0 ; root.all.tags) { switch (t0.namespace) { case "Layer": const int priority = t0.values[1].get!int; layerData[priority] = t0; RenderingMode lrd = renderingModeLookup.get(t0.getTagValue!string("RenderingMode"), RenderingMode.Copy); switch (t0.name) { case "Tile": layeroutput[priority] = new TileLayer(t0.values[2].get!int, t0.values[3].get!int, lrd); break; case "Sprite": layeroutput[priority] = new SpriteLayer(lrd); break; default: throw new Exception("Unsupported layer format"); } break; default: if(t0.name == "Metadata"){ metadata = t0; } break; } } //assert(layerData.length == layeroutput.length); } /** * Loads tiles from disk to all layers. Also loads the palette. * TODO: Add dpk support * Params: * paletteTarget: The destination, where the palettes should be loaded into. */ public void loadTiles(PaletteContainer paletteTarget) @trusted { import pixelperfectengine.system.file; foreach (key, value ; layerData) { if (value.name != "Tile") continue; Tag[] tileSource = getAllTileSources(key); foreach (t0; tileSource) { string path = t0.getValue!string(); Image i = loadImage(File(path, "rb")); void helperFunc(T)(T[] bitmaps, Tag source) { TileLayer tl = cast(TileLayer)layeroutput[key]; Tag tileInfo = source.getTag("Embed:TileInfo", null); if(tileInfo !is null) foreach (t1 ; tileInfo.tags) { tl.addTile(bitmaps[t1.values[0].get!int()], cast(wchar)t1.values[1].get!int()); } } switch(i.getBitdepth){ case 2: Bitmap2Bit[] bitmaps = loadBitmapSheetFromImage!(Bitmap2Bit)(i, value.values[2].get!int(), value.values[3].get!int()); helperFunc(bitmaps, t0); break; case 4: Bitmap4Bit[] bitmaps = loadBitmapSheetFromImage!(Bitmap4Bit)(i, value.values[2].get!int(), value.values[3].get!int()); helperFunc(bitmaps, t0); break; case 8: Bitmap8Bit[] bitmaps = loadBitmapSheetFromImage!(Bitmap8Bit)(i, value.values[2].get!int(), value.values[3].get!int()); helperFunc(bitmaps, t0); break; case 16: Bitmap16Bit[] bitmaps = loadBitmapSheetFromImage!(Bitmap16Bit)(i, value.values[2].get!int(), value.values[3].get!int()); helperFunc(bitmaps, t0); break; case 32: Bitmap32Bit[] bitmaps = loadBitmapSheetFromImage!(Bitmap32Bit)(i, value.values[2].get!int(), value.values[3].get!int()); helperFunc(bitmaps, t0); break; default: throw new Exception("Unsupported image bitdepth"); } if (paletteTarget !is null && isPaletteFileExists(path)) { paletteTarget.loadPaletteChunk(loadPaletteFromImage(i), cast(ushort)t0.getAttribute!int("offset", 0)); } //debug writeln(paletteTarget.palette); } } } /** * Loads the sprites associated with the layer ID. * Params: * layerID = the ID of the layer. * paletteTarget = target for any loaded palettes, ideally the raster. * Returns: An associative array with sprite identifiers as the keys, and the sprite bitmaps as its elements. * Note: It's mainly intended for editor placeholders, but also could work with production-made games as long * as the limitations don't intercept anything major. */ public ABitmap[int] loadSprites(int layerID, PaletteContainer paletteTarget) @trusted { import pixelperfectengine.system.file; ABitmap[int] result; Image[string] imageBuffer; //Resource manager to minimize reloading image files Tag tBase = layerData[layerID]; if (tBase.name != "Sprite") return result; foreach (Tag t0; tBase.all.tags) { switch (t0.getFullName.toString) { case "File:SpriteSource": string filename = t0.expectValue!string(); if (imageBuffer.get(filename, null) is null) { imageBuffer[filename] = loadImage(File(filename)); } const int id = t0.expectValue!int(); if ("horizOffset" in t0.attributes && "vertOffset" in t0.attributes && "width" in t0.attributes && "height" in t0.attributes){ const int hOffset = t0.getAttribute!int("horizOffset"), vOffset = t0.getAttribute!int("vertOffset"), w = t0.getAttribute!int("width"), h = t0.getAttribute!int("height"); switch (imageBuffer[filename].getBitdepth) { case 2: result[id] = loadBitmapSliceFromImage!Bitmap2Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 4: result[id] = loadBitmapSliceFromImage!Bitmap4Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 8: result[id] = loadBitmapSliceFromImage!Bitmap8Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 16: result[id] = loadBitmapSliceFromImage!Bitmap16Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 32: result[id] = loadBitmapSliceFromImage!Bitmap32Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; default: break; } } else { switch (imageBuffer[filename].getBitdepth) { case 2: result[id] = loadBitmapFromImage!Bitmap2Bit(imageBuffer[filename]); break; case 4: result[id] = loadBitmapFromImage!Bitmap4Bit(imageBuffer[filename]); break; case 8: result[id] = loadBitmapFromImage!Bitmap8Bit(imageBuffer[filename]); break; case 16: result[id] = loadBitmapFromImage!Bitmap16Bit(imageBuffer[filename]); break; case 32: result[id] = loadBitmapFromImage!Bitmap32Bit(imageBuffer[filename]); break; default: break; } } break; case "File:SpriteSheet": string filename = t0.expectValue!string(); if (imageBuffer.get(filename, null) is null) { imageBuffer[filename] = loadImage(File(filename)); } foreach (Tag t1 ; t0.tags) { if (t1.name == "SheetData") { foreach (Tag t2 ; t1.tags) { const int id = t2.values[0].get!int(), hOffset = t2.values[1].get!int(), vOffset = t2.values[2].get!int(), w = t2.values[3].get!int(), h = t2.values[4].get!int(); switch (imageBuffer[filename].getBitdepth) { case 2: result[id] = loadBitmapSliceFromImage!Bitmap2Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 4: result[id] = loadBitmapSliceFromImage!Bitmap4Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 8: result[id] = loadBitmapSliceFromImage!Bitmap8Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 16: result[id] = loadBitmapSliceFromImage!Bitmap16Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; case 32: result[id] = loadBitmapSliceFromImage!Bitmap32Bit(imageBuffer[filename], hOffset, vOffset, w, h); break; default: break; } } } } break; case "File:Palette": string filename = t0.expectValue!string(); if (imageBuffer.get(filename, null) is null) { imageBuffer[filename] = loadImage(File(filename)); } Color[] pal = loadPaletteFromImage(imageBuffer[filename]); const size_t palLength = "palShift" in t0.attributes ? 1<<(t0.getAttribute!int("palShift")) : pal.length; const int palOffset = "offset" in t0.attributes ? t0.getAttribute!int("offset") : 0; paletteTarget.loadPaletteChunk(pal[0..palLength], cast(ushort)palOffset); break; default: break; } } return result; } /** * Returns all objects belonging to a `layerID` in an array. */ public MapObject[] getLayerObjects(int layerID) @trusted { Tag t0 = layerData[layerID]; if (t0 is null) return null; MapObject[] result; try { foreach (Tag t1; t0.namespaces["Object"].tags) { MapObject obj = parseObject(t1, layerID); if (obj !is null) result ~= obj; } } catch (Exception e) { debug writeln(e); return null; } return result; } /** * Loads all sprites and objects to thir respective layers and the supplied ObjectCollisionDetector. * Params: * paletteTarget: A raster to load the palettes into. Must be not null. * ocd: The supplied ObjectCollisionDetector. Can be null. * Note: This is a default parser and loader, one might want to write a more complicated one for their application. */ public void loadAllSpritesAndObjects(PaletteContainer paletteTarget, ObjectCollisionDetector ocd) @trusted { import pixelperfectengine.collision.common; foreach (key, value; layeroutput) { ABitmap[int] spr = loadSprites(key, paletteTarget); MapObject[] objList = getLayerObjects(key); if (spr.length) { SpriteLayer sl = cast(SpriteLayer)value; foreach (MapObject key0; objList) { if (key0.type == MapObject.MapObjectType.sprite) { SpriteObject so = cast(SpriteObject)key0; sl.addSprite(spr[so.ssID], so.pID, so.x, so.y, so.palSel, so.palShift, so.masterAlpha, so.scaleHoriz, so.scaleVert, so.rendMode); if (ocd !is null && so.flags.toCollision) { ocd.objects[so.pID] = CollisionShape(sl.getSpriteCoordinate(so.pID), null); } } else if (ocd !is null && key0.type == MapObject.MapObjectType.box && key0.flags.toCollision) { BoxObject bo = cast(BoxObject)key0; ocd.objects[bo.pID] = CollisionShape(bo.position, null); } } } else if (ocd !is null) { foreach (MapObject key0; objList) { if (ocd !is null && key0.type == MapObject.MapObjectType.box && key0.flags.toCollision) { BoxObject bo = cast(BoxObject)key0; ocd.objects[bo.pID] = CollisionShape(bo.position, null); } } } } } /** * Loads mapping data from disk to all layers. */ public void loadMappingData () @trusted { import pixelperfectengine.system.etc : reinterpretCast; foreach (key, value ; layerData) { Tag t0 = value.getTag("Embed:MapData"); if (t0 !is null) { TileLayer tl = cast(TileLayer)layeroutput[key]; //writeln(t0.getValue!(ubyte[])()); tl.loadMapping(value.values[4].get!int(), value.values[5].get!int(), reinterpretCast!MappingElement(t0.expectValue!(ubyte[])())); continue; } t0 = value.getTag("File:MapData"); if (t0 !is null) { TileLayer tl = cast(TileLayer)layeroutput[key]; MapDataHeader mdf; File mapfile = File(t0.expectValue!string()); tl.loadMapping(value.values[4].get!int(), value.values[5].get!int(), loadMapFile(mapfile, mdf)); } } } /** * Saves the document to disc. * Params: * path = the path where the document is should be saved to. */ public void save(string path) @trusted { debug writeln(root.tags); foreach(int i, Tag t; layerData){ if(t.name == "Tile") pullMapDataFromLayer (i); } string output = root.toSDLDocument(); File f = File(path, "wb+"); f.write(output); } /** * Returns the given metadata. * Params: * name = the name of the parameter. * Template params: * T = The type of the parameter. */ public T getMetadata(T)(string name) if (T.stringof == int.stringof || T.stringof == string.stringof) { return metadata.getTagValue!T(name); } /** * Returns the requested layer. */ public Layer opIndex(int index) @safe pure { return layeroutput[index]; } /** * Returns all layer's basic information. */ public LayerInfo[] getLayerInfo() @trusted { import std.algorithm.sorting : sort; LayerInfo[] result; foreach (Tag t ; layerData) { result ~= LayerInfo(LayerInfo.parseLayerTypeString(t.name), t.values[1].get!int(), t.values[0].get!string()); } result.sort; return result; } /** * Returns a specified layer's basic information. */ public LayerInfo getLayerInfo(int pri) @trusted { Tag t = layerData[pri]; if (t !is null) return LayerInfo(LayerInfo.parseLayerTypeString(t.name), t.values[1].get!int(), t.values[0].get!string()); else return LayerInfo.init; } /** * Alters a tile layer data. * Params: * layerNum = The numer of the layer * dataNum = The index of the data * value = The new value. * Template params: * T = The type of the parameter. */ public void alterTileLayerInfo(T)(int layerNum, int dataNum, T value) @trusted { layerData[layerNum].values[dataNum] = Value(value); } /** * Returns a selected tile layer's all tile's basic information. * Mainly used to display information in editors. * Params: * pri = Layer priority ID * Returns: an array with the tile information. */ public TileInfo[] getTileInfo(int pri) @trusted { import std.algorithm.sorting : sort; TileInfo[] result; try { foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { //writeln(t0.toSDLString); if (t0.name == "TileSource") { Tag t1 = t0.getTag("Embed:TileInfo"); ushort palShift = cast(ushort)t0.getAttribute!int("palShift", 0); if (t1 !is null) { foreach (Tag t2 ; t1.tags) { result ~= TileInfo(cast(wchar)t2.values[0].get!int(), palShift, t2.values[1].get!int(), t2.values[2].get!string()); } } } } } catch (DOMRangeException e) { ///Just means there's no File namespace within the tag. Should be OK. debug writeln(e); } catch (Exception e) { debug writeln(e); } //writeln(result.length); result ~= tileDataFromExt.get(pri, []); result.sort; return result; } /** * Adds TileInfo to a TileLayer from an array. * Joins together multiple chunks with the same source identifier. (should be a path) * Params: * pri = Layer priority ID. * list = An array of TileInfo, which need to be added to the document. * source = The file origin of the tiles (file or DataPak path). * dpkSource = Path to the DataPak file if it's used, null otherwise. */ public void addTileInfo(int pri, TileInfo[] list, string source, string dpkSource = null) @trusted { if(list.length == 0) throw new Exception("Empty list!"); Tag t; try{ foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { if (t0.name == "TileSource" && t0.values[0] == source && t0.getAttribute!string("dataPakSrc", null) == dpkSource) { t = t0.getTag("Embed:TileInfo", null); if (t is null) { t = new Tag(t0, "Embed", "TileInfo"); } break; } } foreach (item ; list) { new Tag(t, null, null, [Value(cast(int)item.id), Value(item.num), Value(item.name)]); } } catch (Exception e) { debug writeln (e); } //writeln(t.tags.length); assert(t.tags.length == list.length); } /** * Adds TileInfo to a TileLayer from a preexiting tag. * Joins together multiple chunks with the same source identifier. (should be a path) * Params: * pri = Layer priority ID. * t = The SDL tag to be added to the Layer. * source = The file origin of the tiles (file or DataPak path). * dpkSource = Path to the DataPak file if it's used, null otherwise. */ public void addTileInfo(int pri, Tag t, string source, string dpkSource = null) @trusted { foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { if (t0.name == "TileSource" && t0.values[0] == source && t0.getAttribute!string("dataPakSrc", null) == dpkSource) { t0.add(t); return; } } } /** * Adds a single TileInfo to a preexisting chunk on the layer. */ public void addTile(int pri, TileInfo item, string source, string dpkSource = null) { foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { if (t0.name == "TileSource" && t0.values[0] == source && t0.getAttribute!string("dataPakSrc", null) == dpkSource) { Tag t1 = t0.getTag("Embed:TileInfo"); if (t1 !is null) { new Tag (t1, null, null, [Value(cast(int)item.id), Value(item.num), Value(item.name)]); } } } } ///Ditto, but from preexiting Tag. public void addTile(int pri, Tag t, string source, string dpkSource = null) @trusted { foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { if (t0.name == "TileSource" && t0.values[0] == source && t0.getAttribute!string("dataPakSrc", null) == dpkSource) { Tag t1 = t0.getTag("Embed:TileInfo"); t1.add(t); } } } /** * Renames a single tile. * Params: * pri = Layer priority ID. * id = Tile character ID. * newName = The new name of the tile. * Returns: the previous name if the action was successful, or null if there was some issue. */ public string renameTile(int pri, int id, string newName) { foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { if (t0.name == "TileSource") { Tag t1 = t0.getTag("Embed:TileInfo"); if (t1 !is null) { foreach (Tag t2; t1.tags) { if (t2.values[0].get!int() == id) { string oldName = t2.values[2].get!string(); t2.values[2] = Value(newName); return oldName; } } } } } return null; } /** * Removes a single tile from a TileInfo chunk. * Params: * pri = Layer priority ID. * id = Tile character ID. * source = The file origin of the tiles (file or DataPak path). * dpkSource = Path to the DataPak file if it's used, null otherwise. * Returns: a tag as a backup if tile is found and removed, or null if it's not found. */ public Tag removeTile(int pri, int id, string source, string dpkSource = null) @trusted { foreach (Tag t0 ; layerData[pri].namespaces["File"].tags) { if (t0.name == "TileSource") { Tag t1 = t0.getTag("Embed:TileInfo"); if (t1 !is null) { source = t0.values[0].get!string(); dpkSource = t0.getAttribute!string("dpkSource", null); foreach (Tag t2; t1.tags) { if (t2.values[0].get!int() == id) { return t2.remove(); } } } } } return null; } /** * Removes a given layer of any kind. * Params: * pri = Layer priority ID. * Returns: the Tag of the layer as a backup. */ public Tag removeLayer(int pri) @trusted { Tag backup = layerData[pri]; layeroutput.remove(pri); layerData.remove(pri); return backup.remove; } /** * Adds a layer from preexsting tag. * Params: * pri = Layer priority ID. * t = The tag containing layer information. * l = The layer. */ public void addNewLayer(int pri, Tag t, Layer l) @trusted { layeroutput[pri] = l; layerData[pri] = t; root.add(t); } /** * Adds a newly created TileLayer to the document. * Params: * pri = Layer priority ID. * tX = Tile width. * tY = Tile height. * mX = Map width. * mY = Map height. * name = Name of the layer. * l = The layer itself. */ public void addNewTileLayer(int pri, int tX, int tY, int mX, int mY, string name, TileLayer l) @trusted { layeroutput[pri] = l; l.setRasterizer(getHorizontalResolution, getVerticalResolution); layerData[pri] = new Tag(root, "Layer", "Tile", [Value(name), Value(pri), Value(tX), Value(tY), Value(mX), Value(mY)]); new Tag(layerData[pri], null, "RenderingMode", [Value("Copy")]); } /** * Adds a new tag to a layer. * Params: * pri = Layer priority ID. * name = Name of the tag. * args = The values of the tag. */ public void addTagToLayer(T...)(int pri, string name, T args) @trusted { Value[] vals; foreach (arg; args) { vals ~= Value(arg); } new Tag(layerData[pri], null, name, vals); } /** * Adds a new property tag to a layer's tag. * Note: Property tag must be first created by `addTagToLayer`. * Params: * pri = Layer priority ID. * name = Name of the tag. * parent = Name of the tag this one will be contained by. * args = The values to be added to the tag. */ public void addPropertyTagToLayer(T...)(int pri, string name, string parent, T args) @trusted { Value[] vals; foreach (arg; args) { vals ~= Value(arg); } new Tag(layerData[pri].expectTag(parent), null, name, vals); } /** * Gets the values of a layer's root tag. * Params: * pri = Layer priority ID. * Returns: an array containing all the values belonging to the root tag. */ public Value[] getLayerRootTagValues(int pri) @trusted { return layerData[pri].values; } /** * Gets the values of a layer's tag. * Params: * pri = Layer priority ID. * name = The name of the tag. * Returns: an array containing all the values belonging to the given tag. */ public Value[] getLayerTagValues(int pri, string name) @trusted { return layerData[pri].expectTag(name).values; } /** * Gets the values of a layer's property tag. * Params: * pri = Layer priority ID. * name = The name of the property tag. * parent = The name of the tag the property tag is contained within. * Returns: an array containing all the values belonging to the given property tag. */ public Value[] getLayerPropertyTagValues(int pri, string name, string parent) @trusted { return layerData[pri].expectTag(parent).expectTag(name).values; } /** * Edits the values of a layer's tag. * Params: * pri = Layer priority ID. * name = Name of the tag. * args = The values to be added to the tag. * Returns: the original values in an array. */ public Value[] editLayerTagValues(T...)(int pri, string name, T args) @trusted { Value[] backup = layerData[pri].expectTag(name).values; Value[] vals; foreach (arg; args) { vals ~= Value(arg); } //new Tag(layerData[pri], null, name, vals); layerData[pri].expectTag(name).values = vals; return backup; } /** * Edits the values of a layer's property tag. * Params: * pri = Layer priority ID. * name = Name of the tag. * parent = Name of the tag this one will be contained by. * args = The values to be added to the tag. * Returns: the original values in an array. */ public Value[] editLayerPropertyTagValues(T...)(int pri, string name, string parent, T args) @trusted { Value[] backup = layerData[pri].expectTag(parent).expectTag(name).values; Value[] vals; foreach (arg; args) { vals ~= Value(arg); } layerData[pri].expectTag(parent).expectTag(name).values = vals; return backup; } /** * Removes a layer's tag. * Params: * pri = Layer priority ID. * name = Name of the tag. * Returns: a backup for undoing. */ public Tag removeLayerTagValues(int pri, string name) @trusted { return layerData[pri].expectTag(name).remove; } /** * Adds an embedded MapData to a TileLayer. * Params: * pri = Layer priority ID. * base64Code = The data to be embedded, */ public void addEmbeddedMapData(int pri, ubyte[] base64Code) @trusted { layerData[pri].add(new Tag("Embed", "MapData", [Value(base64Code)])); } /** * Adds an embedded MapData to a TileLayer. * Params: * pri = Layer priority ID. * me = The data to be embedded, */ public void addEmbeddedMapData(int pri, MappingElement[] me) @safe { import pixelperfectengine.system.etc : reinterpretCast; addEmbeddedMapData(pri, reinterpretCast!ubyte(me)); } /** * Adds a TileData file to a TileLayer. * Filename should contain relative path. * Params: * pri = Layer priority ID. * filename = Path to the map data file. (Either on the disk or within the DataPak file) * dataPakSrc = Path to the DataPak source file if used, null otherwise. */ public void addMapDataFile(int pri, string filename, string dataPakSrc = null) @trusted { Attribute[] a; if (dataPakSrc !is null) a ~= new Attribute("dataPakSrc", Value(dataPakSrc)); layerData[pri].add(new Tag("File", "MapData", [Value(filename)], a)); } /** * Removes embedded TileData from a TileLayer. * Params: * pri = Layer priority ID. * Returns: a backup for undoing. */ public Tag removeEmbeddedMapData(int pri) @trusted { return layerData[pri].expectTag("Embed:MapData").remove; } /** * Removes a TileData file from a TileLayer. * Params: * pri = Layer priority ID. * Returns: a backup for undoing. */ public Tag removeMapDataFile(int pri) @trusted { return layerData[pri].expectTag("File:MapData").remove; } /** * Pulls TileLayer data from the layer, and stores it in the preconfigured location. * Params: * pri = Layer priority ID. * Only works with uncompressed data due to the need of recompression. */ public void pullMapDataFromLayer(int pri) @trusted { import pixelperfectengine.system.etc : reinterpretCast; ITileLayer t = cast(ITileLayer)layeroutput[pri]; MappingElement[] mapping = t.getMapping; if (layerData[pri].getTag("Embed:MapData") !is null) { layerData[pri].getTag("Embed:MapData").values[0] = Value(reinterpretCast!ubyte(mapping)); } else if (layerData[pri].getTag("File:MapData") !is null) { string filename = layerData[pri].getTag("File:MapData").getValue!string(); MapDataHeader mdh = MapDataHeader(layerData[pri].values[4].get!int, layerData[pri].values[5].get!int); saveMapFile(mdh, mapping, File(filename, "wb")); } } /** * Adds a tile source file (file that contains the tiles) to a TileLayer. * Params: * pri = Layer priority ID. * filename = Path to the file. * dataPakSrc = Path to the DataPak file if used, null otherwise. * palShift = Amount of palette shiting, 0 for default. */ public void addTileSourceFile(int pri, string filename, string dataPakSrc = null, int palShift = 0) @trusted { Attribute[] a; if (dataPakSrc !is null) a ~= new Attribute("dataPakSrc", Value(dataPakSrc)); if (palShift) a ~= new Attribute("palShift", Value(palShift)); new Tag(layerData[pri],"File", "TileSource", [Value(filename)], a); } /** * Removes a tile source. * Params: * pri = Layer priority ID. * filename = Path to the file. * dataPakSrc = Path to the DataPak file if used, null otherwise. * Returns: a backup copy of the tag. */ public Tag removeTileSourceFile(int pri, string filename, string dataPakSrc = null) @trusted { try { auto namespace = layerData[pri].namespaces["File"]; foreach (t ; namespace.tags) { if (t.name == "TileSource" && t.values[0] == filename && t.getAttribute!string("dataPakSrc", null) == dataPakSrc) { return t.remove; } } } catch (DOMRangeException e) { debug writeln(e); } catch (Exception e) { debug writeln(e); } return null; } /** * Accesses tile source tags in documents for adding extra data (eg. tile names). * Params: * pri = Layer priority ID. * filename = Path to the file. * dataPakSrc = Path to the DataPak file if used, null otherwise. */ public Tag getTileSourceTag(int pri, string filename, string dataPakSrc = null) @trusted { try { auto namespace = layerData[pri].namespaces["File"]; foreach (t ; namespace.tags) { if (t.name == "TileSource" && t.values[0] == filename && t.getAttribute!string("dataPakSrc", null) == dataPakSrc) { return t; } } } catch (DOMRangeException e) { debug writeln(e); } catch (Exception e) { debug writeln(e); } return null; } /** * Returns all tile sources for a given layer. * Intended to use with a loader. * Params: * pri = Layer priority ID. */ public Tag[] getAllTileSources (int pri) @trusted { Tag[] result; try { void loadFromLayer(int _pri) { //auto namespace = layerData[pri].namespaces["File"]; foreach (Tag t ; layerData[_pri].namespaces["File"].tags) { if (t.name == "TileSource") { result ~= t; } } } loadFromLayer(pri); foreach (Tag t ; layerData[pri].namespaces["Shared"].tags) { if (t.name == "TileData") { loadFromLayer(t.expectValue!int()); } } } catch (DOMRangeException e) { debug writeln(e); } catch (Exception e) { debug writeln(e); } return result; } /** * Adds a palette file source to the document. * Params: * filename = Path to the file containing the palette. * dataPakSrc = Path to the DataPak file if used, null otherwise. * offset = Palette offset, or where the palette should be loaded. * palShift = Palette shifting, or how many bits the target bitmap will use. */ public Tag addPaletteFile (string filename, string dataPakSrc, int offset, int palShift) @trusted { Attribute[] a; if (offset) a ~= new Attribute("offset", Value(offset)); if (palShift) a ~= new Attribute("palShift", Value(palShift)); if (dataPakSrc.length) a ~= new Attribute("dataPakSrc", Value(dataPakSrc)); return new Tag(root,"File", "Palette", [Value(filename)], a); } /** * Adds an embedded palette to the document. * Params: * c = The palette to be embedded. * name = Name of the palette. * offset = Palette offset, or where the palette should be loaded. */ public Tag addEmbeddedPalette (Color[] c, string name, int offset) @trusted { import pixelperfectengine.system.etc : reinterpretCast; Attribute[] a; if (offset) a ~= new Attribute("offset", Value(offset)); return new Tag(root, "Embed", "Palette", [Value(name), Value(reinterpretCast!ubyte(c))], a); } /** * Returns whether the given palette file source exists. * Params: * filename = Path to the file containing the palette. * dataPakSrc = Path to the DataPak file if used, null otherwise. * Returns: True if the palette file source exists. */ public bool isPaletteFileExists (string filename, string dataPakSrc = null) @trusted { foreach (t0 ; root.all.tags) { if (t0.getFullName.toString == "File:Palette") { if (t0.getValue!string() == filename && t0.getAttribute!string("dataPakSrc", null) == dataPakSrc) return true; } } return false; } /** * Returns the name of the map from metadata. */ public string getName () @trusted { return metadata.getTagValue!string("Name"); } /** * Adds an object to a layer. * Intended for editor use. * Params: * layer = The ID of the layer. * t = The serialized tag of the object. * Returns: The backup of the previous object's copy, or null if no object have existed with the same ID. */ public Tag addObjectToLayer(int layer, Tag t) @trusted { Tag result; try { foreach (Tag t0; layerData[layer].namespaces["Object"].tags) { if (t0.values[1].get!int == t.values[1].get!int) { layerData[layer].add(t); result = t0.remove(); break; } } } catch (Exception e) { debug writeln(e); } layerData[layer].add(t); return result; } /** * Removes an object from a layer. * Intended for editor use. * Params: * layer = ID of the layer from which we want to remove the object from. * objID = ID of the object we want to remove. * Returns: the tag of the object that has been removed if the operation is successful. */ public Tag removeObjectFromLayer(int layer, int objID) @trusted { try { foreach (Tag t0; layerData[layer].namespaces["Object"].tags) { if (t0.values[1].get!int == objID) { return t0.remove(); } } } catch (Exception e) { debug writeln(e); } return null; } /** * Returns the horizontal resolution. */ public int getHorizontalResolution () @trusted { return metadata.getTag("Resolution").values[0].get!int(); } /** * Returns the vertical resolution. */ public int getVerticalResolution () @trusted { return metadata.getTag("Resolution").values[1].get!int(); } } /** * Represents a single object within a layer, that can represent many different things. * All objects have a priority identifier (int), a group identifier (int), and a name. */ abstract class MapObject { /** * Enumerator used for differentiating between multiple kinds of objects. * The value serialized as a string as the name of a tag. */ public enum MapObjectType : ubyte { box, ///Can be used for collision detection, event marking for scripts, and masking. Has two coordinates. /** * Only applicable for SpriteLayer. * Has one coordinate, a horizontal and vertical scaling indicator (int), and a source indicator (int). */ sprite, polyline, } ///Defines various flags for objects public enum MapObjectFlags : ushort { toCollision = 1<<0, ///Marks the object to be included to collision detection. } public int pID; ///priority identifier public int gID; ///group identifier (equals with layer number) public string name; ///name of object protected MapObjectType _type; ///type of the object public BitFlags!MapObjectFlags flags;///Contains property flags public Tag mainTag; ///Tag that holds the data related to this mapobject + ancillary tags ///Returns the type of this object public @property MapObjectType type () const @nogc nothrow @safe pure { return _type; } ///Serializes the object into an SDL tag public abstract Tag serialize () @trusted; /** * Checks if two objects have the same identifier. */ public bool opEquals (MapObject rhs) @nogc @safe nothrow pure const { return pID == rhs.pID && gID == rhs.gID; } } /** * Implements a Box object. Adds a single Coordinate property to the default MapObject */ public class BoxObject : MapObject { public Box position; ///position of object on the layer /** * Creates a new instance from scratch. */ public this (int pID, int gID, string name, Box position) { this.pID = pID; this.gID = gID; this.name = name; this.position = position; _type = MapObjectType.box; mainTag = new Tag("Object", "Box", [Value(name), Value(pID), Value(position.left), Value(position.top), Value(position.right), Value(position.bottom)]); } /** * Deserializes itself from a Tag. */ public this (Tag t, int gID) @trusted { name = t.values[0].get!string(); pID = t.values[1].get!int(); position = Box(t.values[2].get!int(), t.values[3].get!int(), t.values[4].get!int(), t.values[5].get!int()); this.gID = gID; _type = MapObjectType.box; //ancillaryTags = t.tags; mainTag = t; if (t.getTag("ToCollision")) flags.toCollision = true; } /** * Serializes the object into an SDL tag */ public override Tag serialize () @trusted { return mainTag; } ///Gets the identifying color of this object. public Color color() @trusted { Tag t0 = mainTag.getTag("Color"); if (t0) { return parseColor(t0); } else { return Color.init; } } ///Sets the identifying color of this object. public Color color(Color c) @trusted { Tag t0 = mainTag.getTag("Color"); if (t0) { t0.remove; } mainTag.add(storeColor(c)); return c; } } /** * Implements a sprite object. Adds a sprite source identifier, X and Y coordinates, and two 1024 based scaling indicator. */ public class SpriteObject : MapObject { public int ssID; ///Sprite source identifier public int x; ///X position public int y; ///Y position public int scaleHoriz; ///Horizontal scaling value public int scaleVert; ///Vertical scaling value public RenderingMode rendMode;///The rendering mode of the sprite public ushort palSel; ///Palette selector. Selects the given palette for the object. public ubyte palShift; ///Palette shift value. Determines palette length (2^x). public ubyte masterAlpha;///The main alpha channel of the sprite. /** * Creates a new instance from scratch. */ public this (int pID, int gID, string name, int ssID, int x, int y, int scaleHoriz = 1024, int scaleVert = 1024, RenderingMode rendMode = RenderingMode.init, ushort palSel = 0, ubyte palShift = 0, ubyte masterAlpha = 0xFF) { this.pID = pID; this.gID = gID; this.name = name; this.ssID = ssID; this.x = x; this.y = y; this.scaleHoriz = scaleHoriz; this.scaleVert = scaleVert; _type = MapObjectType.sprite; Attribute[] attr; if (scaleHoriz != 1024) attr ~= new Attribute("scaleHoriz", Value(scaleHoriz)); if (scaleVert != 1024) attr ~= new Attribute("scaleVert", Value(scaleVert)); if (palSel) attr ~= new Attribute("palSel", Value(cast(int)palSel)); if (palShift) attr ~= new Attribute("palShift", Value(cast(int)palShift)); if (masterAlpha) attr ~= new Attribute("masterAlpha", Value(cast(int)masterAlpha)); mainTag = new Tag("Object", "Sprite", [Value(name), Value(pID), Value(ssID), Value(x), Value(y)]); if (rendMode != RenderingMode.init) new Tag(mainTag, null,"RenderingMode", [Value(to!string(rendMode))]); } /** * Deserializes itself from a Tag. */ public this (Tag t, int gID) @trusted { this.gID = gID; name = t.values[0].get!string(); pID = t.values[1].get!int(); ssID = t.values[2].get!int(); x = t.values[3].get!int(); y = t.values[4].get!int(); scaleHoriz = t.getAttribute!int("scaleHoriz", 1024); scaleVert = t.getAttribute!int("scaleVert", 1024); rendMode = MapFormat.renderingModeLookup[t.getTagValue!string("RenderingMode", "null")]; palSel = cast(ushort)t.getAttribute!int("palSel", 0); palShift = cast(ubyte)t.getAttribute!int("palShift", 0); masterAlpha = cast(ubyte)t.getAttribute!int("masterAlpha", 255); mainTag = t; _type = MapObjectType.sprite; if (t.getTag("ToCollision")) flags.toCollision = true; } /** * Serializes the object into an SDL tag */ public override Tag serialize () @trusted { return mainTag; } } /** * Describes a polyline object for things like Vectoral Tile Layer. */ public class PolylineObject : MapObject { ///The points of the object's path. public Point[] path; public this (int pID, int gID, string name, Point[] path) { this.gID = gID; this.pID = pID; this.name = name; this.path = path; mainTag = new Tag(null, "Object", "Polyline", [Value(name), Value(pID)]); new Tag(mainTag, null, "Begin", [Value(path[0].x), Value(path[0].y)]); foreach (Point key; path[1..$-1]) { new Tag(mainTag, null, "Segment", [Value(key.x), Value(key.y)]); } if (path[0] == path[$-1]) { new Tag(mainTag, null, "Close"); } else { new Tag(mainTag, null, "Segment", [Value(path[$-1].x), Value(path[$-1].y)]); } } public this (Tag t, int gID) @trusted { this.gID = gID; name = t.values[0].get!string(); pID = t.values[1].get!int(); foreach (Tag t0 ; t.tags) { switch (t0.name) { case "Begin": enforce!MapFormatException(path.length == 0, "'Begin' node found in the middle of the path."); goto case "Segment"; case "Segment": enforce!MapFormatException(path.length != 0, "No 'Begin' node found"); path ~= Point(t0.values[0].get!int, t0.values[1].get!int); break; case "Close": path ~= path[0]; break; default: break; } } mainTag = t; _type = MapObjectType.polyline; } /** * Sets the color to 'c' for the polyline object's given segment indicated by 'num'. */ public Color color(Color c, int num) @trusted { int i; foreach (Tag t0 ; mainTag.tags) { switch (t0.name) { case "Begin", "Segment", "Close": if (num == i) { t0.add(storeColor(c)); return c; } i++; break; default: break; } } throw new PPEException("Out of index error!"); } /** * Returns the color for the polyline object's given segment indicated by 'num'. */ public Color color(int num) @trusted { int i; foreach (Tag t0 ; mainTag.tags) { switch (t0.name) { case "Begin", "Segment", "Close": if (num == i) { Tag t1 = t0.getTag("Color"); if (t1) { return parseColor(t1); } else { return Color.init; } } i++; break; default: break; } } throw new PPEException("Out of index error!"); } override public Tag serialize() @trusted { return Tag.init; // TODO: implement } } ///Parses a color from SDLang Tag 't', then returns it as the engine's default format. public Color parseColor(Tag t) @trusted { Color c; switch (t.values.length) { case 1: if (t.values[0].peek!long) c.base = cast(uint)t.getValue!long(); else c.base = parseHex!uint(t.getValue!string); break; case 4: c.a = cast(ubyte)t.values[0].get!int(); c.r = cast(ubyte)t.values[1].get!int(); c.g = cast(ubyte)t.values[2].get!int(); c.b = cast(ubyte)t.values[3].get!int(); break; default: throw new MapFormatException("Unrecognized color format tag!"); } return c; } ///Serializes the engine's color format into an SDLang Tag. public Tag storeColor(Color c) @trusted { return new Tag(null, "Color", [Value(format("%08x", c.base))]); } /** * Parses an ofject from an SDLang tag. * Params: * t = The source tag. * gID = Group (layer) ID. * Returns: The parsed object. */ public MapObject parseObject(Tag t, int gID) @trusted { if (t.namespace != "Object") return null; switch (t.name) { case "Box": return new BoxObject(t, gID); case "Sprite": return new SpriteObject(t, gID); case "Polyline": return new PolylineObject(t, gID); default: return null; } } /** * Simple LayerInfo struct, mostly for internal communications. */ public struct LayerInfo { LayerType type; ///Type of layer int pri; ///Priority of layer string name; ///Name of layer int opCmp (LayerInfo rhs) const pure @safe @nogc { if (pri > rhs.pri) return 1; else if (pri < rhs.pri) return -1; else return 0; } /** * Parses a string as a layer type */ static LayerType parseLayerTypeString (string s) pure @safe { import std.uni : toLower; s = toLower(s); switch (s) { case "tile": return LayerType.Tile; case "sprite": return LayerType.Sprite; case "transformabletile": return LayerType.TransformableTile; default: return LayerType.init; } } } /** * Simple TileInfo struct, mostly for internal communication and loading. */ public struct TileInfo { wchar id; ///ID of the tile in wchar format ushort palShift; ///palShift offset of the tile int num; ///Number of tile in the file string name; ///Name of the tile int opCmp (TileInfo rhs) const pure @safe @nogc { if (id > rhs.id) return 1; else if (id < rhs.id) return -1; else return 0; } public string toString() const pure { import std.conv : to; return to!string(id) ~ ";" ~ to!string(num) ~ ";" ~ name; } } public class MapFormatException : PPEException { /// @nogc @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) { super(msg, file, line, nextInChain); } /// @nogc @safe pure nothrow this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) { super(msg, file, line, nextInChain); } }
D
/++ The Note plugin allows for storing notes to offline users, to be replayed when they next join the channel. If a note is left in a channel, it is stored as a note under that channel and will be played back when the user joins (or optionally shows activity) there. If a note is left in a private message, it is stored as outside of a channel and will be played back in a private query, depending on the same triggers as those of channel notes. Activity in one channel will not play back notes left for another channel, but anything will trigger private message playback. See_Also: https://github.com/zorael/kameloso/wiki/Current-plugins#note, [kameloso.plugins.common.core], [kameloso.plugins.common.misc] Copyright: [JR](https://github.com/zorael) License: [Boost Software License 1.0](https://www.boost.org/users/license.html) Authors: [JR](https://github.com/zorael) +/ module kameloso.plugins.note; version(WithNotePlugin): private: import kameloso.plugins; import kameloso.plugins.common.core; import kameloso.plugins.common.awareness : MinimalAuthentication; import kameloso.common : logger; import kameloso.messaging; import dialect.defs; import std.typecons : Flag, No, Yes; version(WithChanQueryService) {} else { pragma(msg, "Warning: The `Note` plugin will work but not well without the `ChanQuery` service."); } mixin MinimalAuthentication; mixin PluginRegistration!NotePlugin; // NoteSettings /++ Note plugin settings. +/ @Settings struct NoteSettings { /++ Toggles whether or not the plugin should react to events at all. +/ @Enabler bool enabled = true; /++ Toggles whether or not notes get played back on activity, and not just on [dialect.defs.IRCEvent.Type.JOIN|JOIN]s and [dialect.defs.IRCEvent.Type.ACCOUNT|ACCOUNT]s. Ignored on Twitch servers. +/ bool playBackOnAnyActivity = true; } // Note /++ Embodies the notion of a note, left for an offline user. +/ struct Note { private: import std.json : JSONValue; public: /++ Line of text left as a note, optionally Base64-encoded. +/ string line; /++ String name of the sender, optionally Base64-encoded. May be a display name. +/ string sender; /++ UNIX timestamp of when the note was left. +/ long timestamp; /++ Encrypts the note, Base64-encoding [line] and [sender]. +/ void encrypt() { import lu.string : encode64; line = encode64(line); sender = encode64(sender); } /++ Decrypts the note, Base64-decoding [line] and [sender]. +/ void decrypt() { import lu.string : decode64; line = decode64(line); sender = decode64(sender); } /++ Converts this [Note] into a JSON representation. Returns: A [std.json.JSONValue|JSONValue] that describes this [Note]. +/ auto toJSON() const { JSONValue json; json["line"] = JSONValue(this.line); json["sender"] = JSONValue(this.sender); json["timestamp"] = JSONValue(this.timestamp); return json; } /++ Creates a [Note] from a JSON representation. Params: json = [std.json.JSONValue|JSONValue] to build a [Note] from. +/ static auto fromJSON(const JSONValue json) { Note note; note.line = json["line"].str; note.sender = json["sender"].str; note.timestamp = json["timestamp"].integer; return note; } } // onJoinOrAccount /++ Plays back notes upon someone joining or upon someone authenticating with services. +/ @(IRCEventHandler() .onEvent(IRCEvent.Type.JOIN) .onEvent(IRCEvent.Type.ACCOUNT) .permissionsRequired(Permissions.anyone) .channelPolicy(ChannelPolicy.home) ) void onJoinOrAccount(NotePlugin plugin, const ref IRCEvent event) { version(TwitchSupport) { if (plugin.state.server.daemon == IRCServer.Daemon.twitch) { // We can't really rely on JOINs on Twitch and ACCOUNTs don't happen return; } } playbackNotes(plugin, event); } // onChannelMessage /++ Plays back notes upon someone saying something in the channel, provided [NoteSettings.playBackOnAnyActivity] is set. +/ @(IRCEventHandler() .onEvent(IRCEvent.Type.CHAN) .onEvent(IRCEvent.Type.EMOTE) .onEvent(IRCEvent.Type.QUERY) .permissionsRequired(Permissions.anyone) .channelPolicy(ChannelPolicy.home) .chainable(true) ) void onChannelMessage(NotePlugin plugin, const ref IRCEvent event) { if (plugin.noteSettings.playBackOnAnyActivity || (plugin.state.server.daemon == IRCServer.Daemon.twitch)) { playbackNotes(plugin, event); } } // onTwitchChannelEvent /++ Plays back notes upon someone performing a Twitch-specific action. +/ version(TwitchSupport) @(IRCEventHandler() .onEvent(IRCEvent.Type.TWITCH_SUB) .onEvent(IRCEvent.Type.TWITCH_SUBGIFT) .onEvent(IRCEvent.Type.TWITCH_CHEER) .onEvent(IRCEvent.Type.TWITCH_REWARDGIFT) .onEvent(IRCEvent.Type.TWITCH_GIFTCHAIN) .onEvent(IRCEvent.Type.TWITCH_BULKGIFT) .onEvent(IRCEvent.Type.TWITCH_SUBUPGRADE) .onEvent(IRCEvent.Type.TWITCH_CHARITY) .onEvent(IRCEvent.Type.TWITCH_BITSBADGETIER) .onEvent(IRCEvent.Type.TWITCH_RITUAL) .onEvent(IRCEvent.Type.TWITCH_EXTENDSUB) .onEvent(IRCEvent.Type.TWITCH_GIFTRECEIVED) .onEvent(IRCEvent.Type.TWITCH_PAYFORWARD) .onEvent(IRCEvent.Type.TWITCH_RAID) .onEvent(IRCEvent.Type.TWITCH_CROWDCHANT) .onEvent(IRCEvent.Type.TWITCH_ANNOUNCEMENT) .onEvent(IRCEvent.Type.TWITCH_DIRECTCHEER) .permissionsRequired(Permissions.ignore) .channelPolicy(ChannelPolicy.home) .chainable(true) ) void onTwitchChannelEvent(NotePlugin plugin, const ref IRCEvent event) { // No need to check whether we're on Twitch playbackNotes(plugin, event); } // onWhoReply /++ Plays back notes upon replies of a WHO query. These carry a sender, so it's possible we know the account without lookups. Do nothing if [kameloso.pods.CoreSettings.eagerLookups|CoreSettings.eagerLookups] is true, as we'd collide with ChanQuery queries. Passes `Yes.background` to [playbackNotes] to ensure it does low-priority background WHOIS queries. +/ @(IRCEventHandler() .onEvent(IRCEvent.Type.RPL_WHOREPLY) .channelPolicy(ChannelPolicy.home) ) void onWhoReply(NotePlugin plugin, const ref IRCEvent event) { if (plugin.state.settings.eagerLookups) return; playbackNotes(plugin, event, Yes.background); } // playbackNotes /++ Plays back notes. The target is assumed to be the sender of the [dialect.defs.IRCEvent|IRCEvent] passed. If the [dialect.defs.IRCEvent|IRCEvent] contains a channel, then playback of both channel and private message notes will be performed. If the channel member is empty, only private message ones. Params: plugin = The current [NotePlugin]. event = The triggering [dialect.defs.IRCEvent|IRCEvent]. background = Whether or not to issue WHOIS queries as low-priority background messages. +/ void playbackNotes( NotePlugin plugin, const /*ref*/ IRCEvent event, const Flag!"background" background = No.background) { const user = event.sender.nickname.length ? event.sender : event.target; // on RPL_WHOREPLY if (!user.nickname.length) { // Despite everything we don't have a user. Bad annotations on calling event handler? return; } if (event.channel.length) { // Try channel notes first, then drop down to private notes playbackNotesImpl(plugin, event.channel, user, background); } // Private notes playbackNotesImpl(plugin, string.init, user, background); } // playbackNotesImpl /++ Plays back notes. Implementation function. Params: plugin = The current [NotePlugin]. channelName = The name of the channel in which the playback is to take place, or an empty string if it's supposed to take place in a private message. user = [dialect.defs.IRCUser|IRCUser] to replay notes for. background = Whether or not to issue WHOIS queries as low-priority background messages. +/ void playbackNotesImpl( NotePlugin plugin, const string channelName, const IRCUser user, const Flag!"background" background) { import kameloso.plugins.common.mixins : WHOISFiberDelegate; import std.format : format; auto channelNotes = channelName in plugin.notes; if (!channelNotes) return; void onSuccess(const IRCUser user) { import std.datetime.systime : Clock; import std.range : only; immutable now = Clock.currTime; foreach (immutable id; only(user.nickname, user.account)) { import kameloso.plugins.common.misc : nameOf; import kameloso.time : timeSince; import std.datetime.systime : SysTime; auto notes = id in *channelNotes; if (!notes || !notes.length) continue; if (notes.length == 1) { auto note = (*notes)[0]; // mutable immutable timestampAsSysTime = SysTime.fromUnixTime(note.timestamp); immutable duration = (now - timestampAsSysTime).timeSince!(7, 1)(No.abbreviate); note.decrypt(); enum pattern = "<h>%s<h>! <h>%s<h> left note <b>%s<b> ago: %s"; immutable message = pattern.format(nameOf(user), note.sender, duration, note.line); privmsg(plugin.state, channelName, user.nickname, message); } else /*if (notes.length > 1)*/ { enum pattern = "<h>%s<h>! You have <b>%d<b> notes."; immutable message = pattern.format(nameOf(user), notes.length); privmsg(plugin.state, channelName, user.nickname, message); foreach (/*const*/ note; *notes) { immutable timestampAsSysTime = SysTime.fromUnixTime(note.timestamp); immutable duration = (now - timestampAsSysTime).timeSince!(7, 1)(Yes.abbreviate); note.decrypt(); enum entryPattern = "<h>%s<h> %s ago: %s"; immutable report = entryPattern.format(note.sender, duration, note.line); privmsg(plugin.state, channelName, user.nickname, report); } } (*channelNotes).remove(id); if (!channelNotes.length) plugin.notes.remove(channelName); // Don't run the loop twice if the nickname and the account is the same if (user.nickname == user.account) break; } saveNotes(plugin); } void onFailure(const IRCUser user) { // Merely failed to resolve an account, proceed with success branch return onSuccess(user); } if (user.account.length) { return onSuccess(user); } mixin WHOISFiberDelegate!(onSuccess, onFailure, Yes.alwaysLookup); enqueueAndWHOIS(user.nickname, Yes.issueWhois, background); } // onCommandAddNote /++ Adds a note to the in-memory storage, and saves it to disk. Messages sent in a channel will become messages for the target user in that channel. Those sent in a private query will be private notes, sent privately in the same fashion as channel notes are sent publicly. +/ @(IRCEventHandler() .onEvent(IRCEvent.Type.CHAN) .onEvent(IRCEvent.Type.QUERY) .permissionsRequired(Permissions.anyone) .channelPolicy(ChannelPolicy.home) .addCommand( IRCEventHandler.Command() .word("note") .policy(PrefixPolicy.prefixed) .description("Adds a note to send to an offline person when they come online, " ~ "or when they show activity if already online.") .addSyntax("$command [nickname] [note text]") ) ) void onCommandAddNote(NotePlugin plugin, const ref IRCEvent event) { import kameloso.plugins.common.misc : nameOf; import lu.string : SplitResults, beginsWith, splitInto, stripped; void sendUsage() { import std.format : format; enum pattern = "Usage: <b>%s%s<b> [nickname] [note text]"; immutable message = pattern.format(plugin.state.settings.prefix, event.aux[$-1]); privmsg(plugin.state, event.channel, event.sender.nickname, message); } void sendNoBotMessages() { enum message = "You cannot leave me a message; it would never be replayed."; privmsg(plugin.state, event.channel, event.sender.nickname, message); } string slice = event.content.stripped; // mutable string target; // ditto immutable results = slice.splitInto(target); if (target.beginsWith('@')) target = target[1..$]; if ((results != SplitResults.overrun) || !target.length) return sendUsage(); if (target == plugin.state.client.nickname) return sendNoBotMessages(); Note note; note.sender = nameOf(event.sender); note.timestamp = event.time; note.line = slice; note.encrypt(); plugin.notes[event.channel][target] ~= note; saveNotes(plugin); enum message = "Note saved."; privmsg(plugin.state, event.channel, event.sender.nickname, message); } // onWelcome /++ Initialises the Note plugin. Loads the notes from disk. +/ @(IRCEventHandler() .onEvent(IRCEvent.Type.RPL_WELCOME) ) void onWelcome(NotePlugin plugin) { loadNotes(plugin); } // saveNotes /++ Saves notes to disk, to the [NotePlugin.notesFile] JSON file. +/ void saveNotes(NotePlugin plugin) { import lu.json : JSONStorage; import std.json : JSONType; JSONStorage json; foreach (immutable channelName, channelNotes; plugin.notes) { json[channelName] = null; json[channelName].object = null; foreach (immutable nickname, notes; channelNotes) { json[channelName][nickname] = null; json[channelName][nickname].array = null; //auto nicknameNotesJSON = nickname in json[channelName]; foreach (note; notes) { //nicknameNotesJSON.array ~= note.toJSON(); // Doesn't work with older compilers json[channelName][nickname].array ~= note.toJSON(); } } } if (json.type == JSONType.null_) json.object = null; // reset to type object if null_ json.save(plugin.notesFile); } // loadNotes /++ Loads notes from disk into [NotePlugin.notes]. +/ void loadNotes(NotePlugin plugin) { import lu.json : JSONStorage; JSONStorage json; json.load(plugin.notesFile); plugin.notes.clear(); foreach (immutable channelName, channelNotesJSON; json.object) { foreach (immutable nickname, notesJSON; channelNotesJSON.object) { foreach (noteJSON; notesJSON.array) { plugin.notes[channelName][nickname] ~= Note.fromJSON(noteJSON); } } plugin.notes[channelName].rehash(); } plugin.notes.rehash(); } // reload /++ Reloads notes from disk. +/ void reload(NotePlugin plugin) { loadNotes(plugin); } // initResources /++ Ensures that there is a notes file, creating one if there isn't. +/ void initResources(NotePlugin plugin) { import lu.json : JSONStorage; import std.json : JSONException; JSONStorage json; try { json.load(plugin.notesFile); } catch (JSONException e) { import kameloso.plugins.common.misc : IRCPluginInitialisationException; version(PrintStacktraces) logger.trace(e); throw new IRCPluginInitialisationException( "Notes file is malformed", plugin.name, plugin.notesFile, __FILE__, __LINE__); } // Let other Exceptions pass. json.save(plugin.notesFile); } public: // NotePlugin /++ The Note plugin, which allows people to leave messages to each other, for offline communication and such. +/ final class NotePlugin : IRCPlugin { private: import lu.json : JSONStorage; // noteSettings /++ All Note plugin settings gathered. +/ NoteSettings noteSettings; // notes /++ The in-memory JSON storage of all stored notes. It is in the JSON form of `Note[][string][string]`, where the first string key is a channel and the second a nickname. +/ Note[][string][string] notes; // notesFile /++ Filename of file to save the notes to. +/ @Resource string notesFile = "notes.json"; mixin IRCPluginImpl; }
D
/******************************************************************************* copyright: Copyright (c) 2008 Kris Bell. Все права защищены license: BSD стиль: $(LICENSE) version: Apr 2008: Initial release authors: Kris Since: 0.99.7 Based upon Doug Lea's Java collection package *******************************************************************************/ module util.container.HashSet; private import util.container.Slink; public import util.container.Container; private import util.container.model.IContainer; /******************************************************************************* Хэш таблица implementation of a Набор --- Обходчик обходчик () цел opApply (цел delegate(ref V значение) дг) бул добавь (V элемент) бул содержит (V элемент) бул возьми (ref V элемент) бул удали (V элемент) т_мера удали (ИКонтейнер!(V) e) бул замени (V старЭлемент, V новЭлемент) т_мера размер () бул пуст_ли () V[] вМассив (V[] приёмн) HashSet dup () HashSet очисть () HashSet сбрось () т_мера корзины () проц корзины (т_мера cap) плав порог () проц порог (плав desired) --- *******************************************************************************/ class HashSet (V, alias Хэш = Контейнер.хэш, alias Извл = Контейнер.извлеки, alias Куча = Контейнер.ДефСбор) : ИКонтейнер!(V) { // use this тип for Разместитель configuration public alias Slink!(V) Тип; private alias Тип *Реф; private alias Куча!(Тип) Размест; // Each таблица Запись is a список - пусто if no таблица allocated private Реф таблица[]; // число of элементы contained private т_мера счёт; // the порог загрузи factor private плав факторЗагрузки; // configured куча manager private Размест куча; // мутация тэг updates on each change private т_мера мутация; /*********************************************************************** Construct a HashSet экземпляр ***********************************************************************/ this (плав f = Контейнер.дефФакторЗагрузки) { факторЗагрузки = f; } /*********************************************************************** Clean up when deleted ***********************************************************************/ ~this () { сбрось; } /*********************************************************************** Return a генерный обходчик for contained элементы ***********************************************************************/ final Обходчик обходчик () { Обходчик i =void; i.мутация = мутация; i.таблица = таблица; i.хозяин = this; i.ячейка = пусто; i.ряд = 0; return i; } /*********************************************************************** ***********************************************************************/ final цел opApply (цел delegate(ref V значение) дг) { return обходчик.opApply (дг); } /*********************************************************************** Return the число of элементы contained ***********************************************************************/ final т_мера размер () { return счёт; } /*********************************************************************** Добавь a new элемент в_ the установи. Does not добавь if there is an equivalent already present. Returns да where an элемент is добавьed, нет where it already есть_ли Время complexity: O(1) average; O(n) worst. ***********************************************************************/ final бул добавь (V элемент) { if (таблица is пусто) перемерь (Контейнер.дефНачКорзины); auto h = Хэш (элемент, таблица.length); auto hd = таблица[h]; if (hd && hd.найди (элемент)) return нет; таблица[h] = размести.установи (элемент, hd); инкремент; // only проверь if bin was Неукmpty if (hd) проверьЗагрузку; return да; } /*********************************************************************** Does this установи contain the given элемент? Время complexity: O(1) average; O(n) worst ***********************************************************************/ final бул содержит (V элемент) { if (счёт) { auto p = таблица[Хэш (элемент, таблица.length)]; if (p && p.найди (элемент)) return да; } return нет; } /*********************************************************************** Make an independent копируй of the container. Does not клонируй элементы Время complexity: O(n) ***********************************************************************/ final HashSet dup () { auto клонируй = new HashSet!(V, Хэш, Извл, куча) (факторЗагрузки); if (счёт) { клонируй.корзины (корзины); foreach (значение; обходчик) клонируй.добавь (значение); } return клонируй; } /*********************************************************************** Удали the предоставленный элемент. Returns да if найдено, нет otherwise Время complexity: O(1) average; O(n) worst ***********************************************************************/ final т_мера удали (V элемент, бул все) { return удали(элемент) ? 1 : 0; } /*********************************************************************** Удали the предоставленный элемент. Returns да if найдено, нет otherwise Время complexity: O(1) average; O(n) worst ***********************************************************************/ final бул удали (V элемент) { if (счёт) { auto h = Хэш (элемент, таблица.length); auto hd = таблица[h]; auto trail = hd; auto p = hd; while (p) { auto n = p.следщ; if (элемент == p.значение) { декремент (p); if (p is таблица[h]) { таблица[h] = n; trail = n; } else trail.следщ = n; return да; } else { trail = p; p = n; } } } return нет; } /*********************************************************************** Замени the первый экземпляр of старЭлемент with новЭлемент. Returns да if старЭлемент was найдено и replaced, нет otherwise. ***********************************************************************/ final т_мера замени (V старЭлемент, V новЭлемент, бул все) { return замени (старЭлемент, новЭлемент) ? 1 : 0; } /*********************************************************************** Замени the первый экземпляр of старЭлемент with новЭлемент. Returns да if старЭлемент was найдено и replaced, нет otherwise. ***********************************************************************/ final бул замени (V старЭлемент, V новЭлемент) { if (счёт && старЭлемент != новЭлемент) if (содержит (старЭлемент)) { удали (старЭлемент); добавь (новЭлемент); return да; } return нет; } /*********************************************************************** Удали и expose the первый элемент. Returns нет when no ещё элементы are contained Время complexity: O(n) ***********************************************************************/ final бул возьми (ref V элемент) { if (счёт) foreach (ref список; таблица) if (список) { auto p = список; элемент = p.значение; список = p.следщ; декремент (p); return да; } return нет; } /*********************************************************************** ************************************************************************/ public проц добавь (ИКонтейнер!(V) e) { foreach (значение; e) добавь (значение); } /*********************************************************************** ************************************************************************/ public т_мера удали (ИКонтейнер!(V) e) { т_мера c; foreach (значение; e) if (удали (значение)) ++c; return c; } /*********************************************************************** Clears the ХэшКарта contents. Various атрибуты are retained, such as the internal таблица itself. Invoke сбрось() в_ drop everything. Время complexity: O(n) ***********************************************************************/ final HashSet очисть () { return очисть (нет); } /*********************************************************************** Reset the HashSet contents и optionally конфигурируй a new куча manager. This releases ещё память than очисть() does Время complexity: O(1) ***********************************************************************/ final HashSet сбрось () { очисть (да); куча.собери (таблица); таблица = пусто; return this; } /*********************************************************************** Return the число of корзины Время complexity: O(1) ***********************************************************************/ final т_мера корзины () { return таблица ? таблица.length : 0; } /*********************************************************************** Набор the число of корзины и перемерь as требуется Время complexity: O(n) ***********************************************************************/ final HashSet корзины (т_мера cap) { if (cap < Контейнер.дефНачКорзины) cap = Контейнер.дефНачКорзины; if (cap !is корзины) перемерь (cap); return this; } /*********************************************************************** Return the перемерь порог Время complexity: O(1) ***********************************************************************/ final плав порог () { return факторЗагрузки; } /*********************************************************************** Набор the перемерь порог, и перемерь as требуется Время complexity: O(n) ***********************************************************************/ final проц порог (плав desired) { assert (desired > 0.0); факторЗагрузки = desired; if (таблица) проверьЗагрузку; } /*********************************************************************** Configure the назначено разместитель with the размер of each allocation блок (число of узелs allocated at one время) и the число of узелs в_ pre-наполни the кэш with. Время complexity: O(n) ***********************************************************************/ final HashSet кэш (т_мера чанк, т_мера счёт=0) { куча.конфиг (чанк, счёт); return this; } /*********************************************************************** Copy и return the contained установи of значения in an Массив, using the optional приёмн as a реципиент (which is resized as necessary). Returns a срез of приёмн representing the container значения. Время complexity: O(n) ***********************************************************************/ final V[] вМассив (V[] приёмн = пусто) { if (приёмн.length < счёт) приёмн.length = счёт; т_мера i = 0; foreach (v; this) приёмн[i++] = v; return приёмн [0 .. счёт]; } /*********************************************************************** Is this container пустой? Время complexity: O(1) ***********************************************************************/ final бул пуст_ли () { return счёт is 0; } /*********************************************************************** Sanity проверь ***********************************************************************/ final HashSet проверь() { assert(!(таблица is пусто && счёт !is 0)); assert((таблица is пусто || таблица.length > 0)); assert(факторЗагрузки > 0.0f); if (таблица) { т_мера c = 0; for (т_мера i = 0; i < таблица.length; ++i) { for (auto p = таблица[i]; p; p = p.следщ) { ++c; assert(содержит(p.значение)); assert(Хэш (p.значение, таблица.length) is i); } } assert(c is счёт); } return this; } /*********************************************************************** Размести a узел экземпляр. This is использован as the default разместитель ***********************************************************************/ private Реф размести () { return куча.размести; } /*********************************************************************** Check в_ see if we are past загрузи factor порог. If so, перемерь so that we are at half of the desired порог. ***********************************************************************/ private проц проверьЗагрузку () { плав fc = счёт; плав ft = таблица.length; if (fc / ft > факторЗагрузки) перемерь (2 * cast(т_мера)(fc / факторЗагрузки) + 1); } /*********************************************************************** перемерь таблица в_ new ёмкость, rehashing все элементы ***********************************************************************/ private проц перемерь (т_мера newCap) { //Стдвыв.форматнс ("перемерь {}", newCap); auto newtab = куча.размести (newCap); измени; foreach (bucket; таблица) while (bucket) { auto n = bucket.следщ; auto h = Хэш (bucket.значение, newCap); bucket.следщ = newtab[h]; newtab[h] = bucket; bucket = n; } // release the приор таблица и присвой new one куча.собери (таблица); таблица = newtab; } /*********************************************************************** Удали the indicated узел. We need в_ traverse корзины for this, since we're singly-linked only. Better в_ save the per-узел память than в_ gain a little on each удали Used by iterators only ***********************************************************************/ private бул удали (Реф узел, т_мера ряд) { auto hd = таблица[ряд]; auto trail = hd; auto p = hd; while (p) { auto n = p.следщ; if (p is узел) { декремент (p); if (p is hd) таблица[ряд] = n; else trail.следщ = n; return да; } else { trail = p; p = n; } } return нет; } /*********************************************************************** Clears the HashSet contents. Various атрибуты are retained, such as the internal таблица itself. Invoke сбрось() в_ drop everything. Время complexity: O(n) ***********************************************************************/ private HashSet очисть (бул все) { измени; // собери each узел if we can't собери все at once if (куча.собери(все) is нет) foreach (ref v; таблица) while (v) { auto n = v.следщ; декремент (v); v = n; } // retain таблица, but удали bucket chains foreach (ref v; таблица) v = пусто; счёт = 0; return this; } /*********************************************************************** new элемент was добавьed ***********************************************************************/ private проц инкремент() { ++мутация; ++счёт; } /*********************************************************************** элемент was removed ***********************************************************************/ private проц декремент (Реф p) { Извл (p.значение); куча.собери (p); ++мутация; --счёт; } /*********************************************************************** установи was изменён ***********************************************************************/ private проц измени() { ++мутация; } /*********************************************************************** Обходчик with no filtering ***********************************************************************/ private struct Обходчик { т_мера ряд; Реф ячейка, приор; Реф[] таблица; HashSet хозяин; т_мера мутация; /*************************************************************** Dопр the container change underneath us? ***************************************************************/ бул действителен () { return хозяин.мутация is мутация; } /*************************************************************** Accesses the следщ значение, и returns нет when there are no further значения в_ traverse ***************************************************************/ бул следщ (ref V v) { auto n = следщ; return (n) ? v = *n, да : нет; } /*************************************************************** Return a pointer в_ the следщ значение, or пусто when there are no further значения в_ traverse ***************************************************************/ V* следщ () { while (ячейка is пусто) if (ряд < таблица.length) ячейка = таблица [ряд++]; else return пусто; приор = ячейка; ячейка = ячейка.следщ; return &приор.значение; } /*************************************************************** Foreach support ***************************************************************/ цел opApply (цел delegate(ref V значение) дг) { цел результат; auto c = ячейка; loop: while (да) { while (c is пусто) if (ряд < таблица.length) c = таблица [ряд++]; else break loop; приор = c; c = c.следщ; if ((результат = дг(приор.значение)) != 0) break loop; } ячейка = c; return результат; } /*************************************************************** Удали значение at the текущ обходчик location ***************************************************************/ бул удали () { if (приор) if (хозяин.удали (приор, ряд-1)) { // ignore this change ++мутация; return да; } приор = пусто; return нет; } } } /******************************************************************************* *******************************************************************************/ debug (HashSet) { import io.Stdout; import thread; import time.StopWatch; проц main() { // usage examples ... auto установи = new HashSet!(ткст); установи.добавь ("foo"); установи.добавь ("bar"); установи.добавь ("wumpus"); // implicit генерный iteration foreach (значение; установи) Стдвыв (значение).нс; // явный генерный iteration foreach (значение; установи.обходчик) Стдвыв (значение).нс; // генерный iteration with optional удали auto s = установи.обходчик; foreach (значение; s) {} // s.удали; // incremental iteration, with optional удали ткст v; auto обходчик = установи.обходчик; while (обходчик.следщ(v)) {} //обходчик.удали; // incremental iteration, with optional failfast auto it = установи.обходчик; while (it.действителен && it.следщ(v)) {} // удали specific элемент установи.удали ("wumpus"); // удали первый элемент ... while (установи.возьми(v)) Стдвыв.форматнс ("taking {}, {} left", v, установи.размер); // установи for benchmark, with a установи of целыйs. We // use a чанк разместитель, и presize the bucket[] auto тест = new HashSet!(цел, Контейнер.хэш, Контейнер.извлеки, Контейнер.Чанк); тест.кэш (1000, 1_000_000); тест.корзины = 1_500_000; const счёт = 1_000_000; Секундомер w; // benchmark добавим w.старт; for (цел i=счёт; i--;) тест.добавь(i); Стдвыв.форматнс ("{} добавьs: {}/s", тест.размер, тест.размер/w.stop); // benchmark reading w.старт; for (цел i=счёт; i--;) тест.содержит(i); Стдвыв.форматнс ("{} lookups: {}/s", тест.размер, тест.размер/w.stop); // benchmark добавим without allocation overhead тест.очисть; w.старт; for (цел i=счёт; i--;) тест.добавь(i); Стдвыв.форматнс ("{} добавьs (after очисть): {}/s", тест.размер, тест.размер/w.stop); // benchmark duplication w.старт; auto dup = тест.dup; Стдвыв.форматнс ("{} элемент dup: {}/s", dup.размер, dup.размер/w.stop); // benchmark iteration w.старт; foreach (значение; тест) {} Стдвыв.форматнс ("{} элемент iteration: {}/s", тест.размер, тест.размер/w.stop); тест.проверь; } }
D
/* * hunt-amqp: AMQP library for D programming language, based on hunt-net. * * Copyright (C) 2018-2019 HuntLabs * * Website: https://www.huntlabs.net * * Licensed under the Apache-2.0 License. * */ module hunt.amqp.streams.impl.TrackerImpl; import hunt.proton.amqp.messaging.Accepted; import hunt.proton.amqp.transport.DeliveryState; import hunt.proton.message.Message; import hunt.amqp.Handler; import hunt.amqp.ProtonDelivery; import hunt.amqp.impl.ProtonDeliveryImpl; import hunt.amqp.streams.Tracker; class TrackerImpl : Tracker { private Message _message; private ProtonDeliveryImpl _delivery; private Handler!Tracker onUpdated; this(Message message, Handler!Tracker onUpdated) { this._message = message; this.onUpdated = onUpdated; } public Message message() { return _message; } public ProtonDelivery delivery() { return _delivery; } public void setDelivery(ProtonDeliveryImpl delivery) { this._delivery = delivery; } public bool isAccepted() { return cast(Accepted)(_delivery.getRemoteState()) !is null; } public DeliveryState getRemoteState() { return _delivery.getRemoteState(); } public bool isRemotelySettled() { return _delivery.remotelySettled(); } public Handler!Tracker handler() { return onUpdated; } public void setHandler(Handler!Tracker onUpdated) { this.onUpdated = onUpdated; } }
D
//Written in the D programming language /* * Radio group widget. * * Copyright 2013 Jaypha * * Distributed under the Boost Software License, Version 1.0. * (See http://www.boost.org/LICENSE_1_0.txt) * * Authors: Jason den Dulk */ module jaypha.spinna.pagebuilder.widgets.radiogroup; public import jaypha.spinna.pagebuilder.widgets.widget; public import jaypha.spinna.pagebuilder.widgets.enumerated; import std.array; import std.conv; import jaypha.html.helpers; class RadioGroupWidget: Widget { @property { override string value() { return _value; } override void value(string v) { _value = v; } } @property { override string name() { return _name; } override void name(string v) { _name = v; } } this ( HtmlForm _form, string _name, string _label, bool _required, EnumeratedOption[] _options ) { super(_form, _name, _label, _required, "span"); options = _options; addClass("enum-widget"); addClass("radiogroup-widget"); } override void copy(TextOutputStream output) { auto c = appender!string(); foreach (o;options) { auto option_id = id~"-"~o.value; c.put("<label for='"); c.put(option_id); c.put("'>&nbsp;"); c.put(o.label); c.put("</label>"); c.put("<input type='radio' id='"); c.put(option_id); c.put("' name='"); c.put(name); c.put("' value='"); c.put(o.value); c.put("'"); if (_value == o.value) c.put(" checked='checked'"); c.put("/>"); } put(c.data); super.copy(output); output.print(javascript("new EnumGroupWidget($('#"~id~"'),'"~_name~"',{ label: '"~label~"', minSel: "~(required?"1":"0")~", maxSel: 1 });")); } @property vertical() { addClass("vertical"); removeClass("horizontal"); } @property horizontal() { addClass("horizontal"); removeClass("vertical"); } EnumeratedOption[] options; private: string _name, _value; }
D
module directx.com; public import directx.win32; public import core.sys.windows.com; alias const(GUID)* REFGUID, REFIID, REFCLSID, REFFMTID; mixin( uuid!(IUnknown, "00000000-0000-0000-C000-000000000046")); mixin( uuid!(IClassFactory,"00000001-0000-0000-C000-000000000046")); template uuid(T, const char[] g) { const char [] uuid = "const IID IID_"~T.stringof~"={ 0x" ~ g[0..8] ~ ",0x" ~ g[9..13] ~ ",0x" ~ g[14..18] ~ ",[0x" ~ g[19..21] ~ ",0x" ~ g[21..23] ~ ",0x" ~ g[24..26] ~ ",0x" ~ g[26..28] ~ ",0x" ~ g[28..30] ~ ",0x" ~ g[30..32] ~ ",0x" ~ g[32..34] ~ ",0x" ~ g[34..36] ~ "]};"~ "template uuidof(T:"~T.stringof~"){"~ " const IID uuidof ={ 0x" ~ g[0..8] ~ ",0x" ~ g[9..13] ~ ",0x" ~ g[14..18] ~ ",[0x" ~ g[19..21] ~ ",0x" ~ g[21..23] ~ ",0x" ~ g[24..26] ~ ",0x" ~ g[26..28] ~ ",0x" ~ g[28..30] ~ ",0x" ~ g[30..32] ~ ",0x" ~ g[32..34] ~ ",0x" ~ g[34..36] ~ "]};"~ "}"; } // from intsafe.h enum INTSAFE_E_ARITHMETIC_OVERFLOW = cast(HRESULT)0x80070216L; // 0x216 = 534 = ERROR_ARITHMETIC_OVERFLOW // Interface from DocumentTarget.h mixin(uuid!(IPrintDocumentPackageTarget, "1b8efec4-3019-4c27-964e-367202156906")); interface IPrintDocumentPackageTarget : IUnknown { extern(Windows): /* [helpstring] */ HRESULT GetPackageTargetTypes( /* [out] */ UINT32* targetCount, /* [size_is][size_is][out] */ GUID** targetTypes); /* [helpstring] */ HRESULT GetPackageTarget( /* [in] */ REFGUID guidTargetType, /* [in] */ REFIID riid, /* [iid_is][out] */ void** ppvTarget); HRESULT Cancel(); }
D
/home/ubuntu/substrate-node-template/target/release/deps/libp2p_mplex-62347081da3827dd.rmeta: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/lib.rs /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/codec.rs /home/ubuntu/substrate-node-template/target/release/deps/liblibp2p_mplex-62347081da3827dd.rlib: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/lib.rs /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/codec.rs /home/ubuntu/substrate-node-template/target/release/deps/libp2p_mplex-62347081da3827dd.d: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/lib.rs /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/codec.rs /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/lib.rs: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.22.0/src/codec.rs:
D
/home/isaiah/workspaces/rust-workspace/guessing_game/target/debug/deps/rand_core-86af4b57df6901ac.rmeta: /home/isaiah/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_core-0.3.1/src/lib.rs /home/isaiah/workspaces/rust-workspace/guessing_game/target/debug/deps/librand_core-86af4b57df6901ac.rlib: /home/isaiah/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_core-0.3.1/src/lib.rs /home/isaiah/workspaces/rust-workspace/guessing_game/target/debug/deps/rand_core-86af4b57df6901ac.d: /home/isaiah/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_core-0.3.1/src/lib.rs /home/isaiah/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_core-0.3.1/src/lib.rs:
D
instance CS_ESKORTE4(NPC_DEFAULT) { name[0] = "Эскорт4"; slot = "guard"; guild = GIL_GRD; level = 5; flags = 0; voice = 11; id = 3028; attribute[ATR_STRENGTH] = 13; attribute[ATR_DEXTERITY] = 9; attribute[ATR_MANA_MAX] = 0; attribute[ATR_MANA] = 0; attribute[ATR_HITPOINTS_MAX] = 26; attribute[ATR_HITPOINTS] = 26; Mdl_SetVisual(self,"HUMANS.MDS"); Mdl_ApplyOverlayMds(self,"Humans_Militia.MDS"); Mdl_SetVisualBody(self,"hum_body_Naked0",0,1,"Hum_Head_Fighter",18,2,grd_armor_i); b_scale(self); Mdl_SetModelFatness(self,0); fight_tactic = FAI_HUMAN_STRONG; Npc_SetTalentSkill(self,NPC_TALENT_1H,2); Npc_SetTalentSkill(self,NPC_TALENT_1H,2); Npc_SetTalentSkill(self,NPC_TALENT_2H,1); Npc_SetTalentSkill(self,NPC_TALENT_CROSSBOW,1); daily_routine = rtn_start_3028; }; func void rtn_start_3028() { ta_position(0,0,24,0,"WP_INTRO08"); };
D
var int Elena_ItemsGiven_Chapter_1; var int Elena_ItemsGiven_Chapter_2; var int Elena_ItemsGiven_Chapter_3; var int Elena_ItemsGiven_Chapter_4; var int Elena_ItemsGiven_Chapter_5; var int Elena_ItemsGiven_JoinGuild; func void B_GiveTradeInv_Elena(var C_Npc slf) { if((Kapitel >= 1) && (Elena_ItemsGiven_Chapter_1 == FALSE)) { CreateInvItems(slf,ItMi_Gold,100); CreateInvItems(slf,ItFo_Apple,6); CreateInvItems(slf,ItFo_Water,3); CreateInvItems(slf,ItFo_Cheese,3); CreateInvItems(slf,ItFo_Bacon,3); CreateInvItems(slf,ItFo_Stew,4); CreateInvItems(slf,ItFo_Sausage,2); CreateInvItems(slf,ItFo_Milk,5); Elena_ItemsGiven_Chapter_1 = TRUE; }; if((Kapitel >= 1) && (Elena_ItemsGiven_JoinGuild == FALSE) && hero.guild != GIL_NONE) { CreateInvItems(slf,ItMi_Gold,100); CreateInvItems(slf,ItFo_Apple,3); CreateInvItems(slf,ItFo_Water,1); CreateInvItems(slf,ItFo_Cheese,2); CreateInvItems(slf,ItFo_Bacon,2); CreateInvItems(slf,ItFoMutton,3); CreateInvItems(slf,ItFo_Sausage,4); CreateInvItems(slf,ItFo_Stew,4); CreateInvItems(slf,ItFo_Milk,2); Elena_ItemsGiven_JoinGuild = TRUE; }; if((Kapitel >= 2) && (Elena_ItemsGiven_Chapter_2 == FALSE)) { CreateInvItems(slf,ItMi_Gold,100); CreateInvItems(slf,ItFo_Cheese,4); CreateInvItems(slf,ItFoMutton,3); CreateInvItems(slf,ItFo_Stew,4); CreateInvItems(slf,ItFo_Apple,8); CreateInvItems(slf,ItFo_Honey,2); CreateInvItems(slf,ItFo_Milk,3); Elena_ItemsGiven_Chapter_2 = TRUE; }; if((Kapitel >= 3) && (Elena_ItemsGiven_Chapter_3 == FALSE)) { CreateInvItems(slf,ItMi_Gold,100); CreateInvItems(slf,ItFo_Cheese,2); CreateInvItems(slf,ItFo_Bacon,2); CreateInvItems(slf,ItFo_Apple,10); CreateInvItems(slf,ItFoMutton,3); CreateInvItems(slf,ItFo_Honey,2); CreateInvItems(slf,ItFo_Stew,5); CreateInvItems(slf,ItFo_Sausage,3); CreateInvItems(slf,ItFo_Milk,5); Elena_ItemsGiven_Chapter_3 = TRUE; }; if((Kapitel >= 4) && (Elena_ItemsGiven_Chapter_4 == FALSE)) { CreateInvItems(slf,ItMi_Gold,150); CreateInvItems(slf,ItFo_Wine,5); CreateInvItems(slf,ItFo_Cheese,2); CreateInvItems(slf,ItFo_Milk,10); CreateInvItems(slf,ItFo_Apple,9); CreateInvItems(slf,ItFoMutton,5); CreateInvItems(slf,ItFo_Stew,1); CreateInvItems(slf,ItFo_Sausage,5); CreateInvItems(slf,ItFo_Bacon,5); Elena_ItemsGiven_Chapter_4 = TRUE; }; if((Kapitel >= 5) && (Elena_ItemsGiven_Chapter_5 == FALSE)) { CreateInvItems(slf,ItMi_Gold,200); CreateInvItems(slf,ItFo_Wine,2); CreateInvItems(slf,ItFo_Milk,5); CreateInvItems(slf,ItFo_Apple,4); CreateInvItems(slf,ItFoMutton,5); CreateInvItems(slf,ItFo_Stew,3); CreateInvItems(slf,ItFo_Sausage,5); CreateInvItems(slf,ItFo_Bacon,3); CreateInvItems(slf,ItFo_Milk,5); Elena_ItemsGiven_Chapter_5 = TRUE; }; };
D
; Copyright (C) 2008 The Android Open Source Project ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. .source T_div_long_2addr_6.java .class public dot.junit.opcodes.div_long_2addr.d.T_div_long_2addr_6 .super java/lang/Object .method public <init>()V .limit regs 1 invoke-direct {v0}, java/lang/Object/<init>()V return-void .end method .method public run(JJ)J .limit regs 14 div-long/2addr v10, v14 return-wide v10 .end method
D
import std.concurrency, std.stdio, core.thread, core.time; void handle_string(string s) { writeln( "catch!; ", s ); } void receiver() { for ( bool running = true; running; ) { auto worked = receiveTimeout( dur!"msecs"(500), &handle_string, (int x) { writeln( "catch!: ", x ); }, (int i, string s) { writeln( "catch!: ", i, "-", s ); }, (OwnerTerminated o) { writeln("Bye!"); running = false; } ); if (!worked) { writeln("boring..."); } } } void main() { auto tid = spawn(&receiver); send(tid, "Hello!"); Thread.sleep(dur!"seconds"(3)); send(tid, 3); Thread.sleep(dur!"seconds"(3)); send(tid, 1, "one"); }
D
/** This module contains the engine behind Pegged, the expression templates building blocks to create a top-down recursive-descent parser. The terminals and non-terminals described here are meant to be used inside a Pegged grammar. As such, they are a bit less user-friendly than what's output by pegged.grammar. For example they take a ParseTree as input, not a string. See the /docs directory for the full documentation as markdown files. */ module pegged.peg; /* NOTE: Do not use the GrammarTester for unittesting in this module. This module needs to be able to pass its unittests before the GrammarTester is even trustable. Writing tests the long way is preferred here, as it will avoid the circular dependency. */ import std.algorithm: map, startsWith; import std.uni : isAlpha; import std.array; import std.conv; import std.range: equal; import std.string: strip; import std.typetuple; import std.uni: isAlpha; /** CT Switch for testing 'keywords' implementations */ enum { IFCHAIN, TRIE } enum KEYWORDS = IFCHAIN; /** The basic parse tree, as used throughout the project. You can defined your own parse tree node, but respect the basic layout. */ struct ParseTree { string name; /// The node name bool successful; /// Indicates whether a parsing was successful or not string[] matches; /// The matched input's parts. Some expressions match at more than one place, hence matches is an array. string input; /// The input string that generated the parse tree. Stored here for the parse tree to be passed to other expressions, as input. size_t begin, end; /// Indices for the matched part (from the very beginning of the first match to the last char of the last match. ParseTree[] children; /// The sub-trees created by sub-rules parsing. /** Basic toString for easy pretty-printing. */ string toString(string tabs = "") { string result = name; string childrenString; bool allChildrenSuccessful = true; foreach(i,child; children) { childrenString ~= tabs ~ " +-" ~ child.toString(tabs ~ ((i < children.length -1 ) ? " | " : " ")); if (!child.successful) allChildrenSuccessful = false; } if (successful) { result ~= " " ~ to!string([begin, end]) ~ to!string(matches) ~ "\n"; } else // some failure info is needed { if (allChildrenSuccessful) // no one calculated the position yet { Position pos = position(this); string left, right; if (pos.index < 10) left = input[0 .. pos.index]; else left = input[pos.index-10 .. pos.index]; //left = strip(left); if (pos.index + 10 < input.length) right = input[pos.index .. pos.index + 10]; else right = input[pos.index .. $]; //right = strip(right); result ~= " failure at line " ~ to!string(pos.line) ~ ", col " ~ to!string(pos.col) ~ ", " ~ (left.length > 0 ? "after \"" ~ left ~ "\" " : "") ~ "expected "~ (matches.length > 0 ? matches[$-1] : "NO MATCH") ~ ", but got \"" ~ right ~ "\"\n"; } else { result ~= " (failure)\n"; } } return result ~ childrenString; } @property string failMsg() { foreach(i, child; children) { if (!child.successful) return child.failMsg; } if (!successful) { Position pos = position(this); string left, right; if (pos.index < 10) left = input[0 .. pos.index]; else left = input[pos.index - 10 .. pos.index]; left = left.replace("\n", `\n`).replace("\t", `\t`); if (pos.index + 10 < input.length) right = input[pos.index .. pos.index + 10]; else right = input[pos.index .. $]; right = right.replace("\n", `\n`).replace("\t", `\t`); return "Failure at line " ~ to!string(pos.line) ~ ", col " ~ to!string(pos.col) ~ ", " ~ (left.length > 0 ? "after \"" ~ left ~ "\" " : "") ~ "expected " ~ (matches.length > 0 ? matches[$ - 1] : "NO MATCH") ~ `, but got "` ~ right ~ `"`; } return "Success"; } /** Comparing ParseTree's. This function is templated so that the compiler can automatically choose a const ref or plain const version for the 'p' parameter. See this for more details: http://goo.gl/vfKKG */ bool opEquals(T)(auto ref T p) const { return ( p.name == name && p.successful == successful && p.matches == matches && p.input == input && p.begin == begin && p.end == end && (p.children == children) ); } ParseTree dup() @property { ParseTree result = this; result.matches = result.matches.dup; result.children = map!(p => p.dup)(result.children).array(); return result; } } unittest // ParseTree testing { ParseTree p; assert(p == p, "Self-identity on null tree."); p = ParseTree("Name", true, ["abc", "", "def"], "input", 0, 1, null); assert(p == p, "Self identity on non-null tree."); ParseTree child = ParseTree("Child", true, ["abc", "", "def"], "input", 0, 1, null); p.children = [child, child]; ParseTree q = p; assert(p == q, "Copying creates equal trees."); assert(p.children == q.children); p.children = [child, child, child]; assert(q.children != p.children, "Disconnecting children."); p = ParseTree("Name", true, ["abc", "", "def"], "input", 0, 1, null); p.children = [child, child]; q = p.dup; assert(p == q, "Dupping creates equal trees."); assert(p.children == q.children, "Equal children for dupped trees."); p.children = null; assert(q.children != p.children); q.children = [p,p]; assert(p != q, "Tree with different children are not equal."); p.children = [p,p]; assert(p == q, "Adding equivalent children is OK."); p.matches = null; assert(p != q, "Nulling matches makes trees unequal."); p.matches = q.matches; assert(p == q, "Copying matches makes equal trees."); } /// To compare two trees for content (not bothering with node names) /// That's useful to compare the results from two different grammars. bool softCompare(ParseTree p1, ParseTree p2) { return p1.successful == p2.successful && p1.matches == p2.matches && p1.begin == p2.begin && p1.end == p2.end && std.algorithm.equal!(softCompare)(p1.children, p2.children); // the same for children } unittest // softCompare { ParseTree p = ParseTree("Name", true, ["abc", "", "def"], "input", 0, 1, null); ParseTree child = ParseTree("Child", true, ["abc", "", "def"], "input", 0, 1, null); p.children = [child, child]; ParseTree q = p; assert(p == q, "Copy => Equal trees."); assert(softCompare(p,q), "Copy => Trees equal for softCompare."); q.name = "Another One"; assert(p != q, "Name change => non-equal trees."); assert(softCompare(p,q), "Name change => Trees equal for softCompare."); } /// To record a position in a text struct Position { size_t line;/// line number (starts at 0) size_t col;/// column number (starts at 0) size_t index;/// index (starts at 0) } /** Given an input string, returns the position corresponding to the end of the string. For example: --- assert(position("abc") == Position(0,3,3)); assert(position("abc ") == Position(1,0,4)); assert(position("abc ") == Position(2,4,8)); --- */ Position position(string s) { size_t col, line, index; foreach(i,c; s) { if (eol(ParseTree("", false, [], s, 0,i)).successful) { col = 0; ++line; ++index; } else { ++col; ++index; } } return Position(line,col,index); } /** Same as previous overload, but from the begin of P.input to p.end */ Position position(ParseTree p) { return position(p.input[0..p.end]); } unittest { assert(position("") == Position(0,0,0), "Null string, position 0."); assert(position("abc") == Position(0,3,3), "length 3 string, no line feed."); assert(position("abc ") == Position(1,0,4), "One end of line."); assert(position("abc ----") == Position(2,4,9), "Three lines (second one empty)."); assert(position("abc ---- ----") == Position(2,4,13), "Three lines."); assert(position(" ") == Position(3,0,3), "Four lines, all empty."); } string getName(alias expr)() @property { static if (is(typeof( { expr(GetName()); }))) return expr(GetName()); else return __traits(identifier, expr); } struct GetName {} /** Basic rule, that always fail without consuming. */ ParseTree fail(ParseTree p) { return ParseTree("fail", false, [], p.input, p.end, p.end, null); } /// ditto ParseTree fail(string input) { return fail(ParseTree("", false, [], input)); } string fail(GetName g) { return "fail"; } unittest // 'fail' unit test { ParseTree input = ParseTree("input", true, [], "This is the input string.", 0,0, null); ParseTree result = fail(input); assert(result.name == "fail"); assert(!result.successful, "'fail' fails."); assert(result.matches is null, "'fail' makes no match."); assert(result.input == input.input, "'fail' does not change the input."); assert(result.end == input.end, "'fail' puts the index after the previous parse."); assert(result.children is null, "'fail' has no children."); result = fail("This is the input string."); assert(!result.successful, "'fail' fails."); } /** Matches the end of input. Fails if there is any character left. */ ParseTree eoi(ParseTree p) { if (p.end == p.input.length) return ParseTree("eoi", true, [], p.input, p.end, p.end); else return ParseTree("eoi", false, ["end of input"], p.input, p.end, p.end); } /// ditto ParseTree eoi(string input) { return eoi(ParseTree("", false, [], input)); } string eoi(GetName g) { return "eoi"; } alias eoi endOfInput; /// helper alias. unittest // 'eoi' unit test { ParseTree input = ParseTree("input", true, [], "This is the input string.", 0,0, null); ParseTree result = eoi(input); assert(result.name == "eoi"); assert(!result.successful, "'eoi' fails on non-null string."); assert(result.matches == ["end of input"], "'eoi' error message."); assert(result.input == input.input, "'eoi' does not change the input."); assert(result.end == input.end, "'eoi' puts the index after the previous parse."); assert(result.children is null, "'eoi' has no children."); input = ParseTree("input", true, [], "", 0,0, null); result = eoi(input); assert(result.successful, "'eoi' succeeds on strings of length 0."); result = eoi(""); assert(result.successful, "'eoi' succeeds on strings of length 0."); result = eoi(null); assert(result.successful, "'eoi' succeeds on null strings"); } /** Match any character. As long as there is at least a character left in the input, it succeeds. Conversely, it fails only if called at the end of the input. */ ParseTree any(ParseTree p) { if (p.end < p.input.length) return ParseTree("any", true, [p.input[p.end..p.end+1]], p.input, p.end, p.end+1); else return ParseTree("any", false, ["any char"], p.input, p.end, p.end); } /// ditto ParseTree any(string input) { return any(ParseTree("", false, [], input)); } string any(GetName g) { return "any"; } unittest // 'any' unit test { ParseTree input = ParseTree("input", true, [], "This is the input string.", 0,0, null); ParseTree result = any(input); assert(result.name == "any"); assert(result.successful, "'any' succeeds on non-null strings."); assert(result.matches == ["T"], "'any' matches the first char in an input."); assert(result.input == input.input, "'any' does not change the input."); assert(result.end == input.end+1, "'any' advances the index by one position."); assert(result.children is null, "'any' has no children."); result = any("a"); assert(result.successful, "'any' matches on strings of length one."); assert(result.matches == ["a"], "'any' matches the first char in an input."); assert(result.input == "a", "'any' does not change the input."); assert(result.end == 1, "'any' advances the index by one position."); assert(result.children is null, "'any' has no children."); input = ParseTree("input", true, [], "", 0,0, null); result = any(input); assert(!result.successful, "'any' fails on strings of length 0."); assert(result.matches == ["any char"], "'any' error message on strings of length 0."); assert(result.end == 0, "'any' does not advance the index."); result = any(""); assert(!result.successful, "'any' fails on strings of length 0."); assert(result.matches == ["any char"], "'any' error message on strings of length 0."); assert(result.end == 0, "'any' does not advance the index."); result = any(null); assert(!result.successful, "'any' fails on null strings."); assert(result.matches == ["any char"], "'any' error message on strings of length 0."); assert(result.end == 0, "'any' does not advance the index."); } /** Predefined parser: matches word boundaries, as \b for regexes. */ ParseTree wordBoundary(ParseTree p) { // TODO: I added more indexing guards and now this could probably use // some simplification. Too tired to write it better. --Chad bool matched = (p.end == 0 && isAlpha(p.input.front())) || (p.end == p.input.length && isAlpha(p.input.back())) || (p.end > 0 && isAlpha(p.input[p.end-1]) && p.end < p.input.length && !isAlpha(p.input[p.end])) || (p.end > 0 && !isAlpha(p.input[p.end-1]) && p.end < p.input.length && isAlpha(p.input[p.end])); if (matched) return ParseTree("wordBoundary", matched, [], p.input, p.end, p.end, null); else return ParseTree("wordBoundary", matched, ["word boundary"], p.input, p.end, p.end, null); } /// ditto ParseTree wordBoundary(string input) { return ParseTree("wordBoundary", isAlpha(input.front()), [], input, 0,0, null); } string wordBoundary(GetName g) { return "wordBoundary"; } unittest // word boundary { ParseTree input = ParseTree("", false, [], "This is a word."); auto wb = [// "This" cast(size_t)(0):true, 1:false, 2:false, 3:false, 4: true, // "is" 5: true, 6:false, 7: true, // "a" 8: true, 9:true, // "word" 10:true, 11:false, 12:false, 13:false, 14:true, // "." 15:false ]; foreach(size_t index; 0 .. input.input.length) { input.end = index; ParseTree result = wordBoundary(input); assert(result.name == "wordBoundary"); assert(result.successful == wb[index]); // true, false, ... // for errors, there is an error message assert(result.successful && result.matches is null || !result.successful); assert(result.begin == input.end); assert(result.end == input.end); assert(result.children is null); } } /** Represents a literal in a PEG, like "abc" or 'abc' (or even ''). It succeeds if a prefix of the input is equal to its template parameter and fails otherwise. */ template literal(string s) { enum name = "literal!(\""~s~"\")"; ParseTree literal(ParseTree p) { enum lit = "\"" ~ s ~ "\""; if (p.end+s.length <= p.input.length && p.input[p.end..p.end+s.length] == s) return ParseTree(name, true, [s], p.input, p.end, p.end+s.length); else return ParseTree(name, false, [lit], p.input, p.end, p.end); } ParseTree literal(string input) { return .literal!(s)(ParseTree("", false, [], input)); } string literal(GetName g) { return name; } } unittest // 'literal' unit test { ParseTree input = ParseTree("input", true, [], "abcdef", 0,0, null); alias literal!"a" a; alias literal!"abc" abc; alias literal!"" empty; ParseTree result = a(input); assert(result.name == `literal!("a")`, "Literal name test."); assert(result.successful, "'a' succeeds on inputs beginning with 'a'."); assert(result.matches == ["a"], "'a' matches the 'a' at the beginning."); assert(result.input == input.input, "'a' does not change the input."); assert(result.end == input.end+1, "'a' advances the index by one position."); assert(result.children is null, "'a' has no children."); result = a("abcdef"); assert(result.successful, "'a' succeeds on inputs beginning with 'a'."); assert(result.matches == ["a"], "'a' matches the 'a' at the beginning."); assert(result.input == input.input, "'a' does not change the input."); assert(result.end == input.end+1, "'a' advances the index by one position."); assert(result.children is null, "'a' has no children."); result = abc(input); assert(result.name == `literal!("abc")`, "Literal name test."); assert(result.successful, "'abc' succeeds on inputs beginning with 'abc'."); assert(result.matches == ["abc"], "'abc' matches 'abc' at the beginning."); assert(result.input == input.input, "'abc' does not change the input."); assert(result.end == input.end+3, "'abc' advances the index by 3 positions."); assert(result.children is null, "'abc' has no children."); result = abc("abcdef"); assert(result.successful, "'abc' succeeds on inputs beginning with 'abc'."); assert(result.matches == ["abc"], "'abc' matches 'abc' at the beginning."); assert(result.input == input.input, "'abc' does not change the input."); assert(result.end == input.end+3, "'abc' advances the index by 3 positions."); assert(result.children is null, "'abc' has no children."); result = empty(input); assert(result.name == `literal!("")`, "Literal name test."); assert(result.successful, "'' succeeds on non-null inputs."); assert(result.matches == [""], "'' matches '' at the beginning."); assert(result.input == input.input, "'' does not change the input."); assert(result.end == input.end+0, "'' does not advance the index."); assert(result.children is null, "'' has no children."); result = empty("abcdef"); assert(result.successful, "'' succeeds on non-null inputs."); assert(result.matches == [""], "'' matches '' at the beginning."); assert(result.input == input.input, "'' does not change the input."); assert(result.end == input.end+0, "'' does not advance the index."); assert(result.children is null, "'' has no children."); input.input = "bcdef"; result = a(input); assert(!result.successful, "'a' fails on inputs not beginning with 'a'."); assert(result.matches == ["\"a\""], "'a' makes no match on 'bcdef'."); assert(result.input == input.input, "'a' does not change the input."); assert(result.end == input.end, "'a' does not advances the index on 'bcdef'."); assert(result.children is null, "'a' has no children."); result = abc(input); assert(!result.successful, "'abc' fails on inputs not beginning with 'abc'."); assert(result.matches == ["\"abc\""], "'abc' does no match on 'bcdef'."); assert(result.input == input.input, "'abc' does not change the input."); assert(result.end == input.end, "'abc' does not advance the index on 'bcdef'."); assert(result.children is null, "'abc' has no children."); result = empty(input); assert(result.successful, "'' succeeds on non-null inputs."); assert(result.matches == [""], "'' matches '' at the beginning."); assert(result.input == input.input, "'' does not change the input."); assert(result.end == input.end+0, "'' does not advance the index."); assert(result.children is null, "'' has no children."); input.input = ""; result = a(input); assert(!result.successful, "'a' fails on empty strings."); assert(result.matches == ["\"a\""], "'a' does not match ''."); assert(result.input == input.input, "'a' does not change the input."); assert(result.end == input.end, "'a' does not advance the index on 'bcdef'."); assert(result.children is null, "'a' has no children."); result = abc(input); assert(!result.successful, "'abc' fails on empty strings."); assert(result.matches == ["\"abc\""], "'abc' does not match ''."); assert(result.input == input.input, "'abc' does not change the input."); assert(result.end == input.end, "'abc' does not advance the index on 'bcdef'."); assert(result.children is null, "'abc' has no children."); result = empty(input); assert(result.successful, "'' succeeds on empty strings."); assert(result.matches == [""], "'' matches '' at the beginning, even on empty strings."); assert(result.input == input.input, "'' does not change the input."); assert(result.end == input.end+0, "'' does not advance the index."); assert(result.children is null, "'' has no children."); } /** Represents a range of chars, from begin to end, included. So charRange!('a','z') matches all English lowercase letters. If fails if the input is empty or does not begin with a character between begin and end. If begin == end, it will match one char (begin... or end). begin > end is non-legal. */ template charRange(dchar begin, dchar end) if (begin <= end) { enum name = "charRange!('"~to!string(begin)~"','" ~ to!string(end) ~ "')"; ParseTree charRange(ParseTree p) { enum longname = "a char between '"~to!string(begin)~"' and '"~to!string(end)~"'"; if (p.end < p.input.length && p.input[p.end] >= begin && p.input[p.end] <= end) return ParseTree(name, true, [p.input[p.end..p.end+1]], p.input, p.end, p.end+1); else return ParseTree(name, false, [longname], p.input, p.end, p.end); } ParseTree charRange(string input) { return .charRange!(begin,end)(ParseTree("",false,[],input)); } string charRange(GetName g) { return name; } } unittest // 'charRange' unit test { ParseTree input = ParseTree("input", true, [], "abcdef", 0,0, null); alias charRange!('a','a') aa; alias charRange!('a','b') ab; alias charRange!('a','z') az; alias charRange!(dchar.min,dchar.max) allChars; alias charRange!('\U00000000','\U000000FF') ASCII; static assert(!__traits(compiles, {alias charRange!('z','a') za;})); ParseTree result = aa(input); assert(result.name == "charRange!('a','a')", "charRange name test."); assert(result.successful, "'a-a' succeeds on inputs beginning with 'a'."); assert(result.matches == ["a"], "'a-a' matches the 'a' at the beginning."); assert(result.input == input.input, "'a-a' does not change the input."); assert(result.end == input.end+1, "'a-a' advances the index by one position."); assert(result.children is null, "'a-a' has no children."); result = ab("abcdef"); assert(result.name == "charRange!('a','b')", "charRange name test."); assert(result.successful, "'a-b' succeeds on inputs beginning with 'a'."); assert(result.matches == ["a"], "'a-b' matches the 'a' at the beginning."); assert(result.input == input.input, "'a-b' does not change the input."); assert(result.end == input.end+1, "'a-b' advances the index by one position."); assert(result.children is null, "'a-b' has no children."); result = az(input); assert(result.name == "charRange!('a','z')", "charRange name test."); assert(result.successful, "'a-z' succeeds on inputs beginning with 'abc'."); assert(result.matches == ["a"], "'a-z' matches 'a' at the beginning."); assert(result.input == input.input, "'a-z' does not change the input."); assert(result.end == input.end+1, "'a-z' advances the index by one position."); assert(result.children is null, "'a-z' has no children."); input.input = "bcdef"; result = aa(input); assert(!result.successful, "'a-a' fails on inputs not beginning with 'a'."); assert(result.matches == ["a char between 'a' and 'a'"], "'a-a' makes no match on 'bcdef'."); assert(result.input == input.input, "'a-a' does not change the input."); assert(result.end == input.end, "'a-a' does not advances the index on 'bcdef'."); assert(result.children is null, "'a-a' has no children."); result = ab(input); assert(result.successful, "'a-b' succeeds on inputs beginning with 'b'."); assert(result.matches == ["b"], "'a-b' matches on 'bcdef'."); assert(result.input == input.input, "'a-b' does not change the input."); assert(result.end == input.end+1, "'a-b' advances the index by one position'."); assert(result.children is null, "'a-b' has no children."); result = az(input); assert(result.successful, "'a-z' succeeds on 'bcdef'."); assert(result.matches == ["b"], "'a-z' matches 'b' at the beginning of 'bcdef'."); assert(result.input == input.input, "'a-z' does not change the input."); assert(result.end == input.end+1, "'a-z' advances the index by one position."); assert(result.children is null, "'a-z' has no children."); input.input = ""; result = aa(input); assert(!result.successful, "'a-a' fails on empty strings."); assert(result.matches == ["a char between 'a' and 'a'"], "'a-a' does not match ''."); assert(result.input == input.input, "'a-a' does not change the input."); assert(result.end == input.end, "'a-a' does not advance the index on ''."); assert(result.children is null, "'a-a' has no children."); result = ab(input); assert(!result.successful, "'a-b' fails on empty strings."); assert(result.matches == ["a char between 'a' and 'b'"], "'a-b' does not match ''."); assert(result.input == input.input, "'a-b' does not change the input."); assert(result.end == input.end, "'a-b' does not advance the index on ''."); assert(result.children is null, "'a-b' has no children."); result = az(input); assert(!result.successful, "'a-z' fails on empty strings."); assert(result.matches == ["a char between 'a' and 'z'"], "'a-z' does not match ''."); assert(result.input == input.input, "'a-z' does not change the input."); assert(result.end == input.end, "'a-z' does not advance the index on ''."); assert(result.children is null, "'a-z' has no children."); input.input = "123"; result = aa(input); assert(!result.successful, "'a-a' fails on '123'."); assert(result.matches == ["a char between 'a' and 'a'"], "'a-a' does not match '123'."); assert(result.input == input.input, "'a-a' does not change the input."); assert(result.end == input.end, "'a-a' does not advance the index on '123'."); assert(result.children is null, "'a-a' has no children."); result = ab(input); assert(!result.successful, "'a-b' fails on '123'."); assert(result.matches == ["a char between 'a' and 'b'"], "'a-b' does not match '123'."); assert(result.input == input.input, "'a-b' does not change the input."); assert(result.end == input.end, "'a-b' does not advance the index on '123'."); assert(result.children is null, "'a-b' has no children."); result = az(input); assert(!result.successful, "'a-z' fails on '123'."); assert(result.matches == ["a char between 'a' and 'z'"], "'a-z' does not match '123'."); assert(result.input == input.input, "'a-z' does not change the input."); assert(result.end == input.end, "'a-z' does not advance the index on '123'."); assert(result.children is null, "'a-z' has no children."); foreach(dchar ch; 0..256*(128+64+16+8)) assert(allChars(to!string(ch)).successful); assert(!allChars("").successful); } /** eps matches the empty string (usually denoted by the Greek letter 'epsilon') and always succeeds. It's equivalent to literal!"" (for example, it creates a match of [""]: one match, the empty string). */ ParseTree eps(ParseTree p) { return ParseTree("eps", true, [""], p.input, p.end, p.end); } ParseTree eps(string input) { return eps(ParseTree("",false,[], input)); } string eps(GetName g) { return "eps"; } unittest // 'eps' unit test { ParseTree input = ParseTree("input", true, [], "abcdef", 0,0, null); ParseTree result = eps(input); assert(result.name == "eps"); assert(result.successful, "'eps' succeeds on non-null inputs."); assert(result.matches == [""], "'eps' matches '' at the beginning."); assert(result.input == input.input, "'eps' does not change the input."); assert(result.end == input.end+0, "'eps' does not advance the index."); assert(result.children is null, "'eps' has no children."); input.input = ""; result = eps(input); assert(result.name == "eps"); assert(result.successful, "'eps' succeeds on empty strings."); assert(result.matches == [""], "'eps' matches '' at the beginning, even on empty strings."); assert(result.input == input.input, "'eps' does not change the input."); assert(result.end == input.end+0, "'eps' does not advance the index."); assert(result.children is null, "'eps' has no children."); } /** Basic operator: it matches if all its subrules (stored in the rules template parameter tuple) match the input successively. Its subrules parse trees are stored as its children and its matches field will contain all its subrules matches, in order. ---- alias and!(literal!"abc", charRange!('a','z')) rule; // abc followed by any letter between a and z. ParseTree input = ParseTree("",false,[],"abcd"); // low-level plumbing, // the rules described here act on ParseTree's not strings. // It's equivalent to "abcd" as input auto result = rule(input); assert(result.successful); // OK, 'abc' followed by 'd' assert(result.matches == ["abc", "d"]); // stores the matches assert(result.children.length == 2); // two children, the result of "abc" on "abcd" and the result of [a-z] on "d" input.input = "abc"; // changing the input string; assert(!rule(input)).successful); // NOK, abc alone input.input = "ab"; assert(!rule(input)).successful); // NOK, does not begin by abc ---- If it fails, the last children will contain the failed node. That way, when printing, as sort of diagnostic is given: ---- alias and!(literal!"abc", charRange!('a','z')) rule; // 'abc[a-z]', aka 'abc' followed by any letter between 'a' and 'z'. ParseTree input = ParseTree("",false,[],"abc1"); // equivalent to "abc1" auto failure = rule(input); writeln(failure); /+ writes: and (failure) +-literal(abc) [0, 3]["abc"] +-charRange(a,z) failure at line 0, col 3, after "abc" a char between 'a' and 'z', but got "1" +/ ---- So we know the global 'and' failed, that the first sub-rule ('abc') succeeded on input[0..3] with "abc" and that the second subrule ('[a-z]') failed at position 3 (so, on '1'). */ template and(rules...) if (rules.length > 0) { string ctfeGetNameAnd() { string name = "and!("; foreach(i,rule; rules) name ~= __traits(identifier, rule) // because using getName!(rule) causes an infinite loop during compilation // for recursive rules ~ (i < rules.length -1 ? ", " : ""); name ~= ")"; return name; } enum name = ctfeGetNameAnd(); ParseTree and(ParseTree p) { bool keepNode(ParseTree node) { return node.name.startsWith("keep!(") || ( !node.name.startsWith("discard!(") //&& !node.name.startsWith("drop!(") && node.matches !is null //&& node.begin != node.end ); } ParseTree result = ParseTree(name, false, [], p.input, p.end, p.end, []); foreach(i,r; rules) { ParseTree temp = r(result); result.end = temp.end; if (temp.successful) { if (keepNode(temp)) { result.matches ~= temp.matches; if (temp.name.startsWith("drop!(")) {} else if (temp.name.startsWith("propagate!(")) result.children ~= temp.children; else result.children ~= temp; } } else { result.children ~= temp;// add the failed node, to indicate which failed if (temp.matches.length > 0) result.matches ~= temp.matches[$-1]; return result; // and end the parsing attempt right there } } result.successful = true; return result; } ParseTree and(string input) { return .and!(rules)(ParseTree("",false,[],input)); } string and(GetName g) { return name; } } unittest // 'and' unit test { alias literal!"abc" abc; alias literal!"de" de; alias literal!"f" f; alias and!(abc) abcAnd; alias and!(abc,de) abcde; alias and!(abc,de,f) abcdef; alias and!(eps, abc, eps, de, eps, f, eps) withEps; //assert(getName!(abcAnd)() == `and!(literal!("abc"))`); //assert(getName!(abcde)() == `and!(literal!("abc"), literal!("de"))`); //assert(getName!(abcdef)() == `and!(literal!("abc"), literal!("de"), literal!("f"))`); ParseTree input = ParseTree("",false,[], "abcdefghi"); ParseTree result = abcAnd(input); assert(result.successful, "and!('abc') parses 'abcdefghi'"); assert(result.matches == ["abc"], "and!('abc') matches 'abc' at the beginning of 'abcdefghi'"); assert(result.end == input.end+3, "and!('abc') advances the index by 'abc' size (3)."); assert(result.children == [abc(input)], "and!('abc') has one child: the one created by 'abc'."); result = abcde(input); assert(result.successful, "and!('abc','de') parses 'abcdefghi'"); assert(result.matches == ["abc","de"], "and!('abc','de') matches 'abc' and 'de' at the beginning of 'abcdefghi'"); assert(result.end == input.end+5, "and!('abc','de') advances the index by 3+2 positions."); assert(result.children == [abc(input), de(abc(input))], "and!('abc','de') has two children, created by 'abc' and 'de'."); result = abcdef(input); assert(result.successful, "and!('abc','de','f') parses 'abcdefghi'"); assert(result.matches == ["abc","de","f"], "and!('abc','de','f') matches 'abcdef' at the beginning of 'abcdefghi'"); assert(result.end == input.end+6, "and!('abc','de','f') advances the index by 3+2+1 positions."); assert(result.children == [abc(input), de(abc(input)), f(de(abc(input)))] , "and!('abc','de') has two children, created by 'abc' and 'de'."); result = withEps(input); assert(result.successful, "and!('','abc','','de','','f','') parses 'abcdefghi'"); assert(result.matches == ["","abc","","de","","f",""], "and!('','abc','','de','','f','') matches 'abcdef' at the beginning of 'abcdefghi'"); assert(result.end == input.end+6, "and!('','abc','','de','','f','') advances the index by 0+3+0+2+0+1+0 positions."); input.input = "bcdefghi"; result = abcdef(input); assert(!result.successful, "'abc' 'de' 'f' fails on 'bcdefghi'"); //assert(result.matches is null, "'abc' 'de' 'f' has no match on 'bcdefghi'"); assert(result.end == input.end); assert(result.children == [abc(input)], "'abc' 'de' 'f' has one child (a failure) on 'bcdefghi'"); input.input = "abc_efghi"; result = abcdef(input); assert(!result.successful, "'abc' 'de' 'f' fails on 'abc_efghi'"); //assert(result.matches == ["abc"], "Only the first match, from 'abc'."); assert(result.end == input.end+3, "Advances by 3 positions, due to 'abc'"); assert(result.children == [abc(input), de(abc(input))] , "'abc' 'de' 'f' has two child on 'abc_efghi', the one from 'abc' (success) and the one from 'de' (failure)."); } template wrapAround(alias before, alias target, alias after) { ParseTree wrapAround(ParseTree p) { ParseTree temp = before(p); if (!temp.successful) return temp; ParseTree result = target(temp); if (!result.successful) return result; result.begin = temp.begin; temp = after(result); if (!temp.successful) return temp; result.end = temp.end; return result; } ParseTree wrapAround(string input) { return .wrapAround!(before, target, after)(ParseTree("",false,[],input)); } string wrapAround(GetName g) { return "wrapAround!(" ~ getName!(before)() ~ ", " ~ getName!(target)() ~ ", " ~ getName!(after)() ~ ")"; } } /** Basic operator: it matches if one of its subrules (stored in the rules template parameter tuple) match the input. The subrules are tested in order, from rules[0] to rules[$-1]. The matching subrule parse trees is stored as its only child and its matches field will contain all the subrule matches, in order. ---- alias or!(literal!"abc", charRange!('a','z')) rule; // abc or, failing that, any letter between a and z. ParseTree input = ParseTree("",false,[],"defg"); // low-level plumbing, the rules described here act on ParseTree's not strings. // It's equivalent to "defg" as input auto result = rule(input); assert(result.successful); // OK assert(result.matches == ["d"]); // stores the (in this case) only match assert(result.children.length == 1); // one child, the result of "abc" or [a-z], depending on which rule succeeded. input.input = "abc"; // changing the input string; assert(rule(input)).successful); // Still OK input.input = "1abc"; assert(!rule(input)).successful); // NOK, does not begin by abc nor by [a-z] ---- If it fails, the last children will contain the failed node that matched furthest (longes match). That way, when printing, as sort of diagnostic is given: ---- alias or!(literal!"abc", and!(literal!"ab", charRange!('0','9'))) rule; // 'abc' or 'ab[0-9]' ParseTree input = ParseTree("",false,[],"abd"); // equivalent to "abd" auto failure = rule(input); writeln(failure); /+ or (failure) +-and (failure) +-literal(ab) [0, 2]["ab"] +-charRange(0,9) failure at line 0, col 2, after "ab" expected a char between '0' and '9', but got "d" +/ ---- So we know 'or' failed, that the 'and' sub-rule had the longest match, matching 'ab' and failing for [0-9] on index 2. */ template or(rules...) if (rules.length > 0) { string ctfeGetNameOr() { string name = "or!("; foreach(i,rule; rules) name ~= getName!(rule) ~ (i < rules.length -1 ? ", " : ""); name ~= ")"; return name; } enum name = ctfeGetNameOr(); ParseTree or(ParseTree p) { // error-management ParseTree longestFail = ParseTree(name, false, [], p.input, p.end, 0); string[] errorStrings; size_t errorStringChars; string orErrorString; ParseTree[rules.length] results; string[rules.length] names; size_t[rules.length] failedLength; size_t maxFailedLength; // Real 'or' loop foreach(i,r; rules) { ParseTree temp = r(p); if (temp.successful) { temp.children = [temp]; temp.name = name; return temp; } else { enum errName = " (" ~ getName!(r)() ~")"; failedLength[i] = temp.end; if (temp.end >= longestFail.end) { maxFailedLength = temp.end; longestFail = temp; names[i] = errName; results[i] = temp; if (temp.end == longestFail.end) errorStringChars += temp.matches[$-1].length + errName.length + 4; else errorStringChars = temp.matches[$-1].length + errName.length + 4; } // Else, this error parsed less input than another one: we discard it. } } // All subrules failed, we will take the longest match as the result // If more than one node failed at the same (farthest) position, we concatenate their error messages char[] errString;// = new char[](errorStringChars); errString.length = errorStringChars; uint start = 0; foreach(i; 0..rules.length) { if (failedLength[i] == maxFailedLength) { auto temp = results[i]; auto len = temp.matches[$-1].length; auto nlen = names[i].length; errString[start .. start+len] = temp.matches[$-1][]; errString[start+len .. start+len+names[i].length] = names[i][]; errString[start+len+nlen .. start+len+nlen+4] = " or "; start += len + names[i].length + 4; } } orErrorString = cast(string)(errString[0..$-4]); longestFail.matches = longestFail.matches[0..$-1] // discarding longestFail error message ~ [orErrorString]; // and replacing it by the new, concatenated one. longestFail.name = name; longestFail.begin = p.end; return longestFail; } ParseTree or(string input) { return .or!(rules)(ParseTree("",false,[],input)); } string or(GetName g) { return name; } } unittest // 'or' unit test { alias charRange!('a','b') ab; alias charRange!('c','d') cd; alias or!(ab) abOr; alias or!(ab,cd) abOrcd; assert(getName!(ab)() == "charRange!('a','b')"); assert(getName!(cd)() == "charRange!('c','d')"); ParseTree input = ParseTree("",false,[], "abcdefghi"); ParseTree result = abOr(input); assert(result.name == "or!(charRange!('a','b'))", "or name test."); assert(result.successful, "or!([a-b]) parses 'abcdefghi'"); assert(result.matches == ["a"], "or!([a-b]) matches 'a' at the beginning of 'abcdefghi'"); assert(result.end == input.end+1, "or!([a-b]) advances the index by 'a' size (1)."); assert(result.children == [ab(input)], "or!([a-b]) has one child: the one created by '[a-b]'."); result = abOrcd(input); assert(result.name == "or!(charRange!('a','b'), charRange!('c','d'))", "or name test."); assert(result.successful, "or!([a-b],[c-d]) parses 'abcdefghi'"); assert(result.matches == ["a"], "or!([a-b],[c-d]) matches 'a' at the beginning of 'abcdefghi'"); assert(result.end == input.end+1, "or!([a-b],[c-d]) advances the index by 1 position."); assert(result.children == [ab(input)], "or!([a-b],[c-d]) has one child, created by [a-b]."); input.input = "cdefghi"; result = abOrcd(input); assert(result.name == "or!(charRange!('a','b'), charRange!('c','d'))", "or name test."); assert(result.successful, "or!([a-b],[c-d]) parses 'cdefghi'"); assert(result.matches == ["c"], "or!([a-b],[c-d]) matches 'c' at the beginning of 'cdefghi'"); assert(result.end == input.end+1, "or!([a-b],[c-d]) advances the index by 1 position."); assert(result.children == [cd(input)], "or!([a-b],[c-d]) has one child, created by [c-d]."); input.input = "_abcdefghi"; result = abOrcd(input); assert(!result.successful, "or!([a-b],[c-d]) fails on '_abcdefghi'"); assert(result.end == input.end+0, "or!([a-b],[c-d]) does not advance the index."); assert(result.matches == [ "a char between 'a' and 'b' (charRange!('a','b')) or a char between 'c' and 'd' (charRange!('c','d'))"] , "or!([a-b],[c-d]) error message. |" ~ result.matches[0]~ "|"); input.input = ""; result = abOrcd(input); assert(!result.successful, "or!([a-b],[c-d]) fails on and empty input"); assert(result.end == input.end+0, "or!([a-b],[c-d]) does not advance the index."); assert(result.matches == [ "a char between 'a' and 'b' (charRange!('a','b')) or a char between 'c' and 'd' (charRange!('c','d'))"] , "or!([a-b],[c-d]) error message."); } /** Compile-time switch trie from Brian Schott */ class Trie(V) : TrieNode!(V) { /** * Adds the given value to the trie with the given key */ void add(string key, V value) pure { TrieNode!(V) current = this; foreach(dchar keyPart; key) { if ((keyPart in current.children) is null) { auto node = new TrieNode!(V); current.children[keyPart] = node; current = node; } else current = current.children[keyPart]; } current.value = value; } } class TrieNode(V) { V value; TrieNode!(V)[dchar] children; } string printCaseStatements(V)(TrieNode!(V) node, string indentString) { string s = ""; string idnt = indentString; void incIndent() { idnt ~= " "; } void decIndent() { idnt = idnt[2..$]; } void put(string k) { s ~= idnt ~ k; } void append(string k) { s ~= k;} foreach(dchar k, TrieNode!(V) v; node.children) { put("case '"); switch(k) { case '\n': append("\\n"); break; case '\t': append("\\t"); break; case '\r': append("\\r"); break; case 92: append("\\"); break; default: append(to!string(k)); } append("':\n"); incIndent(); put("temp.end++;\n"); if (v.children.length > 0) { put("if (temp.end >= temp.input.length)\n"); put("{\n"); incIndent(); if (node.children[k].value.length != 0) put("return ParseTree(name, true, [`" ~ node.children[k].value ~ "`], temp.input, p.end, temp.end)"); else put("return ParseTree(name, false, [failString], p.input, p.end, p.end)"); append(";\n"); decIndent(); put("}\n"); put("switch (temp.input[temp.end])\n"); put("{\n"); incIndent(); append(printCaseStatements(v, idnt)); put("default:\n"); incIndent(); if (v.value.length != 0) put("return ParseTree(name, true, [`" ~ v.value ~ "`], temp.input, p.end, temp.end)"); else put("return ParseTree(name, false, [failString], p.input, p.end, p.end)"); append(";\n"); decIndent(); decIndent(); put("}\n"); } else { if (v.value.length != 0) put("return ParseTree(name, true, [`" ~ v.value ~ "`], temp.input, p.end, temp.end)"); else put("return ParseTree(name, false, [failString], p.input, p.end, p.end)"); append(";\n"); } } return s; } string generateCaseTrie(string[] args ...) { auto t = new Trie!(string); foreach(arg; args) { t.add(arg, arg); } return printCaseStatements(t, ""); } /** or special case for literal list ("abstract"/"alias"/...) */ template keywords(kws...) if (kws.length > 0) { string ctfeGetNameKeywords() { string name= "keywords!("; foreach(i,kw;kws) name ~= "\"" ~ kw ~ "\""~ (i < kws.length -1 ? ", " : ""); name ~= ")"; return name; } string ctfeConcatKeywords() { string s = "["; foreach(i, k; kws) { s ~= "\"" ~ k ~ "\""; if (i < kws.length - 1) s ~= ", "; } return s ~= "]"; } enum name = ctfeGetNameKeywords(); enum failString = "one among " ~ ctfeConcatKeywords(); ParseTree keywords(ParseTree p) { string keywordCode(string[] keywords) { string result; foreach(kw; keywords) result ~= "if (p.end+"~to!string(kw.length) ~ " <= p.input.length " ~" && p.input[p.end..p.end+"~to!string(kw.length)~"]==`" ~kw~"`) return ParseTree(`" ~name~"`,true,[`"~kw~"`],p.input,p.end,p.end+" ~to!string(kw.length)~");\n"; result ~= "return ParseTree(`"~name~"`,false,[`" ~ failString ~ "`],p.input,p.end,p.end);"; return result; } static if (KEYWORDS == IFCHAIN) { mixin(keywordCode([kws])); } else static if (KEYWORDS == TRIE) { auto temp = p; if (p.end < p.input.length) // is this conditional required? { switch(p.input[p.end]) { mixin(generateCaseTrie([kws])); mixin("default: return ParseTree(`"~name~"`,false,[`" ~ failString ~ "`],p.input,p.end,p.end);"); } } else { mixin("return ParseTree(`"~name~"`,false,[`" ~ failString ~ "`],p.input,p.end,p.end);"); } } } ParseTree keywords(string input) { return .keywords!(kws)(ParseTree("",false,[],input)); } string keywords(GetName g) { return name; } } unittest { alias keywords!("abc","de","f") kw; assert(getName!(kw)() == `keywords!("abc", "de", "f")`); ParseTree input = ParseTree("",false,[],"abcd"); ParseTree result = kw(input); assert(result.name == `keywords!("abc", "de", "f")`, "keywords name test."); assert(result.successful, "keywords success on `abcd`"); assert(result.matches == ["abc"], "keywords matches `abc` on `abcd`"); assert(result.end == input.end+3, "keywords advances the index by 3 positions."); assert(result.children is null, "No children for `keywords`."); input.input = "def"; result = kw(input); assert(result.successful, "keywords success on `def`"); assert(result.matches == ["de"], "keywords matches `de` on `def`"); assert(result.end == input.end+2, "keywords advances the index by 2 positions."); assert(result.children is null, "No children for `keywords`."); input.input = "ab_def"; result = kw(input); assert(!result.successful, "keywords fails on `ab_def`."); assert(result.matches == [`one among ["abc", "de", "f"]`], "keywords error message." ~ result.matches[0]); assert(result.end == input.end, "keywords does not advance the index."); assert(result.children is null, "No children for `keywords`."); input.input = ""; result = kw(input); assert(!result.successful, "keywords fails on an empty input."); assert(result.matches == [`one among ["abc", "de", "f"]`], "keywords error message."); assert(result.end == input.end, "keywords does not advance the index."); assert(result.children is null, "No children for `keywords`."); } /** Tries to match subrule 'r' zero or more times. It always succeeds, since if 'r' fails from the very beginning, it matched 'r' zero times... Its matches are those of its subrules (they might be different for each match) and its children are all the parse trees returned by the successive application of 'r'. ---- alias zeroOrMore!(or!(literal!"abc", literal!"d")) rule; // in PEG-speak: '("abc" / "d")*' ParseTree input = ParseTree("",false,[], "abcdabce"); ParseTree result = rule(input); assert(result.successful); assert(result.matches == ["abc", "d", "abc"]); assert(result.end == 7); // matched "abcdabce"[0..7] => "abcdabc". "e" at the end is not part of the parse tree. assert(result.children.length == 3); writeln(result); /+ writes: zeroOrMore [0, 7]["abc", "d", "abc"] +-or [0, 3]["abc"] | +-literal(abc) [0, 3]["abc"] +-or [3, 4]["d"] | +-literal(d) [3, 4]["d"] +-or [4, 7]["abc"] +-literal(abc) [4, 7]["abc"] +/ ---- So we know the first child used the 'literal!"abc"' sub-rule and matched input[0..3]. The second matched input[3..4] and the third input[4..7]. ---- input = ParseTree("",false,[], "efgh"); result = rule(input); assert(result.successful); // succeed, even though all patterns failed. assert(result.children.length == 0); ---- */ template zeroOrMore(alias r) { enum name = "zeroOrMore!(" ~ getName!(r) ~ ")"; ParseTree zeroOrMore(ParseTree p) { auto result = ParseTree(name, true, [], p.input, p.end, p.end); auto temp = r(result); while(temp.successful && (temp.begin < temp.end // To avoid infinite loops on epsilon-matching rules || temp.name.startsWith("discard!("))) { result.matches ~= temp.matches; result.children ~= temp; result.end = temp.end; temp = r(result); } result.successful = true; return result; } ParseTree zeroOrMore(string input) { return .zeroOrMore!(r)(ParseTree("",false,[],input)); } string zeroOrMore(GetName g) { return name; } } unittest // 'zeroOrMore' unit test { alias literal!"a" a; alias literal!"abc" abc; alias charRange!('a','z') az; alias zeroOrMore!(a) as; alias zeroOrMore!(abc) abcs; alias zeroOrMore!(az) azs; assert(getName!(as)() == `zeroOrMore!(literal!("a"))`); assert(getName!(abcs)() == `zeroOrMore!(literal!("abc"))`); assert(getName!(azs)() == `zeroOrMore!(charRange!('a','z'))`); assert(as("").successful); assert(as("a").successful); assert(as("aa").successful); assert(as("aaa").successful); assert(as("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").successful); assert(as("b").successful); ParseTree result = as("aaa"); assert(result.name == `zeroOrMore!(literal!("a"))`); assert(result.successful); assert(result.matches == ["a","a","a"]); assert(result.begin == 0); assert(result.end == 3); assert(result.children.length == 3); assert(result.children == [ a("aaa"), a(a("aaa")), a(a(a("aaa")))]); assert(abcs("").successful); assert(abcs("abc").successful); assert(abcs("abcabc").successful); assert(abcs("abcabcabc").successful); assert(abcs("abcabcabcabcabcabcabcabcabcabcabcabcabcabcabc").successful); assert(abcs("ab").successful); result = abcs("abcabcabc"); assert(result.name == `zeroOrMore!(literal!("abc"))`); assert(result.successful); assert(result.matches == ["abc","abc","abc"]); assert(result.begin == 0); assert(result.end == 3*3); assert(result.children.length == 3); assert(result.children == [ abc("abcabcabc"), abc(abc("abcabcabc")), abc(abc(abc("abcabcabc")))]); assert(azs("").successful); assert(azs("a").successful); assert(azs("abc").successful); assert(azs("abcdefghijklmnoqrstuvwxyz").successful); assert(azs("abcdefghijklmnoqrstuvwxyz 1234567890").successful); result = azs("abc"); assert(result.name == `zeroOrMore!(charRange!('a','z'))`); assert(result.successful); assert(result.matches == ["a","b","c"]); assert(result.begin == 0); assert(result.end == 3); assert(result.children.length == 3); assert(result.children == [ az("abc"), az(az("abc")), az(az(az("abc")))]); } /** Tries to match subrule 'r' one or more times. If 'r' fails from the very beginning, it fails and else succeeds. Its matches are those of its subrules (they might be different for each match) and its children are all the parse trees returned by the successive application of 'r'. ---- alias oneOrMore!(or!(literal!"abc", literal!"d")) rule; // in PEG-speak: '("abc" / "d")*' ParseTree input = ParseTree("",false,[], "abcdabce"); ParseTree result = rule(input); assert(result.successful); assert(result.matches == ["abc", "d", "abc"]); assert(result.end == 7); // matched "abcdabce"[0..7] => "abcdabc". "e" at the end is not part of the parse tree. assert(result.children.length == 3); writeln(result); /+ writes: oneOrMore [0, 7]["abc", "d", "abc"] +-or [0, 3]["abc"] | +-literal(abc) [0, 3]["abc"] +-or [3, 4]["d"] | +-literal(d) [3, 4]["d"] +-or [4, 7]["abc"] +-literal(abc) [4, 7]["abc"] +/ ---- So we know the first child used the 'literal!"abc"' sub-rule and matched input[0..3]. The second matched input[3..4] and the third input[4..7]. ---- input = ParseTree("",false,[], "efgh"); result = rule(input); assert(!result.successful); // fails, since it failed on the first try. ---- */ template oneOrMore(alias r) { enum name = "oneOrMore!(" ~ getName!(r) ~ ")"; ParseTree oneOrMore(ParseTree p) { auto result = ParseTree(name, false, [], p.input, p.end, p.end); auto temp = r(result); if (!temp.successful) { result.matches = temp.matches; result.children = [temp]; result.end = temp.end; } else { while( temp.successful && (temp.begin < temp.end // To avoid infinite loops on epsilon-matching rules || temp.name.startsWith("discard!("))) { result.matches ~= temp.matches; result.children ~= temp; result.end = temp.end; temp = r(result); } result.successful = true; } return result; } ParseTree oneOrMore(string input) { return .oneOrMore!(r)(ParseTree("",false,[],input)); } string oneOrMore(GetName g) { return name; } } unittest // 'oneOrMore' unit test { alias literal!"a" a; alias literal!"abc" abc; alias charRange!('a','z') az; alias oneOrMore!(a) as; alias oneOrMore!(abc) abcs; alias oneOrMore!(az) azs; assert(getName!(as)() == `oneOrMore!(literal!("a"))`); assert(getName!(abcs)() == `oneOrMore!(literal!("abc"))`); assert(getName!(azs)() == `oneOrMore!(charRange!('a','z'))`); assert(!as("").successful); assert(as("a").successful); assert(as("aa").successful); assert(as("aaa").successful); assert(as("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").successful); assert(!as("b").successful); ParseTree result = as("aaa"); assert(result.name == `oneOrMore!(literal!("a"))`); assert(result.successful); assert(result.matches == ["a","a","a"]); assert(result.begin == 0); assert(result.end == 3); assert(result.children.length == 3); assert(result.children == [ a("aaa"), a(a("aaa")), a(a(a("aaa")))]); assert(!abcs("").successful); assert(abcs("abc").successful); assert(abcs("abcabc").successful); assert(abcs("abcabcabc").successful); assert(abcs("abcabcabcabcabcabcabcabcabcabcabcabcabcabcabc").successful); assert(!abcs("ab").successful); result = abcs("abcabcabc"); assert(result.name == `oneOrMore!(literal!("abc"))`); assert(result.successful); assert(result.matches == ["abc","abc","abc"]); assert(result.begin == 0); assert(result.end == 3*3); assert(result.children.length == 3); assert(result.children == [ abc("abcabcabc"), abc(abc("abcabcabc")), abc(abc(abc("abcabcabc")))]); assert(!azs("").successful); assert(azs("a").successful); assert(azs("abc").successful); assert(azs("abcdefghijklmnoqrstuvwxyz").successful); assert(azs("abcdefghijklmnoqrstuvwxyz 1234567890").successful); assert(!azs(".").successful); result = azs("abc"); assert(result.name == `oneOrMore!(charRange!('a','z'))`); assert(result.successful); assert(result.matches == ["a","b","c"]); assert(result.begin == 0); assert(result.end == 3); assert(result.children.length == 3); assert(result.children == [ az("abc"), az(az("abc")), az(az(az("abc")))]); } /** Given a subrule 'r', represents the expression 'r?'. It tries to match 'r' and if this matches successfully, it returns this match. If 'r' failed, 'r?' is still a success, but without any child nor match. ---- alias option!(literal!"abc") rule; // Aka '"abc"?' ParseTree input = ParseTree("",false,[],"abcd"); ParseTree result = rule(input); assert(result.successful); assert(result.matches == ["abc"]); assert(result.children.length == 1); assert(result.children[0] == literal!"abc"(input)); ---- */ template option(alias r) { enum name = "option!(" ~ getName!(r) ~ ")"; ParseTree option(ParseTree p) { ParseTree result = r(p); if (result.successful) return ParseTree(name, true, result.matches, result.input, result.begin, result.end, [result]); else return ParseTree(name, true, [], p.input, p.end, p.end, null); } ParseTree option(string input) { return .option!(r)(ParseTree("",false,[],input)); } string option(GetName g) { return name; } } unittest // 'option' unit test { alias literal!"a" a; alias literal!"abc" abc; alias option!(a) a_; alias option!(abc) abc_; assert(getName!(a_)() == `option!(literal!("a"))`); assert(getName!(abc_)() == `option!(literal!("abc"))`); assert(a_("").successful); assert(a_("a").successful); assert(a_("aa").successful); assert(a_("b").successful); ParseTree result = a_("a"); assert(result.name == `option!(literal!("a"))`); assert(result.successful); assert(result.matches == ["a"]); assert(result.begin == 0); assert(result.end == 1); assert(result.children.length == 1); assert(result.children == [ a("a")]); result = a_(""); assert(result.name == `option!(literal!("a"))`); assert(result.successful); assert(result.matches is null); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); assert(abc_("").successful); assert(abc_("abc").successful); assert(abc_("abcabc").successful); assert(abc_("ab").successful); result = abc_("abcdef"); assert(result.name == `option!(literal!("abc"))`); assert(result.successful); assert(result.matches == ["abc"]); assert(result.begin == 0); assert(result.end == 3); assert(result.children.length == 1); assert(result.children == [ abc("abcdef")]); result = abc_("def"); assert(result.name == `option!(literal!("abc"))`); assert(result.successful); assert(result.matches is null); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); } /** Tries 'r' on the input. If it succeeds, the rule also succeeds, without consuming any input. If 'r' fails, then posLookahead!r also fails. Low-level implementation of '&r'. */ template posLookahead(alias r) { enum name = "posLookahead!(" ~ getName!(r) ~ ")"; ParseTree posLookahead(ParseTree p) { ParseTree temp = r(p); if (temp.successful) return ParseTree(name, temp.successful, [], p.input, p.end, p.end); else return ParseTree(name, temp.successful, [temp.matches[$-1]], p.input, p.end, p.end); } ParseTree posLookahead(string input) { return .posLookahead!(r)(ParseTree("",false,[],input)); } string posLookahead(GetName g) { return name; } } unittest // 'posLookahead' unit test { alias literal!"a" a; alias literal!"abc" abc; alias posLookahead!(a) a_; alias posLookahead!(abc) abc_; assert(getName!(a_)() == `posLookahead!(literal!("a"))`); assert(getName!(abc_)() == `posLookahead!(literal!("abc"))`); assert(!a_("").successful); assert(a_("a").successful); assert(a_("aa").successful); assert(!a_("b").successful); ParseTree result = a_("a"); assert(result.name == `posLookahead!(literal!("a"))`); assert(result.successful); assert(result.matches is null); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); result = a_(""); assert(result.name == `posLookahead!(literal!("a"))`); assert(!result.successful); assert(result.matches == [`"a"`], "posLookahead error message."); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); assert(!abc_("").successful); assert(abc_("abc").successful); assert(abc_("abcabc").successful); assert(!abc_("ab").successful); result = abc_("abcdef"); assert(result.name == `posLookahead!(literal!("abc"))`); assert(result.successful); assert(result.matches is null); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); result = abc_("def"); assert(result.name == `posLookahead!(literal!("abc"))`); assert(!result.successful); assert(result.matches == [`"abc"`], "posLookahead error message."); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); } /** Tries 'r' on the input. If it fails, the rule succeeds, without consuming any input. If 'r' succeeds, then negLookahead!r fails. Low-level implementation of '!r'. */ template negLookahead(alias r) { enum name = "negLookahead!(" ~ getName!(r) ~ ")"; ParseTree negLookahead(ParseTree p) { ParseTree temp = r(p); if (temp.successful) return ParseTree(name, false, ["anything but \"" ~ p.input[temp.begin..temp.end] ~ "\""], p.input, p.end, p.end); else return ParseTree(name, true, [], p.input, p.end, p.end); } ParseTree negLookahead(string input) { return .negLookahead!(r)(ParseTree("",false,[],input)); } string negLookahead(GetName g) { return name; } } unittest // 'negLookahead' unit test { alias literal!"a" a; alias literal!"abc" abc; alias negLookahead!(a) a_; alias negLookahead!(abc) abc_; assert(getName!(a_)() == `negLookahead!(literal!("a"))`); assert(getName!(abc_)() == `negLookahead!(literal!("abc"))`); assert(a_("").successful); assert(!a_("a").successful); assert(!a_("aa").successful); assert(a_("b").successful); ParseTree result = a_("a"); assert(result.name == `negLookahead!(literal!("a"))`); assert(!result.successful); assert(result.matches == [`anything but "a"`]); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); result = a_(""); assert(result.name == `negLookahead!(literal!("a"))`); assert(result.successful); assert(result.matches is null); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); assert(abc_("").successful); assert(!abc_("abc").successful); assert(!abc_("abcabc").successful); assert(abc_("ab").successful); result = abc_("abcdef"); assert(result.name == `negLookahead!(literal!("abc"))`); assert(!result.successful); assert(result.matches == [`anything but "abc"`]); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); result = abc_("def"); assert(result.name == `negLookahead!(literal!("abc"))`); assert(result.successful); assert(result.matches is null); assert(result.begin == 0); assert(result.end == 0); assert(result.children.length == 0); } /** Internal helper template, to get a parse tree node with a name. For example, given: ---- alias or!(literal!("abc"), charRange!('0','9')) myRule; ---- myRule gives nodes named "or", since its the parent rule. If you want nodes to be named "myRule": ---- alias named!( or!(literal!("abc"), charRange!('0','9')), "myRule" ) myRule; ---- */ template named(alias r, string name) { ParseTree named(ParseTree p) { ParseTree result = r(p); result.name = name; return result; } ParseTree named(string input) { return .named!(r,name)(ParseTree("",false,[],input)); } string named(GetName g) { return name; } } unittest // 'named' unit test { alias or!(literal!("abc"), charRange!('0','9')) rule; alias named!(rule, "myRule") myRule; assert(getName!(rule)() == `or!(literal!("abc"), charRange!('0','9'))`); assert(getName!(myRule)() == "myRule"); // Equality on success (except for the name) ParseTree result = rule("abc0"); ParseTree myResult = myRule("abc0"); assert(myResult.successful == result.successful); assert(myResult.name == "myRule"); assert(myResult.matches == result.matches); assert(myResult.begin == result.begin); assert(myResult.end == result.end); assert(myResult.children == result.children); // Equality on failure (except for the name) result = rule("_abc"); myResult = myRule("_abc"); assert(myResult.successful == result.successful); assert(myResult.name == "myRule"); assert(myResult.matches == result.matches); assert(myResult.begin == result.begin); assert(myResult.end == result.end); assert(myResult.children == result.children); } /** Low-level representation for the expression 'r {act}'. That is, it applies rule 'r' on the input and then calls 'act' on the resulting ParseTree. */ template action(alias r, alias act) { ParseTree action(ParseTree p) { return act(r(p)); } ParseTree action(string input) { return .action!(r,act)(ParseTree("",false,[],input)); } string action(GetName g) { enum name = "action!("~ getName!(r)() ~ ", " ~ __traits(identifier, act) ~ ")"; return name; } } unittest // 'action' unit test { ParseTree foo(ParseTree p) { p.matches ~= p.matches; // doubling matches return p; } alias literal!("abc") abc; alias action!(abc, foo) abcfoo; assert(getName!(abcfoo) == `action!(literal!("abc"), foo)`); ParseTree result = abcfoo("abc"); ParseTree reference = abc("abc"); assert(result.successful == reference.successful); assert(result.successful); assert(result.matches == reference.matches ~ reference.matches); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children == reference.children); // On failure result = abcfoo("_abc"); reference = abc("_abc"); assert(result.successful == reference.successful); assert(!result.successful); assert(result.matches == reference.matches ~ reference.matches); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children == reference.children); } /** Concatenates a ParseTree's matches as one match and discards its children. Equivalent to the expression '~r'. */ template fuse(alias r) { ParseTree fuse(ParseTree p) { p = r(p); if(p.successful) { if (p.matches.length != 0) p.matches = [std.array.join(p.matches)]; p.children = null; // also discard children } return p; } ParseTree fuse(string input) { return .fuse!(r)(ParseTree("",false,[],input)); } string fuse(GetName g) { enum name = "fuse!(" ~ getName!(r)() ~ ")"; return name; } } unittest // 'fuse' unit test { alias oneOrMore!(literal!("abc")) abcs; alias fuse!(abcs) f; assert(getName!(f) == `fuse!(oneOrMore!(literal!("abc")))`); ParseTree result = f("abcabcabc"); ParseTree reference = abcs("abcabcabc"); assert(result.successful == reference.successful); assert(result.successful); assert(reference.matches == ["abc", "abc", "abc"]); assert(result.matches == ["abcabcabc"]); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); // On failure result = f("_abc"); reference = abcs("_abc"); assert(result.successful == reference.successful); assert(!result.successful); assert(result.matches == reference.matches); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children == reference.children); alias discard!(literal!("abc")) dabc; alias fuse!(dabc) f2; result = f2("abcabc"); reference = dabc("abcabc"); assert(result.successful); assert(result.matches is null); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children == reference.children); } /** Calls 'r' on the input and then discards its children nodes. */ template discardChildren(alias r) { ParseTree discardChildren(ParseTree p) { p = r(p); p.children = null; return p; } ParseTree discardChildren(string input) { return .discardChildren!(r)(ParseTree("",false,[],input)); } string discardChildren(GetName g) { enum name = "discardChildren!(" ~ getName!(r)() ~ ")"; return name; } } /** Calls 'r' on the input and then discards its matches. */ template discardMatches(alias r) { ParseTree discardMatches(ParseTree p) { p = r(p); if (p.successful) p.matches = null; return p; } ParseTree discardMatches(string input) { return .discardMatches!(r)(ParseTree("",false,[],input)); } string discardMatches(GetName g) { enum name = "discardMatches!(" ~ getName!(r)() ~ ")"; return name; } } /** Calls 'r' on the input and then discard everything 'r' returned: no children, no match and index put at the end of the match. It's the low-level engine behind ':r'. */ template discard(alias r) { ParseTree discard(ParseTree p) { ParseTree result = r(p); result.name = "discard!(" ~ getName!(r)() ~ ")"; //result.begin = result.end; result.children = null; if (result.successful) result.matches = null;//to keep error messages, if any return result; } ParseTree discard(string input) { return .discard!(r)(ParseTree("",false,[],input)); } string discard(GetName g) { return "discard!(" ~ getName!(r)() ~ ")"; } } unittest // 'discard' unit test { alias literal!"abc" abc; alias oneOrMore!abc abcs; alias discard!(literal!("abc")) dabc; alias discard!(oneOrMore!(literal!("abc")))dabcs; ParseTree reference = abc("abc"); ParseTree result =dabc("abc"); assert(result.successful == reference.successful); assert(result.successful); assert(result.name == `discard!(literal!("abc"))`); assert(result.matches is null); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); reference = abcs("abcabcabc"); result = dabcs("abcabcabc"); assert(result.successful == reference.successful); assert(result.successful); assert(result.name == `discard!(oneOrMore!(literal!("abc")))`); assert(result.matches is null); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); // On failure reference = abcs(""); result = dabcs(""); assert(result.successful == reference.successful); assert(!result.successful); assert(result.name == `discard!(oneOrMore!(literal!("abc")))`); assert(result.matches == [`"abc"`], "discard error message."); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); // Action on 'and' alias and!(abc,dabc,abc) discardMiddle; result = discardMiddle("abcabcabc"); assert(result.successful); assert(result.matches == ["abc", "abc"]); assert(result.begin == 0); assert(result.end == 3*3); assert(result.children.length == 2); assert(result.children == [abc("abcabcabc"), abc(abc(abc("abcabcabc")))]); } /** Calls 'r' on the input and then discards everything 'r' did, except its matches (so that they propagate upwards). Equivalent to ';r'. */ template drop(alias r) { ParseTree drop(ParseTree p) { ParseTree result = r(p); //result.begin = result.end; result.children = null; if (result.successful) result.name = "drop!(" ~ getName!(r)() ~ ")"; return result; } ParseTree drop(string input) { return .drop!(r)(ParseTree("",false,[],input)); } string drop(GetName g) { return "drop!(" ~ getName!(r)() ~ ")"; } } unittest // 'drop' unit test { alias literal!"abc" abc; alias oneOrMore!abc abcs; alias drop!(literal!("abc")) dabc; alias drop!(oneOrMore!(literal!("abc"))) dabcs; ParseTree reference = abc("abc"); ParseTree result =dabc("abc"); assert(result.successful == reference.successful); assert(result.successful); assert(result.name == `drop!(literal!("abc"))`); assert(result.matches == reference.matches); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); reference = abcs("abcabcabc"); result = dabcs("abcabcabc"); assert(result.successful == reference.successful); assert(result.successful); assert(result.name == `drop!(oneOrMore!(literal!("abc")))`); assert(result.matches == reference.matches); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); // On failure reference = abcs(""); result = dabcs(""); assert(result.successful == reference.successful); assert(!result.successful); assert(result.name == reference.name); assert(result.matches == [`"abc"`], "'drop' error message."); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children is null); // Action on 'and' alias and!(abc,dabc,abc) discardMiddle; result = discardMiddle("abcabcabc"); assert(result.successful); assert(result.matches == ["abc", "abc", "abc"], "3 matches."); assert(result.begin == 0); assert(result.end == 3*3); assert(result.children.length == 2, "but only 2 children."); assert(result.children == [abc("abcabcabc"), abc(abc(abc("abcabcabc")))]); } /** Makes r disappear in a sequence, letting its children take its place. It's equivalent to the '%' operator. Given A <- B %C D and C <- E F, a successful parse for A will generate a three with four children: B, E, F and D parse trees. */ template propagate(alias r) { ParseTree propagate(ParseTree p) { ParseTree result = r(p); if (result.successful) result.name = "propagate!(" ~ getName!(r)() ~ ")"; return result; } ParseTree propagate(string input) { return .propagate!(r)(ParseTree("",false,[],input)); } string propagate(GetName g) { return "propagate!(" ~ getName!(r)() ~ ")"; } } /** Makes 'r's result be kept when it would be discarded by the tree-decimation done by a grammar. Equivalent to '^r'. */ template keep(alias r) { ParseTree keep(ParseTree p) { ParseTree result = r(p); if (result.successful) { result.children = [result]; result.name = "keep!(" ~ getName!(r)() ~ ")"; } return result; } ParseTree keep(string input) { return .keep!(r)(ParseTree("",false,[],input)); } string keep(GetName g) { return "keep!(" ~ getName!(r)() ~ ")"; } } unittest // 'keep' unit test { // Grammar mimicry struct KeepTest { static bool isRule(string s) { if (s == "A" || s == "KA") return true; else return false; } mixin decimateTree; // Equivalent to A <- 'a' 'b' static ParseTree A(string s) { return decimateTree(named!(and!(literal!"a", literal!"b"), "A")(s)); } // Here we use keep to protect 'b' // Equivalent to KA <- 'a' ^'b' static ParseTree KA(string s) { return decimateTree(named!(and!(literal!"a", keep!(literal!"b")), "KA")(s)); } } ParseTree reference = KeepTest.A("abc"); ParseTree result = KeepTest.KA("abc"); assert(result.successful == reference.successful); assert(result.matches == reference.matches); assert(result.matches == ["a","b"]); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(reference.children.length == 0); assert(result.children.length == 1); assert(result.children == [literal!("b")(literal!("a")("abc"))], "'b' node was kept."); } /* ****************** predefined rules ******************** */ alias named!(or!(literal!("\r\n"), literal!("\n"), literal!("\r")), "endOfLine") endOfLine; /// predefined end-of-line parser alias endOfLine eol; /// helper alias. alias or!(literal!(" "), literal!("\t"), literal!("\v")) space; /// predefined space-recognizing parser (space or tabulation). alias named!(literal!"\t", "tab") tab; /// A parser recognizing \t (tabulation) alias named!(fuse!(discardChildren!(oneOrMore!space)), "spaces") spaces; /// aka '~space+' alias or!(space, endOfLine) blank; /// Any blank char (spaces or end of line). alias named!(discard!(zeroOrMore!blank), "spacing") spacing; /// The basic space-management parser: discard zero or more blank spaces. alias charRange!('0', '9') digit; /// Decimal digit: [0-9] alias named!(fuse!(discardChildren!(oneOrMore!digit)), "digits") digits; /// [0-9]+ alias or!(charRange!('0','9'), charRange!('a','f'), charRange!('A', 'F')) hexDigit; /// Hexadecimal digit: [0-9a-fA-F] alias charRange!('a', 'z') alpha; /// [a-z] alias charRange!('A', 'Z') Alpha; /// [A-Z] alias and!(oneOrMore!(or!(alpha, Alpha, literal!("_"))), zeroOrMore!(or!(digit, alpha, Alpha, literal!("_")))) ident; alias named!(fuse!(discardChildren!ident), "identifier") identifier; /// [a-zA-Z_][a-zA-Z_0-9]*, the basic C-family identifier alias named!(fuse!(discardChildren!(and!(identifier, zeroOrMore!(and!(literal!".", identifier))))), "qualifiedIdentifier") qualifiedIdentifier; /// qualified identifiers (ids separated by dots: abd.def.g). alias named!(literal!"/", "slash") slash; /// A parser recognizing '/' alias named!(literal!"\\", "backslash") backslash; /// A parser recognizing '\' alias named!(literal!"'", "quote") quote; /// A parser recognizing ' (single quote) alias named!(literal!"\"", "doublequote") doublequote; /// A parser recognizing " (double quote) alias named!(literal!"`", "backquote") backquote; /// A parser recognizing ` (backquote) /// A list of elem's separated by sep's. One element minimum. template list(alias elem, alias sep) { alias named!(spaceAnd!(oneOrMore!blank, and!(elem, zeroOrMore!(spaceAnd!(discardMatches!(sep), elem)))), "list") list; } /// A list of elem's separated by sep's. The empty list (no elem, no sep) is OK. template list0(alias elem, alias sep) { alias named!(spaceAnd!(oneOrMore!blank, option!(and!(elem, zeroOrMore!(spaceAnd!(discardMatches!(sep), elem))))), "list0") list0; } template AddSpace(alias sp) { template AddSpace(alias r) { alias TypeTuple!(r, discard!sp) AddSpace; } } /** The engine formerly behind the '< ' Pegged rule: all sequence subelements of a rule are interspersed with a space-consuming rule, given as the first template parameter. It's not used by Pegged anymore but can be useful for low-level code. It might become deprecated, but it's not there yet. ---- alias and!(literal!"abc", literal!"def") rule1; // "abc" "def", equivalent to "abcdef" alias spaceAnd!(oneOrMore!blank, literal!"abc", literal!"def") rule2; // "abc" "def", but with spaces in-between. string input1 = "abcdef"; string input2 = " abc def "; // with spaces and end of line markers. assert(rule1(input1).successful); // OK assert(!rule1(input2).successful); // NOK, couldn't find "def" after "abc" assert(rule2(input1).successful); // OK assert(rule2(input2).successful); // Still OK assert(rule2(input2).matches == ["abc","def"]);// rule2 finds the literals among the spaces ---- As you can see on the previous line, spaceAnd discards the matched spaces and returns matches only for the 'real' subrules. Note: by using a non-space rule as the first template argument, you can use spaceAnd as a generic 'find these patterns, possibly separated by this pattern' rule. For example, using digits as separators: ---- alias spaceAnd!(digit, literal!"abc", litera!"def") rule3; ParseTree result = rule3("123abc45def67890"); assert(rule3.successful); assert(rule3.matches == ["abc", "def"]); assert(rule3.children.length == 2); assert(rule3.begin == 0;) assert(rule3.end == "123abc45def67890".length); ---- */ template spaceAnd(alias sp, rules...) { alias and!(discard!(zeroOrMore!sp), staticMap!(AddSpace!(zeroOrMore!sp), rules)) spaceAnd; } unittest // 'spaceAnd' unit test { alias literal!"a" a; alias literal!"b" b; //Basic use alias and!(a,b) ab; alias spaceAnd!(oneOrMore!blank, a, b) a_b; ParseTree reference = ab("ab"); ParseTree result = a_b("ab"); assert(reference.successful); assert(result.successful); assert(result.matches == reference.matches); assert(result.begin == reference.begin); assert(result.end == reference.end); assert(result.children == reference.children); reference = ab(" a b "); result = a_b( " a b "); assert(!reference.successful); assert(result.successful); assert(result.matches == ["a","b"]); assert(result.begin == 0); assert(result.end == " a b ".length); assert(result.children.length == 2); reference = ab("ac"); result = a_b("ac"); assert(!reference.successful); assert(!result.successful); reference = ab(" a c "); result = a_b(" a c "); assert(!reference.successful); assert(!result.successful); // With another separator than spaces alias spaceAnd!(digit, a, b) a0b; assert(a0b("ab").successful); assert(!a0b(" a b ").successful); result = a0b("012a34b567"); assert(result.successful); assert(result.matches == ["a", "b"]); assert(result.begin == 0); assert(result.end == "012a34b567".length); assert(result.children.length == 2); } /// Mixin to simplify a parse tree inside a grammar mixin template decimateTree() { static ParseTree decimateTree(ParseTree p) { if(p.children.length == 0) return p; ParseTree[] filterChildren(ParseTree pt) { ParseTree[] result; foreach(child; pt.children) { if ( (isRule(child.name) && child.matches.length != 0) || !child.successful && child.children.length == 0) { child.children = filterChildren(child); result ~= child; } else if (child.name.startsWith("keep!(")) // 'keep' node are never discarded. // They have only one child, the node to keep { result ~= child.children[0]; } else // discard this node, but see if its children contain nodes to keep { result ~= filterChildren(child); } } return result; } p.children = filterChildren(p); return p; } } /** Discard one-child nodes and replace them with their children. Most grammar tend to produce long one-child/one-child branches, simplifyTree compacts these. */ ParseTree simplifyTree(ParseTree p) { foreach(ref child; p.children) child = simplifyTree(child); if (p.children.length != 1) return p; else // linear tree return p.children[0]; } /** Returns: the number of nodes in a parse tree. */ size_t size(ParseTree p) { size_t result = 1; foreach(child; p.children) result += size(child); return result; } /** Generic ParseTree modifier: predicate must be callable with a ParseTree and return a boolean. modifier must be callable with a ParseTree and return a ParseTree. If predicate is true on input, modify calls modifier on input and return the result. If not, it continues with the children. */ ParseTree modify(alias predicate, alias modifier)(ParseTree input) { foreach(ref child; input.children) child = modify!(predicate, modifier)(child); if (predicate(input)) input = modifier(input); return input; }
D
/** * @file qtm.h * @brief QTM service. */ module ctru.services.qtm; import ctru.types; extern (C): nothrow: @nogc: //See also: http://3dbrew.org/wiki/QTM_Services /// Head tracking coordinate pair. struct QTM_HeadTrackingInfoCoord { float x; ///< X coordinate. float y; ///< Y coordinate. } /// Head tracking info. struct QTM_HeadTrackingInfo { ubyte[5] flags; ///< Flags. ubyte[3] padding; ///< Padding. float floatdata_x08; ///< Unknown. Not used by System_Settings. QTM_HeadTrackingInfoCoord[4] coords0; ///< Head coordinates. uint[5] unk_x2c; ///< Unknown. Not used by System_Settings. } /// Initializes QTM. Result qtmInit(); /// Exits QTM. void qtmExit(); /** * @brief Checks whether QTM is initialized. * @return Whether QTM is initialized. */ bool qtmCheckInitialized(); /** * @brief Checks whether a head is fully detected. * @param info Tracking info to check. */ bool qtmCheckHeadFullyDetected(QTM_HeadTrackingInfo* info); /** * @brief Converts QTM coordinates to screen coordinates. * @param coord Coordinates to convert. * @param screen_width Width of the screen. Can be NULL to use the default value for the top screen. * @param screen_height Height of the screen. Can be NULL to use the default value for the top screen. * @param x Pointer to output the screen X coordinate to. * @param y Pointer to output the screen Y coordinate to. */ Result qtmConvertCoordToScreen(QTM_HeadTrackingInfoCoord* coord, float* screen_width, float* screen_height, uint* x, uint* y); /** * @brief Gets the current head tracking info. * @param val Normally 0. * @param out Pointer to write head tracking info to. */ Result QTM_GetHeadTrackingInfo(ulong val, QTM_HeadTrackingInfo* out_);
D
/Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Core.build/DispatchTime+Utilities.swift.o : /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/RFC1123.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String+Polymorphic.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Sequence.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Collection+Safe.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Cache.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Extendable.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/EmptyInitializable.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/DataFile.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String+CaseInsensitiveCompare.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Semaphore.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Dispatch.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Lock.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Portal.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/FileProtocol.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/StaticDataBuffer.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/DispatchTime+Utilities.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Bits.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Exports.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Result.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Int+Hex.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Array.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/WorkingDirectory.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/libc.swiftmodule /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Debugging.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 /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Bits.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/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/CHTTP.build/module.modulemap /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/CSQLite.build/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Core.build/DispatchTime+Utilities~partial.swiftmodule : /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/RFC1123.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String+Polymorphic.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Sequence.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Collection+Safe.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Cache.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Extendable.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/EmptyInitializable.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/DataFile.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String+CaseInsensitiveCompare.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Semaphore.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Dispatch.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Lock.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Portal.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/FileProtocol.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/StaticDataBuffer.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/DispatchTime+Utilities.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Bits.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Exports.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Result.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Int+Hex.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Array.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/WorkingDirectory.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/libc.swiftmodule /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Debugging.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 /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Bits.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/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/CHTTP.build/module.modulemap /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/CSQLite.build/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Core.build/DispatchTime+Utilities~partial.swiftdoc : /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/RFC1123.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String+Polymorphic.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Sequence.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Collection+Safe.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Cache.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Extendable.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/EmptyInitializable.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/DataFile.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String+CaseInsensitiveCompare.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Semaphore.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/String.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Dispatch.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Lock.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Portal.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/FileProtocol.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/StaticDataBuffer.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/DispatchTime+Utilities.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Bits.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Exports.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Result.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Int+Hex.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/Array.swift /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/checkouts/core.git-9210800844849382486/Sources/Core/WorkingDirectory.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/libc.swiftmodule /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Debugging.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 /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/Bits.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/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/CHTTP.build/module.modulemap /Users/huhuegg/Desktop/Source/VaporServer/XProject/.build/debug/CSQLite.build/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
module clients.feedsclient; import std.utf; import std.conv; import requests; import asdf; import models; import clients.baseclient; class FeedsClient: BaseClient { this(string baseUrl) { super(baseUrl); } public Page favorites(uint offset = 0, uint limit = 30) { return get(api ~ "/feeds/favorites?offset=" ~ to!string(offset) ~ "&limit=" ~ to!string(limit)).deserialize!(Page); } }
D
(computer science) a code for information exchange between computers made by different companies
D
module sdl2d.touch; import sdl2d.stdinc; //#include "SDL_error.h" import sdl2d.video; alias Sint64 SDL_TouchID; alias Sint64 SDL_FingerID; extern(C) struct SDL_Finger { SDL_FingerID id; Uint16 x; Uint16 y; Uint16 pressure; Uint16 xdelta; Uint16 ydelta; Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */ SDL_bool down; } //extern(C) struct SDL_Touch; //extern(C) struct SDL_Finger; extern(C) struct SDL_Touch { /* Free the touch when it's time */ void function(SDL_Touch* touch) FreeTouch; /* data common for tablets */ float pressure_max, pressure_min; float x_max, x_min; float y_max, y_min; Uint16 xres, yres, pressureres; float native_xres, native_yres, native_pressureres; float tilt_x; /* for future use */ float tilt_y; /* for future use */ float rotation; /* for future use */ /* Data common to all touch */ SDL_TouchID id; SDL_Window* focus; char *name; Uint8 buttonstate; SDL_bool relative_mode; SDL_bool flush_motion; int num_fingers; int max_fingers; SDL_Finger** fingers; void* driverdata; } /* Function prototypes */ /** * \brief Get the touch object at the given id. * * */ extern(C) SDL_Touch* SDL_GetTouch(SDL_TouchID id); /** * \brief Get the finger object of the given touch, at the given id. * * */ extern(C) SDL_Finger* SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
D
.source T_if_ltz_4.java .class public dot.junit.opcodes.if_ltz.d.T_if_ltz_4 .super java/lang/Object .method public <init>()V .limit regs 1 invoke-direct {v0}, java/lang/Object/<init>()V return-void .end method .method public run(D)I .limit regs 6 if-ltz v4, Label9 const/16 v4, 1234 return v4 Label9: const/4 v4, 1 return v4 .end method
D
/** * Loop on exceptions and continue whenever possible. * * Authors: dd86k <dd@dax.moe> * Copyright: © dd86k <dd@dax.moe> * License: BSD-3-Clause */ module ui.loop; import core.stdc.string : memcpy; import adbg.include.c.stdio; import adbg.v1.debugger; import adbg.v1.disassembler; import adbg.error; import common; //TODO: Consider moving this thing to "examples/" // Sub-package :example extern (C): /// Starts loop UI int app_loop() { if (adbg_state != AdbgStatus.ready) { puts("loop: No program loaded"); return 1; } if (adbg_disasm_init(&dism)) { printf("error: %s\n", adbg_error_msg); return adbg_errno; } if (globals.syntax && adbg_disasm_syntax(&dism, globals.syntax)) { printf("error: %s\n", adbg_error_msg); return adbg_errno; } return adbg_run(&loop_handler); } private: __gshared adbg_disasm_t dism; int loop_handler(exception_t *e) { __gshared uint ex_num; /// Exception number printf( "\n----------------------------------------\n"~ "* EXCEPTION #%u: %s ("~ADBG_OS_ERROR_FORMAT~")\n"~ "* PID=%u TID=%u\n", ex_num++, adbg_exception_string(e.type), e.oscode, e.pid, e.tid, ); // Print disassembly if available if (e.fault) { adbg_disasm_opcode_t op = void; if (adbg_disasm_once_debuggee(&dism, &op, AdbgDisasmMode.file, e.fault.sz)) { printf("> %p: (error:%s)\n", e.fault.raw, adbg_error_msg); } else with (globals) { adbg_disasm_format(&dism, bufferMnemonic.ptr, bufferMnemonic.sizeof, &op); adbg_disasm_machine(&dism, bufferMachine.ptr, bufferMachine.sizeof, &op); printf("> %p: (%s) %s\n", e.fault.raw, bufferMachine.ptr, bufferMnemonic.ptr); } } // Process input L_PROMPT: printf("\nAction [S=Step,C=Continue,Q=Quit] "); switch (getchar()) with (AdbgAction) { case 's', 'S': puts("Stepping..."); return step; case 'c', 'C': puts("Continuing..."); return proceed; case 'q', 'Q': puts("Quitting..."); return exit; default: goto L_PROMPT; } }
D
func void B_MalcomExident() { if(Malcom_Accident == FALSE) { if(!Npc_IsDead(Malcom)) { AI_Teleport(Malcom,"ADW_PIRATECAMP_SECRETCAVE_02"); CreateInvItems(Malcom,ItWr_TwoHStonePlate3_Addon,1); B_StartOtherRoutine(Malcom,"Start"); Npc_ChangeAttribute(Malcom,ATR_HITPOINTS,-Malcom.attribute[ATR_HITPOINTS_MAX]); AI_Teleport(Malcom,"ADW_PIRATECAMP_SECRETCAVE_02"); Wld_InsertNpc(Lurker_SecretCave1,"ADW_PIRATECAMP_SECRETCAVE_01"); Wld_InsertNpc(Lurker_SecretCave2,"ADW_PIRATECAMP_SECRETCAVE_01"); if(!Npc_IsDead(Owen)) { B_StartOtherRoutine(Owen,"Start"); }; Malcom_Accident_Deadly = TRUE; } else { Wld_InsertItem(ItWr_TwoHStonePlate3_Addon,"ADW_PIRATECAMP_SECRETCAVE_01"); }; Malcom_Accident = TRUE; }; };
D
/* Copyright (c) 1996 Blake McBride All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. */ #include "logfile.h" #include "hdlcache.h" defclass SystemFont : Font { unsigned iID; /* system id */ }; cmeth gLoad(unsigned id) { object obj; HGDIOBJ hFont; hFont = GetStockObject(id); if (!hFont) return NULL; obj = vNew(super, hFont); ivPtr(obj)->iID = id; return obj; } imeth gCopy, gDeepCopy () { return gLoad(ClassOf(self), iID); }
D
import std.stdio, std.algorithm, std.range; /******************************************************************************* * tail -n 5相当の動作を行うプログラム。ワンライナー版 */ void main() { // (c) @mono_shoo writeln(stdin.byLine().map!(a=>a.idup).array.retro.take(5).retro.join("\n")); // USCFなメソッドチェインを行なってワンライナーを書く // byLineがバッファを上書きしまくるため、mapで各要素(string)をidup // (配列のコピー)で複製しarrayで保存する }
D