About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gdkanji.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gd.h"
#include "gdhelpers.h"
#include "gd_errors.h"
#include <errno.h>
#include <stdarg.h>
Include dependency graph for gdkanji.c:

Go to the source code of this file.


#define LIBNAME   "any2eucjp()"
#define TRUE   1
#define FALSE   0
#define NEW   1
#define OLD   2
#define ESCI   3
#define NEC   4
#define EUC   5
#define SJIS   6
#define EUCORSJIS   7
#define ASCII   8
#define NEWJISSTR   "JIS7"
#define OLDJISSTR   "jis"
#define EUCSTR   "eucJP"
#define SJISSTR   "SJIS"
#define ESC   27
#define SS2   142
#define IS_DAKU(c)   ((c >= 182 && c <= 196) || (c >= 202 && c <= 206) || (c == 179))
#define IS_HANDAKU(c)   (c >= 202 && c <= 206)
#define ustrcpy(A, B)   (strcpy((char*)(A),(const char*)(B)))
#define ustrncpy(A, B, maxsize)   (strncpy((char*)(A),(const char*)(B), maxsize))


typedef voidiconv_t


iconv_t iconv_open (const char *, const char *)
size_t iconv (iconv_t, char **, size_t *, char **, size_t *)
int iconv_close (iconv_t)
static int DetectKanjiCode (const unsigned char *str)
static void SJIStoJIS (int *p1, int *p2)
static void han2zen (int *p1, int *p2)
static void do_convert (unsigned char **to_p, const unsigned char **from_p, const char *code)
static int do_check_and_conv (unsigned char *to, const unsigned char *from)
int any2eucjp (unsigned char *dest, const unsigned char *src, unsigned int dest_max)

Macro Definition Documentation


#define ASCII   8

Definition at line 84 of file gdkanji.c.


#define ESC   27

Definition at line 91 of file gdkanji.c.


#define ESCI   3

Definition at line 79 of file gdkanji.c.


#define EUC   5

Definition at line 81 of file gdkanji.c.


#define EUCORSJIS   7

Definition at line 83 of file gdkanji.c.


#define EUCSTR   "eucJP"

Definition at line 88 of file gdkanji.c.


#define FALSE   0

Definition at line 75 of file gdkanji.c.



Definition at line 25 of file gdkanji.c.


#define IS_DAKU (   c)    ((c >= 182 && c <= 196) || (c >= 202 && c <= 206) || (c == 179))

Definition at line 234 of file gdkanji.c.


#define IS_HANDAKU (   c)    (c >= 202 && c <= 206)

Definition at line 235 of file gdkanji.c.


#define LIBNAME   "any2eucjp()"

Definition at line 59 of file gdkanji.c.


#define NEC   4

Definition at line 80 of file gdkanji.c.


#define NEW   1

Definition at line 77 of file gdkanji.c.


#define NEWJISSTR   "JIS7"

Definition at line 86 of file gdkanji.c.


#define OLD   2

Definition at line 78 of file gdkanji.c.


#define OLDJISSTR   "jis"

Definition at line 87 of file gdkanji.c.


#define SJIS   6

Definition at line 82 of file gdkanji.c.


#define SJISSTR   "SJIS"

Definition at line 89 of file gdkanji.c.

◆ SS2

#define SS2   142

Definition at line 92 of file gdkanji.c.


#define TRUE   1

Definition at line 74 of file gdkanji.c.

◆ ustrcpy

#define ustrcpy (   A,
)    (strcpy((char*)(A),(const char*)(B)))

Definition at line 328 of file gdkanji.c.

◆ ustrncpy

#define ustrncpy (   A,
)    (strncpy((char*)(A),(const char*)(B), maxsize))

Definition at line 330 of file gdkanji.c.

Typedef Documentation

◆ iconv_t

typedef void* iconv_t

Definition at line 21 of file gdkanji.c.

Function Documentation

◆ any2eucjp()

int any2eucjp ( unsigned char *  dest,
const unsigned char *  src,
unsigned int  dest_max 

Definition at line 526 of file gdkanji.c.

References BUFSIZ, dest, do_check_and_conv(), gd_error(), ret, link_confs::src, strlen(), and ustrcpy.

◆ DetectKanjiCode()

static int DetectKanjiCode ( const unsigned char *  str)

Definition at line 97 of file gdkanji.c.

References ASCII, c, endif, ESC, ESCI, EUC, EUCORSJIS, GD_DEBUG, gd_error_ex(), getenv(), i, lang, NEC, NEW, NULL, OLD, SJIS, SS2, str, strcmp(), and strncmp().

Referenced by do_check_and_conv().

◆ do_check_and_conv()

static int do_check_and_conv ( unsigned char *  to,
const unsigned char *  from 

◆ do_convert()

static void do_convert ( unsigned char **  to_p,
const unsigned char **  from_p,
const char *  code 

◆ han2zen()

static void han2zen ( int p1,
int p2 

Definition at line 238 of file gdkanji.c.

References c, FALSE, IS_DAKU, IS_HANDAKU, p1, p2, and TRUE.

Referenced by do_check_and_conv().

◆ iconv()

size_t iconv ( iconv_t  cd,
char **  inbuf,
size_t inbytesleft,
char **  outbuf,
size_t outbytesleft 

Definition at line 39 of file gdkanji.c.

References inbuf, outbuf, and void.

Referenced by do_convert().

◆ iconv_close()

int iconv_close ( iconv_t  cd)

Definition at line 51 of file gdkanji.c.

References void.

Referenced by do_convert().

◆ iconv_open()

iconv_t iconv_open ( const char *  tocode,
const char *  fromcode 

Definition at line 31 of file gdkanji.c.

References void.

Referenced by do_convert().


static void SJIStoJIS ( int p1,
int p2 

Definition at line 220 of file gdkanji.c.

References adjust, c1, c2, p1, and p2.

Referenced by do_check_and_conv(), do_convert(), fromSJIS(), toDVI(), and toJIS().