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
438c9fbc29Smrg#define	_XkbAlloc(s)		malloc((s))
448c9fbc29Smrg#define	_XkbCalloc(n,s)		calloc((n),(s))
458c9fbc29Smrg#define	_XkbRealloc(o,s)	realloc((o),(s))
468c9fbc29Smrg#define	_XkbTypedAlloc(t)	((t *)malloc(sizeof(t)))
478c9fbc29Smrg#define	_XkbTypedCalloc(n,t)	((t *)calloc((n),sizeof(t)))
488c9fbc29Smrg#define	_XkbTypedRealloc(o,n,t) \
498c9fbc29Smrg	((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
508c9fbc29Smrg#define	_XkbClearElems(a,f,l,t)	bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
518c9fbc29Smrg#define	_XkbFree(p)		free(p)
528c9fbc29Smrg
538c9fbc29Smrg#ifndef PATH_MAX
548c9fbc29Smrg#ifdef MAXPATHLEN
558c9fbc29Smrg#define PATH_MAX MAXPATHLEN
568c9fbc29Smrg#else
578c9fbc29Smrg#define PATH_MAX 1024
588c9fbc29Smrg#endif
598c9fbc29Smrg#endif
608c9fbc29Smrg
618c9fbc29Smrg
628c9fbc29Smrg_XFUNCPROTOBEGIN
638c9fbc29Smrg
6470728a38Smrgstatic inline char *
6570728a38Smrg_XkbDupString(const char *s)
664e411241Smrg{
674e411241Smrg    return s ? strdup(s) : NULL;
684e411241Smrg}
698c9fbc29Smrg
708c9fbc29Smrg#define _XkbStrCaseEqual(s1,s2)	(_XkbStrCaseCmp(s1,s2)==0)
718c9fbc29Smrg
7254cef2ddSmrg#ifndef HAVE_STRCASECMP
738c9fbc29Smrgextern int _XkbStrCaseCmp(char *s1, char *s2);
748c9fbc29Smrg#else
758c9fbc29Smrg#define _XkbStrCaseCmp strcasecmp
764cd6a3aeSmrg#include <strings.h>
778c9fbc29Smrg#endif
788c9fbc29Smrg
798c9fbc29Smrg_XFUNCPROTOEND
8070728a38Smrg#endif                          /* _XKBFILEINT_H_ */
81