diff --git a/kiss/src/kiss/SpecialForms.hx b/kiss/src/kiss/SpecialForms.hx index 3cfa8193..200581c8 100644 --- a/kiss/src/kiss/SpecialForms.hx +++ b/kiss/src/kiss/SpecialForms.hx @@ -306,8 +306,9 @@ class SpecialForms { }; map["try"] = (wholeExp:ReaderExp, args:Array, k:KissState) -> { - wholeExp.checkNumArgs(1, null, "(try [thing] [catches...])"); + wholeExp.checkNumArgs(1, null, "(try )"); var tryKissExp = args[0]; + var catchKissExps = args.slice(1); ETry(k.convert(tryKissExp), [ for (catchKissExp in catchKissExps) { diff --git a/projects/hollywoo/src/hollywoo/Director.hx b/projects/hollywoo/src/hollywoo/Director.hx new file mode 100644 index 00000000..5822fcb2 --- /dev/null +++ b/projects/hollywoo/src/hollywoo/Director.hx @@ -0,0 +1,15 @@ +package hollywoo; + +import hollywoo.Stage; + +enum Appearance { + FirstAppearance; + ReAppearance; // Could count the number of appearances with an int, but I don't see any reason that would be important +} + +typedef Continuation = Void -> Void; + +interface Director { + function showSet(set:Set, appearance:Appearance, cc:Continuation):Void; + function showCharacter(character:Character, appearance:Appearance, cc:Continuation):Void; +} diff --git a/projects/hollywoo/src/hollywoo/HollywooDSL.kiss b/projects/hollywoo/src/hollywoo/HollywooDSL.kiss new file mode 100644 index 00000000..ef932909 --- /dev/null +++ b/projects/hollywoo/src/hollywoo/HollywooDSL.kiss @@ -0,0 +1 @@ +(defNew [director] (super director)) \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/Main.hx b/projects/hollywoo/src/hollywoo/Main.hx index 45cc8b04..fc2d833e 100644 --- a/projects/hollywoo/src/hollywoo/Main.hx +++ b/projects/hollywoo/src/hollywoo/Main.hx @@ -2,6 +2,12 @@ package hollywoo; import kiss.Kiss; import kiss.Prelude; +import hollywoo.text.TextDirector; +import hollywoo.text.TextStage; +import kiss.EmbeddedScript; + +@:build(kiss.EmbeddedScript.build("HollywooDSL.kiss", "examples/pure-hollywoo/basic.hollywoo")) +class BasicHollywoo extends TextStage {} @:build(kiss.Kiss.build()) class Main {} diff --git a/projects/hollywoo/src/hollywoo/Main.kiss b/projects/hollywoo/src/hollywoo/Main.kiss index d441299f..2a4afece 100644 --- a/projects/hollywoo/src/hollywoo/Main.kiss +++ b/projects/hollywoo/src/hollywoo/Main.kiss @@ -1 +1,4 @@ -(print "Hello world!") +(defMacro runTextExample [exampleClass] + `(.run (new ,exampleClass (new TextDirector)))) + +(runTextExample BasicHollywoo) \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/Stage.hx b/projects/hollywoo/src/hollywoo/Stage.hx new file mode 100644 index 00000000..89b83ef4 --- /dev/null +++ b/projects/hollywoo/src/hollywoo/Stage.hx @@ -0,0 +1,43 @@ +package hollywoo; + +import kiss.EmbeddedScript; + +enum SceneTime { + Morning; + Day; + Evening; + Night; +} + +enum ScenePerspective { + Interior; + Exterior; + Mixed; +} + +typedef Character = { + stagePosition:StagePosition, + stageFacing:StageFacing, + actor:Actor +}; + +typedef Scene = { + set:Set, + characters:Map>, + time:SceneTime, + perspective:ScenePerspective +}; + +/** + * Model of a Hollywoo film + */ +@:build(kiss.Kiss.build()) +class Stage extends kiss.EmbeddedScript { + // Mostly immutable, reusable resources: + var sets:Map = []; + var actors:Map = []; + + + // Mutable representation of frames in time: + var scenes:Map> = []; +} diff --git a/projects/hollywoo/src/hollywoo/Stage.kiss b/projects/hollywoo/src/hollywoo/Stage.kiss new file mode 100644 index 00000000..14a6f2e9 --- /dev/null +++ b/projects/hollywoo/src/hollywoo/Stage.kiss @@ -0,0 +1,2 @@ +// "View" in the Model-View-Controller architecture: +(defNew [&prop :Director director] (super)) \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/examples/basic.fountain.hollywoo.ktxt2 b/projects/hollywoo/src/hollywoo/examples/fountain-to-hollywoo/basic.fountain.hollywoo.ktxt2 similarity index 85% rename from projects/hollywoo/src/hollywoo/examples/basic.fountain.hollywoo.ktxt2 rename to projects/hollywoo/src/hollywoo/examples/fountain-to-hollywoo/basic.fountain.hollywoo.ktxt2 index 3ebb31aa..f146e352 100644 --- a/projects/hollywoo/src/hollywoo/examples/basic.fountain.hollywoo.ktxt2 +++ b/projects/hollywoo/src/hollywoo/examples/fountain-to-hollywoo/basic.fountain.hollywoo.ktxt2 @@ -1,4 +1,4 @@ -|||Title: The First Hollywoo Script +|||Title: The First Fountain->Hollywoo Script Credit: written by Author: Nat Quayle Nelson (she/her) Contact: natquaylenelson@gmail.com diff --git a/projects/hollywoo/src/hollywoo/examples/pure-hollywoo/basic.hollywoo b/projects/hollywoo/src/hollywoo/examples/pure-hollywoo/basic.hollywoo new file mode 100644 index 00000000..2a11b33d --- /dev/null +++ b/projects/hollywoo/src/hollywoo/examples/pure-hollywoo/basic.hollywoo @@ -0,0 +1 @@ +(director.showSet (object name "Cabin" description "A cool cabin") FirstAppearance ->:Void {}) \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/text/TextDirector.hx b/projects/hollywoo/src/hollywoo/text/TextDirector.hx new file mode 100644 index 00000000..9fa291f5 --- /dev/null +++ b/projects/hollywoo/src/hollywoo/text/TextDirector.hx @@ -0,0 +1,30 @@ +package hollywoo.text; + +import hollywoo.text.TextStage; +import hollywoo.Director; + +class TextDirector implements Director { + public function new() {} + + public function showSet(set:TextSet, appearance:Appearance, cc:Continuation) { + switch (appearance) { + case FirstAppearance: + Sys.println('-- ${set.name} --'); + Sys.println(set.description); + case ReAppearance: + Sys.println('-- back at the ${set.name}'); + } + cc(); + } + + public function showCharacter(character:TextCharacter, appearance:Appearance, cc:Continuation) { + switch ([appearance, character.stagePosition]) { + case [_, OffStage]: + case [FirstAppearance, OnStage]: + Sys.println('A ${character.actor.description} is onstage. This is ${character.actor.name}'); + case [ReAppearance, OnStage]: + Sys.println('${character.actor.name} is here'); + } + cc(); + } +} \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/text/TextStage.hx b/projects/hollywoo/src/hollywoo/text/TextStage.hx new file mode 100644 index 00000000..6a5fd6ca --- /dev/null +++ b/projects/hollywoo/src/hollywoo/text/TextStage.hx @@ -0,0 +1,26 @@ +package hollywoo.text; + +import hollywoo.Stage; + +typedef TextSet = { + name:String, + description:String +} + +enum TextStagePosition { + OnStage; + OffStage; +} + +typedef TextStageFacing = String; + +typedef TextScreenPosition = Int; // number of line breaks to precede a SUPER + +typedef TextCharacter = Character; + +typedef TextActor = { + name:String, + description:String +}; + +typedef TextStage = Stage;