praesentation wird nach unten in die mitte geschoben. zentrieren ist leider nicht moeglich.
This commit is contained in:
commit
a5f040edf8
2 changed files with 43 additions and 41 deletions
|
@ -24,7 +24,7 @@ needs ansi.fs
|
||||||
|
|
||||||
: escape ( -- addr len ) s\" \e" ;
|
: escape ( -- addr len ) s\" \e" ;
|
||||||
: csi ( -- addr len ) s\" \e[" ;
|
: csi ( -- addr len ) s\" \e[" ;
|
||||||
: sgr ( u -- ) csi type 0 .r [char] m emit ;
|
: sgr ( u -- ) ESC[ 0 .r [char] m emit ;
|
||||||
: term-size form ;
|
: term-size form ;
|
||||||
: term-height ( -- i ) term-size drop ;
|
: term-height ( -- i ) term-size drop ;
|
||||||
: term-width ( -- i ) term-size nip ;
|
: term-width ( -- i ) term-size nip ;
|
||||||
|
@ -34,11 +34,14 @@ needs ansi.fs
|
||||||
: cursory@ ( -- y ) cursor@ nip ;
|
: cursory@ ( -- y ) cursor@ nip ;
|
||||||
: cursorx! ( x -- ) cursory@ cursor! ;
|
: cursorx! ( x -- ) cursory@ cursor! ;
|
||||||
: cursory! ( x -- ) cursorx@ swap cursor! ;
|
: cursory! ( x -- ) cursorx@ swap cursor! ;
|
||||||
|
|
||||||
: cursor' ( i c -- ) swap dup if ESC[ 0 .r emit else 2drop then ;
|
: cursor' ( i c -- ) swap dup if ESC[ 0 .r emit else 2drop then ;
|
||||||
: cursor^ ( i -- ) [char] A cursor' ;
|
: cursor^ ( i -- ) [char] A cursor' ;
|
||||||
: cursor_ ( i -- ) [char] B cursor' ;
|
: cursor_ ( i -- ) [char] B cursor' ;
|
||||||
: cursor> ( i -- ) [char] C cursor' ;
|
: cursor> ( i -- ) [char] C cursor' ;
|
||||||
: cursor< ( i -- ) [char] D cursor' ;
|
: cursor< ( i -- ) [char] D cursor' ;
|
||||||
|
: screen^ ( i -- ) [char] S cursor' ;
|
||||||
|
: screen_ ( i -- ) [char] T cursor' ;
|
||||||
|
|
||||||
: isnewline? ( c -- i ) dup 10 = swap 13 = or ;
|
: isnewline? ( c -- i ) dup 10 = swap 13 = or ;
|
||||||
: isspace? ( c -- i ) dup 9 = over 11 = or swap 32 = or ;
|
: isspace? ( c -- i ) dup 9 = over 11 = or swap 32 = or ;
|
||||||
|
@ -165,7 +168,7 @@ ptype-reset
|
||||||
: {h} ( addr , len -- addr )
|
: {h} ( addr , len -- addr )
|
||||||
cr
|
cr
|
||||||
term-width over @ - 2 / \ addr width-twidth/2
|
term-width over @ - 2 / \ addr width-twidth/2
|
||||||
dup cursor> ptype-indent !
|
cursor>
|
||||||
cell+ {b}
|
cell+ {b}
|
||||||
; \ header
|
; \ header
|
||||||
: <h> ( -- addr 0 , xt-{h} 0 ) ['] {h} , here 0 , 0 ;
|
: <h> ( -- addr 0 , xt-{h} 0 ) ['] {h} , here 0 , 0 ;
|
||||||
|
@ -208,13 +211,48 @@ variable enumerationCount ( -- addr )
|
||||||
: {/en} ( -- ) ptype-reset ;
|
: {/en} ( -- ) ptype-reset ;
|
||||||
: </en> ( -- , xt-{/en} ) ['] {en} , ;
|
: </en> ( -- , xt-{/en} ) ['] {en} , ;
|
||||||
|
|
||||||
|
256 Constant max-line
|
||||||
|
Create line-buffer max-line 2 + allot
|
||||||
|
|
||||||
|
0 Value fd-in
|
||||||
|
: open-input ( addr u -- ) r/o open-file throw to fd-in ;
|
||||||
|
|
||||||
|
: printsource ( from to addr u -- )
|
||||||
|
open-input
|
||||||
|
cr
|
||||||
|
0
|
||||||
|
begin
|
||||||
|
1+
|
||||||
|
line-buffer max-line fd-in read-line throw
|
||||||
|
while
|
||||||
|
swap 2over rot swap over >= if
|
||||||
|
swap over <= if
|
||||||
|
dup 0 U.R s" -> " type swap line-buffer swap type cr
|
||||||
|
else swap drop
|
||||||
|
endif
|
||||||
|
else swap drop swap drop
|
||||||
|
endif
|
||||||
|
repeat
|
||||||
|
2drop 2drop
|
||||||
|
fd-in close-file throw ;
|
||||||
|
|
||||||
|
: printCodeHeader ( end start namelen addr -- ) \ prints source code header containing line numbers
|
||||||
|
swap 2dup type 2swap \ s" (" type 0 U.R s" -" type 0 U.R s" ): " type cr cr type ;
|
||||||
|
swap 2swap cr printsource cr ; \ type emit emit ;
|
||||||
|
|
||||||
|
: {source} ( -- ) ;
|
||||||
|
: <source> ( -- , xt-{source} ) ['] {source} , ;
|
||||||
|
: {/source} ( -- ) dup dup dup dup @ swap cell + @ 2swap cell 2 * +
|
||||||
|
@ swap cell 3 * + @ printCodeHeader 4 cells + ;
|
||||||
|
: </source> ( -- , xt-{/source} ) ['] {/source} , , , , , ;
|
||||||
|
|
||||||
: {np} ( -- )
|
: {np} ( -- )
|
||||||
0 sgr \ Alle Bildschirmeigenschaften zuruecksetzen
|
0 sgr \ Alle Bildschirmeigenschaften zuruecksetzen
|
||||||
page \ Bildschirm leeren
|
page \ Bildschirm leeren
|
||||||
;
|
;
|
||||||
: {/np} ( -- )
|
: {/np} ( -- )
|
||||||
\ 30 sgr 40 sgr
|
\ 30 sgr 40 sgr
|
||||||
0 term-height 2 - at-xy
|
0 term-height dup cursory@ - 2 / screen_ 2 - cursor!
|
||||||
;
|
;
|
||||||
: <np> ( -- addr , xt-{/np} xt-{np} )
|
: <np> ( -- addr , xt-{/np} xt-{np} )
|
||||||
\ Wir legen jede Anfangsadresse einer Seite auf den Stack (Achtung, in umgekehrter Reihenfolge)
|
\ Wir legen jede Anfangsadresse einer Seite auf den Stack (Achtung, in umgekehrter Reihenfolge)
|
||||||
|
|
|
@ -38,46 +38,10 @@
|
||||||
; immediate
|
; immediate
|
||||||
: farbendemo farbendemo' </bc> </fc> ;
|
: farbendemo farbendemo' </bc> </fc> ;
|
||||||
|
|
||||||
256 Constant max-line
|
|
||||||
Create line-buffer max-line 2 + allot
|
|
||||||
|
|
||||||
0 Value fd-in
|
|
||||||
: open-input ( addr u -- ) r/o open-file throw to fd-in ;
|
|
||||||
|
|
||||||
: printsource ( from to addr u -- )
|
|
||||||
open-input
|
|
||||||
cr
|
|
||||||
0
|
|
||||||
begin
|
|
||||||
1+
|
|
||||||
line-buffer max-line fd-in read-line throw
|
|
||||||
while
|
|
||||||
swap 2over rot swap over >= if
|
|
||||||
swap over <= if
|
|
||||||
dup 0 U.R s" -> " ptype-type swap line-buffer swap ptype-type {br}
|
|
||||||
else swap drop
|
|
||||||
endif
|
|
||||||
else swap drop swap drop
|
|
||||||
endif
|
|
||||||
repeat
|
|
||||||
2drop 2drop
|
|
||||||
fd-in close-file throw ;
|
|
||||||
|
|
||||||
: printCodeHeader ( end start namelen addr -- ) \ prints source code header containing line numbers
|
|
||||||
swap 2dup type 2swap \ s" (" type 0 U.R s" -" type 0 U.R s" ): " type cr cr type ;
|
|
||||||
swap 2swap cr printsource cr ; \ type emit emit ;
|
|
||||||
|
|
||||||
: {source} ( -- ) ;
|
|
||||||
: <source> ( -- , xt-{source} ) ['] {source} , ;
|
|
||||||
: {/source} ( -- ) dup dup dup dup @ swap cell + @ 2swap cell 2 * +
|
|
||||||
@ swap cell 3 * + @ printCodeHeader 4 cells + ;
|
|
||||||
: </source> ( -- , xt-{/source} ) ['] {/source} , , , , , ;
|
|
||||||
|
|
||||||
<presentation>
|
<presentation>
|
||||||
<h> !" Dies ist eine Testpraesentation!" </h>
|
<h> </b> !" Dies ist eine Testpraesentation!" </h>
|
||||||
<p>
|
<p>
|
||||||
!" Eines Tages hatten wir [" ( <b> <tw> ) !" Harald Steinlechner" </tw> </b>
|
!" Eines Tages hatten wir [Harald Steinlechner und Denis Knauf"
|
||||||
!" und " ( <b> <tw> ) !" Denis Knauf" </tw> </b>
|
|
||||||
!" ] die tolle Idee, eine Praesentationssoftware zu schreiben."
|
!" ] die tolle Idee, eine Praesentationssoftware zu schreiben."
|
||||||
</p>
|
</p>
|
||||||
\ <p> <en>
|
\ <p> <en>
|
||||||
|
|
Loading…
Reference in a new issue