XKBfileInt.h revision 4cd6a3ae
18c9fbc29Smrg#ifndef _XKBFILEINT_H_ 28c9fbc29Smrg#define _XKBFILEINT_H_ 1 38c9fbc29Smrg 48c9fbc29Smrg/************************************************************ 58c9fbc29Smrg Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. 68c9fbc29Smrg 78c9fbc29Smrg Permission to use, copy, modify, and distribute this 88c9fbc29Smrg software and its documentation for any purpose and without 98c9fbc29Smrg fee is hereby granted, provided that the above copyright 108c9fbc29Smrg notice appear in all copies and that both that copyright 118c9fbc29Smrg notice and this permission notice appear in supporting 124cd6a3aeSmrg documentation, and that the name of Silicon Graphics not be 134cd6a3aeSmrg used in advertising or publicity pertaining to distribution 148c9fbc29Smrg of the software without specific prior written permission. 154cd6a3aeSmrg Silicon Graphics makes no representation about the suitability 168c9fbc29Smrg of this software for any purpose. It is provided "as is" 178c9fbc29Smrg without any express or implied warranty. 184cd6a3aeSmrg 194cd6a3aeSmrg SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 204cd6a3aeSmrg SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 218c9fbc29Smrg AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 224cd6a3aeSmrg GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 234cd6a3aeSmrg DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 244cd6a3aeSmrg DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 258c9fbc29Smrg OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 268c9fbc29Smrg THE USE OR PERFORMANCE OF THIS SOFTWARE. 278c9fbc29Smrg 288c9fbc29Smrg ********************************************************/ 298c9fbc29Smrg 308c9fbc29Smrg#include "XKBfile.h" 314e411241Smrg#include <string.h> 328c9fbc29Smrg 338c9fbc29Smrg#ifdef DEBUG 348c9fbc29Smrg#define _XkbLibError(c,l,d) \ 358c9fbc29Smrg { fprintf(stderr,"xkbfile: %s in %s\n",_XkbErrMessages[c],(l)); \ 368c9fbc29Smrg _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } 378c9fbc29Smrg#else 388c9fbc29Smrg#define _XkbLibError(c,l,d) \ 398c9fbc29Smrg { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } 408c9fbc29Smrg#endif 418c9fbc29Smrg 428c9fbc29Smrg#ifndef XKB_IN_SERVER 438c9fbc29Smrg 448c9fbc29Smrg#define _XkbAlloc(s) malloc((s)) 458c9fbc29Smrg#define _XkbCalloc(n,s) calloc((n),(s)) 468c9fbc29Smrg#define _XkbRealloc(o,s) realloc((o),(s)) 478c9fbc29Smrg#define _XkbTypedAlloc(t) ((t *)malloc(sizeof(t))) 488c9fbc29Smrg#define _XkbTypedCalloc(n,t) ((t *)calloc((n),sizeof(t))) 498c9fbc29Smrg#define _XkbTypedRealloc(o,n,t) \ 508c9fbc29Smrg ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) 518c9fbc29Smrg#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) 528c9fbc29Smrg#define _XkbFree(p) free(p) 538c9fbc29Smrg 548c9fbc29Smrg#ifndef PATH_MAX 558c9fbc29Smrg#ifdef MAXPATHLEN 568c9fbc29Smrg#define PATH_MAX MAXPATHLEN 578c9fbc29Smrg#else 588c9fbc29Smrg#define PATH_MAX 1024 598c9fbc29Smrg#endif 608c9fbc29Smrg#endif 618c9fbc29Smrg 628c9fbc29Smrg#endif 638c9fbc29Smrg 648c9fbc29Smrg_XFUNCPROTOBEGIN 658c9fbc29Smrg 664e411241Smrgstatic inline 674e411241Smrgchar *_XkbDupString(const char *s) 684e411241Smrg{ 694e411241Smrg return s ? strdup(s) : NULL; 704e411241Smrg} 718c9fbc29Smrg 728c9fbc29Smrg#define _XkbStrCaseEqual(s1,s2) (_XkbStrCaseCmp(s1,s2)==0) 738c9fbc29Smrg 748c9fbc29Smrg#ifdef NEED_STRCASECMP 758c9fbc29Smrgextern int _XkbStrCaseCmp(char *s1, char *s2); 768c9fbc29Smrg#else 778c9fbc29Smrg#define _XkbStrCaseCmp strcasecmp 784cd6a3aeSmrg#include <strings.h> 798c9fbc29Smrg#endif 808c9fbc29Smrg 818c9fbc29Smrg_XFUNCPROTOEND 828c9fbc29Smrg 838c9fbc29Smrg#endif /* _XKBFILEINT_H_ */ 84