home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / utility / toupper.c < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  2.0 KB  |  93 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: toupper.c,v 1.4 1996/10/24 22:51:46 aros Exp $
  4.     $Log: toupper.c,v $
  5.     Revision 1.4  1996/10/24 22:51:46  aros
  6.     Use proper Amiga datatypes (eg: ULONG not unsigned long)
  7.  
  8.     Revision 1.3  1996/10/24 15:51:39  aros
  9.     Use the official AROS macros over the __AROS versions.
  10.  
  11.     Revision 1.2  1996/09/13 17:16:35  digulla
  12.     Removed the macro TOUPPER. Use this library function instead
  13.  
  14.     Revision 1.1  1996/08/31 12:58:13  aros
  15.     Merged in/modified for FreeBSD.
  16.  
  17.  
  18.     Desc:
  19.     Lang: english
  20. */
  21. #include <exec/types.h>
  22. #include <aros/libcall.h>
  23. #include "utility_intern.h"
  24.  
  25. /*****************************************************************************
  26.  
  27.     NAME */
  28.     #include <clib/utility_protos.h>
  29.  
  30.     AROS_LH1I(UBYTE, ToUpper,
  31.  
  32. /*  SYNOPSIS */
  33.     AROS_LHA(ULONG, character, D0),
  34.  
  35. /*  LOCATION */
  36.     struct UtilityBase *, UtilityBase, 29, Utility)
  37.  
  38. /*  FUNCTION
  39.     Convert a character to uppercase
  40.  
  41.     INPUTS
  42.     character   - The character that you want changed.
  43.  
  44.     RESULT
  45.     The uppercase version of that character.
  46.  
  47.     NOTES
  48.     Currently only works for ASCII characters. Would not be difficult
  49.     to adapt for other character sets (Unicode for example).
  50.  
  51.     This function is patched by the locale.library, so you should be
  52.     prepared for different results when running under different
  53.     languages.
  54.  
  55.     EXAMPLE
  56.     STRPTR string; UBYTE chr;
  57.  
  58.     \* Convert a string to uppercase *\
  59.     while( chr = *string )
  60.     {
  61.         *string = ToUpper( chr );
  62.         string++;
  63.     }
  64.  
  65.     BUGS
  66.  
  67.     SEE ALSO
  68.     utility/ToLower()
  69.  
  70.     INTERNALS
  71.     This function is patched by locale.library.
  72.  
  73.     HISTORY
  74.     29-10-95    digulla automatically created from
  75.                 utility_lib.fd and clib/utility_protos.h
  76.     10-08-96    iaint   Created from tolower.c from AROSdev15
  77. *****************************************************************************/
  78. {
  79.     AROS_LIBFUNC_INIT
  80.  
  81.     return
  82.     (
  83.     (character >= 'a' && character <= 'z')
  84.     || (character >= 0xE0
  85.         && character <= 0xEE
  86.         && character != 0xE7)
  87.     ? character - 0x20
  88.     : character
  89.     );
  90.  
  91.     AROS_LIBFUNC_EXIT
  92. } /* ToLower */
  93.