EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

StdLib/LibC/Locale/__wctoint.h

Go to the documentation of this file.
00001 /* $NetBSD: __wctoint.h,v 1.1 2001/09/28 11:25:37 yamt Exp $ */
00002 
00003 /*-
00004  * Copyright (c)2001 Citrus Project,
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00017  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00019  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00020  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00022  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00023  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00024  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00025  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00026  * SUCH DAMAGE.
00027  *
00028  *      $Citrus: xpg4dl/FreeBSD/lib/libc/locale/__wctoint.h,v 1.1 2001/09/21 13:52:32 yamt Exp $
00029  */
00030 
00031 
00032 __inline static int
00033 __wctoint(wchar_t wc)
00034 {
00035         int n;
00036 
00037         /* XXX I expect compiler to optimize this. :D */
00038         switch (wc) {
00039         case L'0': n = 0; break;
00040         case L'1': n = 1; break;
00041         case L'2': n = 2; break;
00042         case L'3': n = 3; break;
00043         case L'4': n = 4; break;
00044         case L'5': n = 5; break;
00045         case L'6': n = 6; break;
00046         case L'7': n = 7; break;
00047         case L'8': n = 8; break;
00048         case L'9': n = 9; break;
00049         case L'A': case L'a': n = 10; break;
00050         case L'B': case L'b': n = 11; break;
00051         case L'C': case L'c': n = 12; break;
00052         case L'D': case L'd': n = 13; break;
00053         case L'E': case L'e': n = 14; break;
00054         case L'F': case L'f': n = 15; break;
00055         case L'G': case L'g': n = 16; break;
00056         case L'H': case L'h': n = 17; break;
00057         case L'I': case L'i': n = 18; break;
00058         case L'J': case L'j': n = 19; break;
00059         case L'K': case L'k': n = 20; break;
00060         case L'L': case L'l': n = 21; break;
00061         case L'M': case L'm': n = 22; break;
00062         case L'N': case L'n': n = 23; break;
00063         case L'O': case L'o': n = 24; break;
00064         case L'P': case L'p': n = 25; break;
00065         case L'Q': case L'q': n = 26; break;
00066         case L'R': case L'r': n = 27; break;
00067         case L'S': case L's': n = 28; break;
00068         case L'T': case L't': n = 29; break;
00069         case L'U': case L'u': n = 30; break;
00070         case L'V': case L'v': n = 31; break;
00071         case L'W': case L'w': n = 32; break;
00072         case L'X': case L'x': n = 33; break;
00073         case L'Y': case L'y': n = 34; break;
00074         case L'Z': case L'z': n = 35; break;
00075         default: n = -1; break; /* error */
00076         }
00077 
00078         return n;
00079 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines