X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=src%2Fhtml.c;h=fbb6b968d37074256606c23a1077b4fcfa10cb3b;hb=5ea5547d895d8b0930868378f3eeed39bb3ec731;hp=f0b4f5fdfb0f5698de0030bd30371b7e2715cfba;hpb=97d6c6f6b1922621ca013668eba9a9a9f71d60fe;p=pspp diff --git a/src/html.c b/src/html.c index f0b4f5fdfb..fbb6b968d3 100644 --- a/src/html.c +++ b/src/html.c @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This #if encloses the rest of the file. */ #if !NO_HTML @@ -40,6 +40,7 @@ #include "som.h" #include "tab.h" #include "version.h" +#include "mkfile.h" /* Prototypes. */ static int postopen (struct file_ext *); @@ -122,6 +123,22 @@ html_close_driver (struct outp_driver *this) return 1; } + +/* Link the image contained in FILENAME to the + HTML stream in file F. */ +static int +link_image (struct file_ext *f, char *filename) +{ + fprintf (f->file, + "", filename); + + if (ferror (f->file)) + return 0; + + return 1; +} + + /* Generic option types. */ enum { @@ -156,7 +173,7 @@ html_option (struct outp_driver *this, const char *key, const struct string *val break; case 1: free (x->file.filename); - x->file.filename = xstrdup (ds_value (val)); + x->file.filename = xstrdup (ds_c_str (val)); break; case string_arg: { @@ -172,7 +189,7 @@ html_option (struct outp_driver *this, const char *key, const struct string *val } if (*dest) free (*dest); - *dest = xstrdup (ds_value (val)); + *dest = xstrdup (ds_c_str (val)); } break; default: @@ -392,7 +409,7 @@ html_close_page (struct outp_driver *this) static void output_tab_table (struct outp_driver *, struct tab_table *); static void -html_submit (struct outp_driver *this, struct som_table *s) +html_submit (struct outp_driver *this, struct som_entity *s) { extern struct som_table_class tab_table_class; struct html_driver_ext *x = this->ext; @@ -404,10 +421,21 @@ html_submit (struct outp_driver *this, struct som_table *s) return; } - if (s->class == &tab_table_class) - output_tab_table (this, (struct tab_table *) s->ext); - else - assert (0); + assert ( s->class == &tab_table_class ) ; + + switch (s->type) + { + case SOM_TABLE: + output_tab_table ( this, (struct tab_table *) s->ext); + break; + case SOM_CHART: + link_image( &x->file, ((struct chart *)s->ext)->filename); + break; + default: + assert(0); + break; + } + } /* Write string S of length LEN to file F, escaping characters as @@ -454,7 +482,7 @@ output_tab_table (struct outp_driver *this, struct tab_table *t) { fputs ("
", x->file.file); if (!ls_empty_p (t->cc)) - escape_string (x->file.file, ls_value (t->cc), ls_length (t->cc)); + escape_string (x->file.file, ls_c_str (t->cc), ls_length (t->cc)); fputs ("
\n", x->file.file); return; @@ -465,7 +493,7 @@ output_tab_table (struct outp_driver *this, struct tab_table *t) if (!ls_empty_p (&t->title)) { fprintf (x->file.file, "