1 /* vi:set ts=8 sts=4 sw=4:
2  *
3  * Copyright (C) 2004 Xavier de Gaye.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program (see the file COPYING); if not, write to the
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
19  *
20  * $Id: misc.h 148 2007-07-21 16:35:40Z xavier $
21  */
22 
23 #ifndef MISC_H
24 # define MISC_H
25 
26 #ifndef __ARGS
27     /* The AIX VisualAge cc compiler defines __EXTENDED__ instead of __STDC__
28      * because it includes pre-ansi features. */
29 # if defined(__STDC__) || defined(__GNUC__) || defined(__EXTENDED__)
30 #  define __ARGS(x) x
31 # else
32 #  define __ARGS(x) ()
33 # endif
34 #endif
35 
36 /* memmove is not present on all systems, use memmove, bcopy, memcpy or our
37  * own version */
38 /* Some systems have (void *) arguments, some (char *). If we use (char *) it
39  * works for all */
40 #ifdef USEMEMMOVE
41 # define clewn_memmove(to, from, len) memmove((char *)(to), (char *)(from), len)
42 #else
43 # ifdef USEBCOPY
44 #  define clewn_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len)
45 # else
46 #  ifdef USEMEMCPY
47 #   define clewn_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len)
48 #  else
49 #   define CLEWN_MEMMOVE
50 void clewn_memmove __ARGS((void *, void *, size_t));
51 #  endif
52 # endif
53 #endif
54 
55 #ifdef HAVE_MEMSET
56 # define clewn_memset(ptr, c, size)   memset((ptr), (c), (size))
57 #else
58 void *clewn_memset __ARGS((void *, int, size_t));
59 #endif
60 
61 /*
62  * Maximum length of a path (for non-unix systems) Make it a bit long, to stay
63  * on the safe side.  But not too long to put on the stack.
64  */
65 #ifndef MAXPATHL
66 # ifdef MAXPATHLEN
67 #  define MAXPATHL	MAXPATHLEN
68 # else
69 #  define MAXPATHL	256
70 # endif
71 #endif
72 
73 /* gdb directory constants */
74 #define GDB_CDIR    "$cdir"
75 #define GDB_CWD	    "$cwd"
76 
77 void xatabort __ARGS((void (*)(void)));
78 void * xmalloc __ARGS((size_t));
79 void * xcalloc __ARGS((size_t));
80 void * xrealloc __ARGS((void *, size_t));
81 void xfree __ARGS((void *));
82 char * clewn_strsave __ARGS((char *));
83 char * clewn_strnsave __ARGS((char *, size_t));
84 void clewn_sleep __ARGS((int));
85 void clewn_beep __ARGS((void));
86 int clewn_getwd __ARGS((char *, int));
87 int clewn_fullpath __ARGS((char *, char *, int, int));
88 char * get_fullpath __ARGS((char *, char *, char *, char *, struct obstack *));
89 void clewn_exec(char *);
90 
91 #endif	/* MISC_H */
92 
93