util.h revision 0bbfda8a
1/*
2 * utility routines header file
3 *
4 *
5 *        Copyright 1988 by Evans & Sutherland Computer Corporation,
6 *                           Salt Lake City, Utah
7 *   Portions Copyright 1989 by the Massachusetts Institute of Technology
8 *                         Cambridge, Massachusetts
9 *
10 * $XConsortium: util.h,v 1.10 89/12/10 17:47:04 jim Exp $
11 *
12 * 28-Oct-87 Thomas E. LaStrange                File created
13 *
14 * Copyright 1992 Claude Lecommandeur.
15 */
16
17#ifndef _CTWM_UTIL_H
18#define _CTWM_UTIL_H
19
20#include <ctype.h>
21#include <stdio.h>
22
23#ifndef MAX
24#define MAX(x,y) ((x)>(y)?(x):(y))
25#endif
26#ifndef MIN
27#define MIN(x,y) ((x)<(y)?(x):(y))
28#endif
29#ifndef ABS
30#define ABS(x) ((x)<0?-(x):(x))
31#endif
32
33/*
34 * Define some helper macros, because "The argument to toupper() must be
35 * EOF or representable as an unsigned char; otherwise, the behavior is
36 * undefined." In particular, an argument of type "char" is problematic
37 * (gcc:  warning: array subscript has type 'char').
38 */
39#define Isascii(c)      isascii((int)(unsigned char)(c))
40#define Isdigit(c)      isdigit((int)(unsigned char)(c))
41#define Islower(c)      islower((int)(unsigned char)(c))
42#define Isupper(c)      isupper((int)(unsigned char)(c))
43#define Tolower(c)      tolower((int)(unsigned char)(c))
44#define Toupper(c)      toupper((int)(unsigned char)(c))
45
46char     *ExpandFilename(const char *name);
47char     *ExpandFilePath(char *path);
48
49void GetColor(int kind, Pixel *what, const char *name);
50void GetShadeColors(ColorPair *cp);
51void GetFont(MyFont *font);
52bool UpdateFont(MyFont *font, int height);
53#if 0
54void move_to_after(TwmWindow *t, TwmWindow *after);
55#endif
56void RescueWindows(void);
57void DebugTrace(char *file);
58
59
60void safe_strncpy(char *dest, const char *src, size_t size);
61
62extern FILE *tracefile;
63
64#endif /* _CTWM_UTIL_H */
65