summaryrefslogtreecommitdiff
path: root/binutils/winduni.h
blob: 349f684578482a6b5bfe3d08777152f9436bb115 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* winduni.h -- header file for unicode support for windres program.
   Copyright 1997, 1998, 2002, 2007
   Free Software Foundation, Inc.
   Written by Ian Lance Taylor, Cygnus Support.
   Rewritten by Kai Tietz, Onevision.

   This file is part of GNU Binutils.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
   02110-1301, USA.  */

#include "ansidecl.h"

#ifndef WINDUNI_H
#define WINDUNI_H

/* This header file declares the types and functions we use for
   unicode support in windres.  Our unicode support is very limited at
   present.

   We don't put this stuff in windres.h so that winduni.c doesn't have
   to include windres.h.  winduni.c needs to includes windows.h, and
   that would conflict with the definitions of Windows macros we
   already have in windres.h.  */

/* Use bfd_size_type to ensure a sufficient number of bits.  */
#ifndef DEFINED_RC_UINT_TYPE
#define DEFINED_RC_UINT_TYPE
typedef bfd_size_type rc_uint_type;
#endif

/* We use this type to hold a unicode character.  */

typedef unsigned short unichar;

/* Escape character translations.  */

#define ESCAPE_A  007
#define ESCAPE_B  010
#define ESCAPE_F  014
#define ESCAPE_N  012
#define ESCAPE_R  015
#define ESCAPE_T  011
#define ESCAPE_V  013

/* Convert an ASCII string to a unicode string.  */

extern void unicode_from_ascii (rc_uint_type *, unichar **, const char *);

/* Convert an unicode string to an ASCII string.  */
extern void ascii_from_unicode (rc_uint_type *, const unichar *, char **);

/* Duplicate a unicode string by using res_alloc.  */
extern unichar *unichar_dup (const unichar *);

/* Duplicate a unicode string by using res_alloc and make it uppercase.  */
extern unichar *unichar_dup_uppercase (const unichar *);

/* The count of unichar elements.  */
extern rc_uint_type unichar_len (const unichar *);

/* Print a unicode string to a file.  */
extern void unicode_print (FILE *, const unichar *, rc_uint_type);

/* Print a ascii string to a file.  */
extern void ascii_print (FILE *, const char *, rc_uint_type);

/* Print a quoted unicode string to a file.  */
extern void unicode_print_quoted (FILE *, const unichar *, rc_uint_type);

/* Windres support routine called by unicode_from_ascii.  This is both
   here and in windres.h.  It should probably be in a separate header
   file, but it hardly seems worth it for one function.  */

extern void * res_alloc (rc_uint_type);

#endif