initial message templates support
[claws.git] / libkcc / showcode.c
blobbb09f9005db80e9cbb1bcd739cd2d06eae839ebe
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
6 #include "kcc.h"
8 /*---------------------------------------------------------------------
9 NAME
10 showcode
11 ---------------------------------------------------------------------*/
12 int Kcc_showcode(code)
13 register unsigned code;
15 /* char *s; */
16 /* void showjis();*/
17 int k, m;
18 /* int k, m,n; */
20 if (!(code & NONASCII)) {
22 * 7-bit JIS / ASCII.
24 if (code & JIS) {
25 return JIS;
26 } else { return ASCII; }
27 } else if (code & (EUC | DEC)) {
28 k = code & EUC ? code & DEC ? EUC : EUC : DEC;
29 if (code & SJIS) {
31 * Ambiguous.
33 if (code & JIS8) {
34 m = code & JIS ? JIS : SJIS;
35 if (code & ASSUME) {
36 return code & JIS ? m : k;
38 return k;
40 if (code & ASSUME) { return k; }
41 return SJIS;
42 } else {
44 * EUC/DEC.
46 return k;
48 } else if (code & JIS8) {
50 * 8-bit JIS / shift-JIS or 8-bit JIS.
52 if (!(code & JIS))
53 return SJIS;
54 return JIS8;
55 } else if (code & SJIS)
57 * Shift-JIS.
59 return SJIS;
60 else {
62 * Non-ASCII deteced but neither EUC/DEC nor SJIS.
64 return BINARY;
66 if (code & JIS) {
67 return JIS;
70 return BINARY;