Was wenn noch weitere features benoetigt werden hinzugefuegt

master
stucco 2011-01-21 15:43:02 +01:00
parent 165df46ca7
commit c0dbabcbe0
2 changed files with 17 additions and 4 deletions

View File

@ -173,7 +173,7 @@
<p> s" farbendemo.fs" 0 100 <source> </p> <p> s" farbendemo.fs" 0 100 <source> </p>
<p> farbendemo </p> <p> farbendemo </p>
<np> <np>
<h> !" Beliebige Wörter können Inhalte erzeugen!!" </h> <h> !" Was wenn zusätzliche Formatierungstags benötigt werden?" </h>
( <p> <b> !" So kann man Aufzaehlungen erstellen" </b> </p> ( <p> <b> !" So kann man Aufzaehlungen erstellen" </b> </p>
<p> <p>
<en> <en>
@ -182,9 +182,10 @@
<||> !" Makros generieren Inhalte" </||> <||> !" Makros generieren Inhalte" </||>
</en> </en>
</p> ) </p> )
<p> s" presentation.p.fs" 112 116 <source> </p> <p> s" farbendemo.fs" 0 5 <source> </p>
<p> !" Die Operatoren sehen so aus:" </p> <p> s" presentation.p.fs" 185 185 <source> </p>
<p> s" presentation.fs" 214 221 <source> </p> <p> !" Die implementierung des Tags <source>:" </p>
<p> s" sourceTag.fs" 0 100 <source> </p>
<np> <np>
<h> !" Spezielle (verwendete) Features von Forth" </h> <h> !" Spezielle (verwendete) Features von Forth" </h>
<br> <br>

12
sourceTag.fs Normal file
View File

@ -0,0 +1,12 @@
: printCodeHeader ( end start namelen addr 1/0 -- ) \ prints source code header containing line numbers
{ showLines }
swap 2swap \ addr namelen end start
2dup > if swap then \ addr namelen start/end end/start
showLines if dup 0 <# #s #> nip else 0 then ptype-reset 1+ ptype-indent !
2swap \ start end addr namelen
showLines printsource
;
: {source} ( -- ) dup dup dup dup @ swap cell + @ 2swap cell 2 * +
@ swap cell 3 * + @ 1 printCodeHeader 4 cells + ptype-reset ;
: <source> ( addr len from to -- , xt-{source} ) ['] {source} , , , , , ;