line number prefix optional gemacht feur <file>
This commit is contained in:
parent
ae1059f88f
commit
5acc1bbcca
3 changed files with 23 additions and 4 deletions
12
header.txt
Normal file
12
header.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
_____ __ __ __ _ __
|
||||
/ ___// /_____ ______/ /__/ /_ ____ ______(_)__ _____/ /____
|
||||
\__ \/ __/ __ `/ ___/ //_/ __ \/ __ `/ ___/ / _ \/ ___/ __/ _ \
|
||||
___/ / /_/ /_/ / /__/ ,< / /_/ / /_/ (__ ) / __/ / / /_/ __/
|
||||
/____/\__/\__,_/\___/_/|_/_.___/\__,_/____/_/\___/_/ \__/\___/
|
||||
_____ __
|
||||
/ ___/____ _________ ______/ /_ ___ ____
|
||||
\__ \/ __ \/ ___/ __ `/ ___/ __ \/ _ \/ __ \
|
||||
___/ / /_/ / / / /_/ / /__/ / / / __/ / / /
|
||||
/____/ .___/_/ \__,_/\___/_/ /_/\___/_/ /_/
|
||||
/
|
||||
|
|
@ -235,6 +235,7 @@ Create line-buffer max-line 2 + allot
|
|||
: open-input ( addr u -- ) r/o open-file throw to fd-in ;
|
||||
|
||||
: printsource ( from to addr u -- )
|
||||
{ showLines }
|
||||
open-input
|
||||
cr
|
||||
0
|
||||
|
@ -247,7 +248,8 @@ Create line-buffer max-line 2 + allot
|
|||
dup ptype-indent @ \ i str l l indent
|
||||
dup ptype-curx ! 1- \ i str l l indent
|
||||
swap - cursor> \ i str l
|
||||
type ." |" \ ... i \ Eingerueckt Zahl ausgeben
|
||||
showLines if type ." |" \ ... i \ Eingerueckt Zahl ausgeben
|
||||
else 2drop endif \ Eingerueckt keine Zahl ausgeben
|
||||
swap line-buffer swap ptype cr
|
||||
else nip
|
||||
endif
|
||||
|
@ -259,23 +261,24 @@ Create line-buffer max-line 2 + allot
|
|||
;
|
||||
|
||||
: printCodeHeader ( end start namelen addr -- ) \ prints source code header containing line numbers
|
||||
{ showLines }
|
||||
swap 2swap \ addr namelen end start
|
||||
2dup > if swap then \ addr namelen start/end end/start
|
||||
dup 0 <# #s #> nip ptype-reset 1+ ptype-indent !
|
||||
2swap \ start end addr namelen
|
||||
printsource cr
|
||||
showLines printsource cr
|
||||
;
|
||||
|
||||
: {source} ( -- ) ;
|
||||
: <source> ( -- , xt-{source} ) ['] {source} , ;
|
||||
: {/source} ( -- ) dup dup dup dup @ swap cell + @ 2swap cell 2 * +
|
||||
@ swap cell 3 * + @ printCodeHeader 4 cells + ;
|
||||
@ swap cell 3 * + @ 1 printCodeHeader 4 cells + ;
|
||||
: </source> ( -- , xt-{/source} ) ['] {/source} , , , , , ;
|
||||
|
||||
: {file} ( -- ) ;
|
||||
: <file> ( -- , xt-{file} ) ['] {file} , ;
|
||||
: {/file} ( -- ) dup dup dup dup @ swap cell + @ 2swap cell 2 * +
|
||||
@ swap cell 3 * + @ printCodeHeader 4 cells + ;
|
||||
@ swap cell 3 * + @ 0 printCodeHeader 4 cells + ;
|
||||
: </file> ( -- , xt-{/file} ) ['] {/file} , , , , , ;
|
||||
|
||||
: {np} ( -- )
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
: farbendemo farbendemo' </bc> </fc> ;
|
||||
|
||||
<presentation>
|
||||
<p>
|
||||
<file> s" header.txt" 0 100 </file>
|
||||
</p>
|
||||
<np>
|
||||
<h> </b> !" Dies ist eine Testpraesentation!" </h>
|
||||
<p>
|
||||
!" Eines Tages hatten wir [Harald Steinlechner und Denis Knauf"
|
||||
|
|
Loading…
Reference in a new issue