File: kanji_dump.c

package info (click to toggle)
texlive-bin 2016.20160513.41080.dfsg-2+deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 155,060 kB
  • sloc: ansic: 702,862; cpp: 222,090; perl: 76,014; sh: 23,402; makefile: 8,078; lex: 4,710; pascal: 3,782; python: 3,614; java: 3,569; yacc: 2,905; exp: 2,031; xml: 800; tcl: 670; ruby: 620; lisp: 397; sed: 351; asm: 140; csh: 48; awk: 30
file content (41 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 *  Dump/undump Kanji encoding for (e)upTeX.
 */

#include "kanji.h"
#include <texmfmp.h>

void dump_kanji (FILE *fp)
{
    char buffer[12];
    const char *p = get_enc_string ();
    size_t len = strlen (p);

    if (len > 11) {
        fprintf (stderr, "Kanji encoding string \"%s\" exceeds 11 bytes.\n", p);
        uexit(1);
    }

    strcpy (buffer, p);
    for (len++; len < 12; len++)
        buffer[len] = 0;
    do_dump (buffer, 1, 12, fp);
}

void undump_kanji (FILE *fp)
{
    char buffer[12];
    char *p;

    do_undump (buffer, 1, 12, fp);
    buffer[11] = 0;  /* force string termination, just in case */

    p = strchr (buffer, '.');
    if (p)
        *p++ = 0;
    else
        p = buffer;

    /* Now BUFFER and P are the file and internal encoding strings.  */
    init_kanji (NULL, p);
}