OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [ctype/] [towctrans.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/* Copyright (c) 2002 Red Hat Incorporated.
/* Copyright (c) 2002 Red Hat Incorporated.
   All rights reserved.
   All rights reserved.
 
 
   Redistribution and use in source and binary forms, with or without
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:
   modification, are permitted provided that the following conditions are met:
 
 
     Redistributions of source code must retain the above copyright
     Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
     notice, this list of conditions and the following disclaimer.
 
 
     Redistributions in binary form must reproduce the above copyright
     Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
     documentation and/or other materials provided with the distribution.
 
 
     The name of Red Hat Incorporated may not be used to endorse
     The name of Red Hat Incorporated may not be used to endorse
     or promote products derived from this software without specific
     or promote products derived from this software without specific
     prior written permission.
     prior written permission.
 
 
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   ARE DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
   ARE DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
*/
 
 
/*
/*
FUNCTION
FUNCTION
        <<towctrans>>---extensible wide-character translation
        <<towctrans>>---extensible wide-character translation
 
 
INDEX
INDEX
        towctrans
        towctrans
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <wctype.h>
        #include <wctype.h>
        wint_t towctrans(wint_t <[c]>, wctrans_t <[w]>);
        wint_t towctrans(wint_t <[c]>, wctrans_t <[w]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <wctype.h>
        #include <wctype.h>
        wint_t towctrans(<[c]>, <[w]>)
        wint_t towctrans(<[c]>, <[w]>)
        wint_t <[c]>;
        wint_t <[c]>;
        wctrans_t <[w]>;
        wctrans_t <[w]>;
 
 
 
 
DESCRIPTION
DESCRIPTION
<<towctrans>> is a function which converts wide characters based on
<<towctrans>> is a function which converts wide characters based on
a specified translation type <[w]>.  If the translation type is
a specified translation type <[w]>.  If the translation type is
invalid or cannot be applied to the current character, no change
invalid or cannot be applied to the current character, no change
to the character is made.
to the character is made.
 
 
RETURNS
RETURNS
<<towctrans>> returns the translated equivalent of <[c]> when it is a
<<towctrans>> returns the translated equivalent of <[c]> when it is a
valid for the given translation, otherwise, it returns the input character.
valid for the given translation, otherwise, it returns the input character.
When the translation type is invalid, <<errno>> is set <<EINVAL>>.
When the translation type is invalid, <<errno>> is set <<EINVAL>>.
 
 
PORTABILITY
PORTABILITY
<<towctrans>> is C99.
<<towctrans>> is C99.
 
 
No supporting OS subroutines are required.
No supporting OS subroutines are required.
*/
*/
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <string.h>
#include <string.h>
#include <reent.h>
#include <reent.h>
#include <wctype.h>
#include <wctype.h>
#include <errno.h>
#include <errno.h>
#include "local.h"
#include "local.h"
 
 
wint_t
wint_t
_DEFUN (_towctrans_r, (r, c, w),
_DEFUN (_towctrans_r, (r, c, w),
        struct _reent *r _AND
        struct _reent *r _AND
        wint_t c _AND
        wint_t c _AND
        wctrans_t w)
        wctrans_t w)
{
{
  if (w == WCT_TOLOWER)
  if (w == WCT_TOLOWER)
    return towlower (c);
    return towlower (c);
  else if (w == WCT_TOUPPER)
  else if (w == WCT_TOUPPER)
    return towupper (c);
    return towupper (c);
  else
  else
    {
    {
      r->_errno = EINVAL;
      r->_errno = EINVAL;
      return c;
      return c;
    }
    }
}
}
 
 
#ifndef _REENT_ONLY
#ifndef _REENT_ONLY
wint_t
wint_t
_DEFUN (towctrans, (c, w),
_DEFUN (towctrans, (c, w),
        wint_t c _AND
        wint_t c _AND
        wctrans_t w)
        wctrans_t w)
{
{
  return _towctrans_r (_REENT, c, w);
  return _towctrans_r (_REENT, c, w);
}
}
#endif /* !_REENT_ONLY */
#endif /* !_REENT_ONLY */
 
 

powered by: WebSVN 2.1.0

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