1#ifndef _XKBFILEINT_H_ 2#define _XKBFILEINT_H_ 1 3 4/************************************************************ 5 Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. 6 7 Permission to use, copy, modify, and distribute this 8 software and its documentation for any purpose and without 9 fee is hereby granted, provided that the above copyright 10 notice appear in all copies and that both that copyright 11 notice and this permission notice appear in supporting 12 documentation, and that the name of Silicon Graphics not be 13 used in advertising or publicity pertaining to distribution 14 of the software without specific prior written permission. 15 Silicon Graphics makes no representation about the suitability 16 of this software for any purpose. It is provided "as is" 17 without any express or implied warranty. 18 19 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 20 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 21 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 22 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 23 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 24 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 25 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 26 THE USE OR PERFORMANCE OF THIS SOFTWARE. 27 28 ********************************************************/ 29 30#include "XKBfile.h" 31#include <string.h> 32 33#ifdef DEBUG 34#define _XkbLibError(c,l,d) \ 35 { fprintf(stderr,"xkbfile: %s in %s\n",_XkbErrMessages[c],(l)); \ 36 _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } 37#else 38#define _XkbLibError(c,l,d) \ 39 { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } 40#endif 41 42 43#define _XkbAlloc(s) malloc((s)) 44#define _XkbCalloc(n,s) calloc((n),(s)) 45#define _XkbRealloc(o,s) realloc((o),(s)) 46#define _XkbTypedAlloc(t) ((t *)malloc(sizeof(t))) 47#define _XkbTypedCalloc(n,t) ((t *)calloc((n),sizeof(t))) 48#define _XkbTypedRealloc(o,n,t) \ 49 ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) 50#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) 51#define _XkbFree(p) free(p) 52 53#ifndef PATH_MAX 54#ifdef MAXPATHLEN 55#define PATH_MAX MAXPATHLEN 56#else 57#define PATH_MAX 1024 58#endif 59#endif 60 61 62_XFUNCPROTOBEGIN 63 64static inline char * 65_XkbDupString(const char *s) 66{ 67 return s ? strdup(s) : NULL; 68} 69 70#define _XkbStrCaseEqual(s1,s2) (_XkbStrCaseCmp(s1,s2)==0) 71 72#ifndef HAVE_STRCASECMP 73extern int _XkbStrCaseCmp(char *s1, char *s2); 74#else 75#define _XkbStrCaseCmp strcasecmp 76#include <strings.h> 77#endif 78 79_XFUNCPROTOEND 80#endif /* _XKBFILEINT_H_ */ 81