/[public]/psiconv/trunk/program/psiconv/general.c
ViewVC logotype

Diff of /psiconv/trunk/program/psiconv/general.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 189 Revision 196
1/* 1/*
2 general.c - Part of psiconv, a PSION 5 file formats converter 2 general.c - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 2003 Frodo Looijaard <frodol@dds.nl> 3 Copyright (c) 2003-2004 Frodo Looijaard <frodol@dds.nl>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
32void output_char(psiconv_config config, psiconv_list list, 32void output_char(psiconv_config config, psiconv_list list,
33 psiconv_ucs2 character, encoding enc) 33 psiconv_ucs2 character, encoding enc)
34{ 34{
35 psiconv_u8 temp; 35 psiconv_u8 temp;
36 int res; 36 int res;
37#define TEMPSTR_LEN 80
38 char tempstr[TEMPSTR_LEN];
37 39
38 if (enc == ENCODING_UCS2) { 40 if (enc == ENCODING_UCS2) {
39 temp = character >> 8; 41 temp = character >> 8;
40 if ((res = psiconv_list_add(list,&temp))) { 42 if ((res = psiconv_list_add(list,&temp))) {
41 fputs("Out of memory error\n",stderr); 43 fputs("Out of memory error\n",stderr);
90 temp = character; 92 temp = character;
91 if ((res = psiconv_list_add(list,&temp))) { 93 if ((res = psiconv_list_add(list,&temp))) {
92 fputs("Out of memory error\n",stderr); 94 fputs("Out of memory error\n",stderr);
93 exit(1); 95 exit(1);
94 } 96 }
97 } else if (enc == ENCODING_ASCII_HTML) {
98 if (character >= 0x80) {
99 snprintf(tempstr,TEMPSTR_LEN,"&#x%x;",character);
100 output_simple_chars(config,list,tempstr,enc);
101 } else {
102 temp = character;
103 if ((res = psiconv_list_add(list,&temp))) {
104 fputs("Out of memory error\n",stderr);
105 exit(1);
106 }
107 }
95 } else if (enc == ENCODING_PSION) { 108 } else if (enc == ENCODING_PSION) {
96 temp = psiconv_unicode_to_char(config,character); 109 temp = psiconv_unicode_to_char(config,character);
97 if ((res = psiconv_list_add(list,&temp))) { 110 if ((res = psiconv_list_add(list,&temp))) {
98 fputs("Out of memory error\n",stderr); 111 fputs("Out of memory error\n",stderr);
99 exit(1); 112 exit(1);

Legend:
Removed from v.189  
changed lines
  Added in v.196

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26