Merge branch 'master' of github.com:DenisKnauf/presentation.fs

master
Denis Knauf 2011-01-21 15:44:48 +01:00
commit f25268a729
2 changed files with 17 additions and 4 deletions

View File

@ -183,7 +183,7 @@
<p> s" farbendemo.fs" 0 100 <source> </p>
<p> farbendemo </p>
<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>
<en>
@ -192,9 +192,10 @@
<||> !" Makros generieren Inhalte" </||>
</en>
</p> )
<p> s" presentation.p.fs" 112 116 <source> </p>
<p> !" Die Operatoren sehen so aus:" </p>
<p> s" presentation.fs" 214 221 <source> </p>
<p> s" farbendemo.fs" 0 5 <source> </p>
<p> s" presentation.p.fs" 185 185 <source> </p>
<p> !" Die implementierung des Tags <source>:" </p>
<p> s" sourceTag.fs" 0 100 <source> </p>
<np>
<h> !" Spezielle (verwendete) Features von Forth" </h>
<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} , , , , , ;