OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [ctype/] [toupper.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/*
2
FUNCTION
3
        <<toupper>>---translate characters to upper case
4
 
5
INDEX
6
        toupper
7
INDEX
8
        _toupper
9
 
10
ANSI_SYNOPSIS
11
        #include <ctype.h>
12
        int toupper(int <[c]>);
13
        int _toupper(int <[c]>);
14
 
15
TRAD_SYNOPSIS
16
        #include <ctype.h>
17
        int toupper(<[c]>);
18
        int _toupper(<[c]>);
19
 
20
 
21
DESCRIPTION
22
<<toupper>> is a macro which converts lower-case characters to upper
23
case, leaving all other characters unchanged.  It is only defined when
24
<[c]> is an integer in the range <<EOF>> to <<255>>.
25
 
26
You can use a compiled subroutine instead of the macro definition by
27
undefining this macro using `<<#undef toupper>>'.
28
 
29
<<_toupper>> performs the same conversion as <<toupper>>, but should
30
only be used when <[c]> is known to be a lowercase character (<<a>>--<<z>>).
31
 
32
RETURNS
33
<<toupper>> returns the upper-case equivalent of <[c]> when it is a
34
character between <<a>> and <<z>>, and <[c]> otherwise.
35
 
36
<<_toupper>> returns the upper-case equivalent of <[c]> when it is a
37
character between <<a>> and <<z>>.  If <[c]> is not one of these
38
characters, the behaviour of <<_toupper>> is undefined.
39
 
40
PORTABILITY
41
<<toupper>> is ANSI C.  <<_toupper>> is not recommended for portable programs.
42
 
43
No supporting OS subroutines are required.
44
*/
45
 
46
#include <_ansi.h>
47
#include <ctype.h>
48
 
49
#undef toupper
50
int
51
_DEFUN(toupper,(c),int c)
52
{
53
  return islower(c) ? c - 'a' + 'A' : c;
54
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.