summaryrefslogtreecommitdiff
path: root/support/dktools/dk4rec26.h
blob: 8c5130ad01b58208f3df8b16842f3703cfea11e8 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
Copyright (C) 2017-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4rec26.ctr
*/

#ifndef DK4REC26_H_INCLUDED
/** Avoid multiple inclusions. */
#define DK4REC26_H_INCLUDED 1


#line 8 "dk4rec26.ctr"

/**	@file	dk4rec26.h	Recode characters to unsigned long.
	We can not simply convert unsing the (unsigned long) cast
	as on some systems wchar_t may be a signed integer type
	and unsigned long may be larger than 32 bits.

	Promoting negative wchar_t or wxChar values to 64 bit
	unsigned long will result in conversions for instance from
	wchar_t=0xFFFE0000 to ul=0xFFFFFFFFFFFE0000.

	So after an (unsigned long) cast we have to apply a mask,
	i.e. 0xFFFFFFFFUL when wchar_t is 4 bytes long or
	0xFFFFU when wchar_t is 2 bytes long.
*/

#ifndef	DK4CONF_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
#else
#include <dktools-4/dk4conf.h>
#endif
#endif

#ifndef	DK4TYPES_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4types.h"
#else
#include <dktools-4/dk4types.h>
#endif
#endif



#ifdef	__cplusplus
extern "C" {
#endif

/**	Convert char to unsigned long.
	@param	back	Character to convert.
	@return	Conversion result.
*/
unsigned long
dk4recode_char_to_ul(unsigned long back);

/**	Convert 16 bit character to unsigned long.
	@param	back	Character to convert.
	@return	Conversion result.
*/
unsigned long
dk4recode_c16_to_ul(unsigned long back);

/**	Convert 32 bit character to unsigned long.
	@param	back	Character to convert.
	@return	Conversion result.
*/
unsigned long
dk4recode_c32_to_ul(unsigned long back);

/**	Convert dkChar to unsigned long.
	@param	back	Character to convert.
	@return	Conversion result.
*/
unsigned long
dk4recode_dk_to_ul(unsigned long back);

/**	Convert wchar_t to unsigned long.
	@param	back	Character to convert.
	@return	Conversion result.
*/
unsigned long
dk4recode_wc_to_ul(unsigned long back);

#if 0

/**	Convert wxChar to unsigned long.
	@param	back	Character to convert.
	@return	Conversion result.
*/
unsigned long
dk4recode_wx_to_ul(unsigned long back);

#endif

#ifdef	__cplusplus
}
#endif


#endif