miscutil.c revision 23a0898a
1/* $Xorg: miscutil.c,v 1.4 2001/02/09 02:04:04 xorgcvs Exp $ */
2
3/*
4
5Copyright 1991, 1994, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included
14in all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of The Open Group shall
25not be used in advertising or otherwise to promote the sale, use or
26other dealings in this Software without prior written authorization
27from The Open Group.
28
29*/
30/* $XFree86: xc/lib/font/util/miscutil.c,v 1.7 2001/07/25 15:04:57 dawes Exp $ */
31
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35#include <X11/Xosdefs.h>
36#include <stdlib.h>
37#include <X11/fonts/fontmisc.h>
38#include "stubs.h"
39
40#define XK_LATIN1
41#include    <X11/keysymdef.h>
42
43
44#ifdef __SUNPRO_C
45#pragma weak serverGeneration
46#pragma weak Xalloc
47#pragma weak Xrealloc
48#pragma weak Xfree
49#pragma weak Xcalloc
50#pragma weak CopyISOLatin1Lowered
51#pragma weak register_fpe_functions
52#endif
53
54/* make sure everything initializes themselves at least once */
55weak long serverGeneration = 1;
56
57weak void *
58Xalloc (unsigned long m)
59{
60    return malloc (m);
61}
62
63weak void *
64Xrealloc (void *n, unsigned long m)
65{
66    if (!n)
67	return malloc (m);
68    else
69	return realloc (n, m);
70}
71
72weak void
73Xfree (void *n)
74{
75    if (n)
76	free (n);
77}
78
79weak void *
80Xcalloc (unsigned long n)
81{
82    return calloc (n, 1);
83}
84
85weak void
86CopyISOLatin1Lowered (char *dst, char *src, int len)
87{
88    register unsigned char *dest, *source;
89
90    for (dest = (unsigned char *)dst, source = (unsigned char *)src;
91	 *source && len > 0;
92	 source++, dest++, len--)
93    {
94	if ((*source >= XK_A) && (*source <= XK_Z))
95	    *dest = *source + (XK_a - XK_A);
96	else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis))
97	    *dest = *source + (XK_agrave - XK_Agrave);
98	else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn))
99	    *dest = *source + (XK_oslash - XK_Ooblique);
100	else
101	    *dest = *source;
102    }
103    *dest = '\0';
104}
105
106weak void
107register_fpe_functions ()
108{
109}
110