|
![](/i/fill.gif) |
"Rune" <new### [at] runevision com> wrote:
> This is a bit shorter.
>
> // SelfPrint.pov by PM 2Ring and Rune S. Johansen. 2005.7.23
> // +A0.01 +AM2 +R4
> #macro P(S)#fopen F"ps.tmp"write #write(F,S)#fclose F
> #include "ps.tmp"#end #declare T=array[22]{
> "// SelfPrint.pov by PM 2Ring and Rune S. Johansen. 2005.7.23 ",
> "// +A0.01 +AM2 +R4 ",
> "#macro P(S)#fopen F"ps.tmp"write #write(F,S)#fclose F ",
> "#include "ps.tmp"#end #declare T=array[22]{ ",
> "}; #local S="";#local i=7;#while(i<22) ",
> "#local S=concat(S,T[i]) #local i=i+1;#end P(S) ",
> "//--------------------End of scene------------------------- ",
> " ",
> "camera{location -31*z}background{rgb .25} ",
> "#declare U=-20;#declare V=14;#declare Q=chr(34); ",
> " ",
> "#macro p(s)object{text{ttf "crystal.ttf",s.1,0}pigment{rgb 1}",
> "finish{ambient 1}translate<U,V,0>}#declare V=V-1;#end ",
> " ",
> "#macro r(a)#local b=Q;#local i=1;#while(i<=strlen(a)) ",
> "#local c=substr(a,i,1);#if(!strcmp(c,Q)) ",
> "#local b=concat(b,chr(92));#end#local b=concat(b,c); ",
> "#local i=i+1;#end concat(b,Q,chr(44))#end ",
> " ",
> "#macro w(i,h)#while(i<h)p(T[i])#local i=i+1;#end#end ",
> "#macro q(i,h)#while(i<h)p(r(T[i]))#local i=i+1;#end#end ",
> "w(0,4)q(0,22)w(4,7) ",
> }; #local S="";#local i=7;#while(i<22)
> #local S=concat(S,T[i]) #local i=i+1;#end P(S)
> //--------------------End of scene-------------------------
Ok, I'll pay that. :) Although some may say that doing it this way (or using
the Parse_String() macro) makes it all too easy. :)
Thanks to everyone else who enjoyed this thread! I'll post some more silly
things with the SDL soon.
Post a reply to this message
|
![](/i/fill.gif) |