--- psiconv/trunk/program/psiconv/gen_rtf.c 1999/10/11 19:17:17 14 +++ psiconv/trunk/program/psiconv/gen_rtf.c 2000/12/10 16:49:40 58 @@ -19,11 +19,13 @@ */ #include "config.h" +#include "compat.h" #include #include -#include "data.h" -#include "list.h" +#include "psiconv/data.h" +#include "psiconv/list.h" #include "gen.h" +#include "psiconv.h" /* @@ -325,11 +327,11 @@ static psiconv_character_layout gen_base_char(psiconv_list colors, psiconv_list fonts) { - struct psiconv_color white = { 0,0,0 }; - struct psiconv_color black = { 0xff,0xff,0xff }; - struct psiconv_font font = { strdup(""),-1 }; /* Pseudo - not added! */ + struct psiconv_color_s white = { 0,0,0 }; + struct psiconv_color_s black = { 0xff,0xff,0xff }; + struct psiconv_font_s font = { NULL,-1 }; /* Pseudo - not added! */ - struct psiconv_character_layout base_char_struct = + struct psiconv_character_layout_s base_char_struct = { &black, /* color */ &white, /* back_color */ @@ -342,13 +344,14 @@ &font, /* font */ }; + font.name = strdup(""); add_color(colors,&white); add_color(colors,&black); return psiconv_clone_character_layout(&base_char_struct); } -void diff_char(FILE *of,psiconv_list colors, psiconv_list fonts, +static void diff_char(FILE *of,psiconv_list colors, psiconv_list fonts, const psiconv_character_layout old, const psiconv_character_layout new) { @@ -519,13 +522,33 @@ psiconv_list_free(colors); } -void psiconv_gen_rtf(FILE * of, psiconv_file file) +static int psiconv_gen_rtf(const char *filename, const psiconv_file file, + const char *dest) { - if (file->type == psiconv_word_file) + FILE *of = fopen(filename,"w"); + if (! of) + return -1; + + if (file->type == psiconv_word_file) { psiconv_gen_rtf_word(of,(psiconv_word_f) file->file); - else if (file->type == psiconv_texted_file) + } else if (file->type == psiconv_texted_file) { psiconv_gen_rtf_texted(of,(psiconv_texted_f) file->file); - else - return; + } else { + fclose(of); + return -1; + } + return fclose(of); +} + +static struct psiconv_fileformat_s ff = +{ + "RTF", + "Rich Text Format (not functional yet!)", + psiconv_gen_rtf +}; + +void init_rtf(void) +{ + /* psiconv_list_add(fileformat_list,&ff); */ }