From 21931e95ed1a323a787bf77f7bbee48114355fd7 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Sun, 16 Jan 2011 13:33:07 +0100 Subject: [PATCH] typewriter fertig. und implementiert und fertig --- presentation.fs | 24 +++++++++++++++++------- presentation.p.fs | 16 ++++++---------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/presentation.fs b/presentation.fs index 935f205..54ce864 100755 --- a/presentation.fs +++ b/presentation.fs @@ -29,9 +29,17 @@ endcase nip ; -: typewriter-type ( addr len -- ) over + swap +do 10 ms i @ emit loop ; -variable ptype-lenl \ Wieviele Zeichen bereits in dieser Zeile geschrieben wurden +variable typewriter-delay +: typewriter-type ( addr len -- ) + typewriter-delay @ -rot + over + swap +do + dup ms i @ emit + loop + drop +; +50 typewriter-delay ! +variable ptype-lenl \ Wieviele Zeichen bereits in dieser Zeile geschrieben wurden defer ptype-type ' type is ptype-type : ptype-word ( addrw addrc c -- addrc+1 ) @@ -49,7 +57,6 @@ defer ptype-type ) ; : ptype-newline ( lenm lenl addrw addrc -- lenm 0 addrw ) - \ s\" is a newline\n" type 10 ptype-word \ lenm lenl addrw=addrc+1 nip 0 swap \ lenm lenl=0 addrw ; @@ -86,7 +93,7 @@ defer ptype-type endcase loop \ addre lenm lenl addrw over ptype-lenl ! - nip nip tuck - type + nip nip tuck - ptype-type ; : ptype ( addr len -- ) term-width ptype-lenl @ ptype-init ptype' ; : ptype-reset ( -- ) 0 ptype-lenl ! ; @@ -123,9 +130,12 @@ ptype-reset \ ptype-lenl sollte von Anfang an 0 sein : ( -- ) ['] {/bc} , ; : {br} ( addr -- addr ) cr ptype-reset ; :
( -- , xt-{br} ) ['] {br} , ; -\ : {animation} ( addr -- addr ) cell+ @ is ptype-type ; -\ : ( -- addr u- , xt-{animation} 0 ) ['] {animation} , ' , ; -\ : ( -- ) ['] {/animation} , ; +: {animation} ( addr , xt -- addr ) dup @ ['] ptype-type defer! cell+ ; +: ( xt -- addr u- , xt-{animation} xt ) ['] {animation} , , ; +: {/animation} ( addr -- addr ) ['] type is ptype-type ; +: ( -- , xt-{/animation} ) ['] {/animation} , ; +: ( -- , xt xt ) ['] typewriter-type ; +: ( -- , xt )
; \ Es folgen ein paar blockorientierte Kennzeichnungen. : {h} ( addr , len -- addr ) cr diff --git a/presentation.p.fs b/presentation.p.fs index c351447..42d6067 100644 --- a/presentation.p.fs +++ b/presentation.p.fs @@ -41,19 +41,15 @@ !" Dies ist eine Testpraesentation!"

- !" Eines Tages hatten wir [" !" Harald Steinlechner" - !" und " !" Denis Knauf" + !" Eines Tages hatten wir [" !" Harald Steinlechner" + !" und " !" Denis Knauf" !" ] die tolle Idee, eine Praesentationssoftware zu schreiben." -
-
- - - <||> !" erstens" +

+ + <||> !" erstens" <||> !" zweitens" <||> !" dann" - - -

+ !" Ergebnis"

!" Das hier"