Skip to content
Snippets Groups Projects
Commit 0bb5e308 authored by Mirar (Pontus Hagland)'s avatar Mirar (Pontus Hagland)
Browse files

illustration source page

Rev: src/modules/Image/illustration.pike:1.2
Rev: src/modules/Image/mkdoc.pike:1.12
parent ea73edd6
No related branches found
No related tags found
No related merge requests found
/* $Id: illustration.pike,v 1.1 1997/05/29 22:51:19 mirar Exp $ */ /* $Id: illustration.pike,v 1.2 1997/10/29 02:57:04 mirar Exp $ */
import Image; import Image;
import Stdio; import Stdio;
...@@ -15,13 +15,29 @@ object foo() ...@@ -15,13 +15,29 @@ object foo()
***the string*** ***the string***
} }
string doit(string name) string doit(string name,mapping has,object f,string src)
{ {
rm("doc/"+name); // clean up
object o=foo(); object o=foo();
if (o->toppm()==lena()->toppm()) string s=o->toppm();
if (s==lena()->toppm())
return "<img src=lena.gif width=67 height=67>"; return "<img src=lena.gif width=67 height=67>";
rm("doc/"+name); if (has[s]) return has[s];
write_file("doc/"+name,o->togif()); write_file("doc/"+name,o->togif());
return "<img src="+name+" width="+o->xsize()+" height="+o->ysize()+">";
f->write(
"<a name="+name+">"
"<img border=0 src="+name+" width="+o->xsize()+" height="+o->ysize()+" align=right>"
"<pre>"+src+"</pre>"
"</a><br clear=all><hr>"
);
return has[s]=
"<a href=illustrations.html#"+name+">"
"<img border=0 src="+name+" width="+o->xsize()+" height="+o->ysize()+">"
"</a>";
} }
/* $Id: mkdoc.pike,v 1.11 1997/10/27 22:40:34 mirar Exp $ */ /* $Id: mkdoc.pike,v 1.12 1997/10/29 02:57:06 mirar Exp $ */
import Stdio; import Stdio;
import Array; import Array;
mapping parse=([]); mapping parse=([]);
int illustration_counter; int illustration_counter;
object illustration_source;
string illustration_code=read_bytes("illustration.pike"); string illustration_code=read_bytes("illustration.pike");
object lena_image=Image.image()->fromppm(read_file("doc/lena.ppm")); object lena_image=Image.image()->fromppm(read_file("doc/lena.ppm"));
...@@ -190,6 +191,8 @@ object(File) make_file(string filename) ...@@ -190,6 +191,8 @@ object(File) make_file(string filename)
return f; return f;
} }
mapping ills=([]);
string fixdesc(string s,string prefix) string fixdesc(string s,string prefix)
{ {
s=stripws(s); s=stripws(s);
...@@ -208,10 +211,12 @@ string fixdesc(string s,string prefix) ...@@ -208,10 +211,12 @@ string fixdesc(string s,string prefix)
while (sscanf(t,"%s<illustration>%s</illustration>%s",t,u,v)==3) while (sscanf(t,"%s<illustration>%s</illustration>%s",t,u,v)==3)
{ {
s+=t; s+=t;
array err=catch { array err=catch {
object x=compile_string(replace(illustration_code,"***the string***",u))(); object x=compile_string(replace(illustration_code,"***the string***",u))();
x->lena_image=lena_image; x->lena_image=lena_image;
u=x->doit("illustration_"+illustration_counter+++".gif"); u=x->doit("illustration_"+illustration_counter+++".gif",
ills,illustration_source,u);
}; };
if (err) if (err)
{ {
...@@ -475,6 +480,9 @@ void make_doc_files(string dir) ...@@ -475,6 +480,9 @@ void make_doc_files(string dir)
{ {
stdout->write("modules: "+sort(indices(parse))*", "+"\n"); stdout->write("modules: "+sort(indices(parse))*", "+"\n");
illustration_source=File();
illustration_source->open(dir+"illustrations.html","wct");
string module; string module;
foreach (sort(indices(parse)),module) foreach (sort(indices(parse)),module)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment