Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
/* Copyright (c) 2002 Red Hat Incorporated.
2
   All rights reserved.
3
 
4
   Redistribution and use in source and binary forms, with or without
5
   modification, are permitted provided that the following conditions are met:
6
 
7
     Redistributions of source code must retain the above copyright
8
     notice, this list of conditions and the following disclaimer.
9
 
10
     Redistributions in binary form must reproduce the above copyright
11
     notice, this list of conditions and the following disclaimer in the
12
     documentation and/or other materials provided with the distribution.
13
 
14
     The name of Red Hat Incorporated may not be used to endorse
15
     or promote products derived from this software without specific
16
     prior written permission.
17
 
18
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
   ARE DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
22
   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
*/
29
 
30
/*
31
FUNCTION
32
	<>---extensible wide-character translation
33
 
34
INDEX
35
	towctrans
36
 
37
ANSI_SYNOPSIS
38
	#include 
39
	wint_t towctrans(wint_t <[c]>, wctrans_t <[w]>);
40
 
41
TRAD_SYNOPSIS
42
	#include 
43
	wint_t towctrans(<[c]>, <[w]>)
44
	wint_t <[c]>;
45
	wctrans_t <[w]>;
46
 
47
 
48
DESCRIPTION
49
<> is a function which converts wide characters based on
50
a specified translation type <[w]>.  If the translation type is
51
invalid or cannot be applied to the current character, no change
52
to the character is made.
53
 
54
RETURNS
55
<> returns the translated equivalent of <[c]> when it is a
56
valid for the given translation, otherwise, it returns the input character.
57
When the translation type is invalid, <> is set <>.
58
 
59
PORTABILITY
60
<> is C99.
61
 
62
No supporting OS subroutines are required.
63
*/
64
 
65
#include <_ansi.h>
66
#include 
67
#include 
68
#include 
69
#include 
70
#include "local.h"
71
 
72
wint_t
73
_DEFUN (_towctrans_r, (r, c, w),
74
	struct _reent *r _AND
75
	wint_t c _AND
76
	wctrans_t w)
77
{
78
  if (w == WCT_TOLOWER)
79
    return towlower (c);
80
  else if (w == WCT_TOUPPER)
81
    return towupper (c);
82
  else
83
    {
84
      r->_errno = EINVAL;
85
      return c;
86
    }
87
}
88
 
89
#ifndef _REENT_ONLY
90
wint_t
91
_DEFUN (towctrans, (c, w),
92
	wint_t c _AND
93
        wctrans_t w)
94
{
95
  return _towctrans_r (_REENT, c, w);
96
}
97
#endif /* !_REENT_ONLY */