util.h revision 0bbfda8a
10bbfda8aSnia/*
20bbfda8aSnia * utility routines header file
3645f5050Syouri *
4645f5050Syouri *
50bbfda8aSnia *        Copyright 1988 by Evans & Sutherland Computer Corporation,
60bbfda8aSnia *                           Salt Lake City, Utah
70bbfda8aSnia *   Portions Copyright 1989 by the Massachusetts Institute of Technology
80bbfda8aSnia *                         Cambridge, Massachusetts
9645f5050Syouri *
10645f5050Syouri * $XConsortium: util.h,v 1.10 89/12/10 17:47:04 jim Exp $
11645f5050Syouri *
120bbfda8aSnia * 28-Oct-87 Thomas E. LaStrange                File created
13645f5050Syouri *
140bbfda8aSnia * Copyright 1992 Claude Lecommandeur.
150bbfda8aSnia */
16645f5050Syouri
170bbfda8aSnia#ifndef _CTWM_UTIL_H
180bbfda8aSnia#define _CTWM_UTIL_H
19645f5050Syouri
200bbfda8aSnia#include <ctype.h>
210bbfda8aSnia#include <stdio.h>
22645f5050Syouri
230bbfda8aSnia#ifndef MAX
240bbfda8aSnia#define MAX(x,y) ((x)>(y)?(x):(y))
250bbfda8aSnia#endif
260bbfda8aSnia#ifndef MIN
270bbfda8aSnia#define MIN(x,y) ((x)<(y)?(x):(y))
280bbfda8aSnia#endif
290bbfda8aSnia#ifndef ABS
300bbfda8aSnia#define ABS(x) ((x)<0?-(x):(x))
31645f5050Syouri#endif
32645f5050Syouri
33645f5050Syouri/*
34645f5050Syouri * Define some helper macros, because "The argument to toupper() must be
35645f5050Syouri * EOF or representable as an unsigned char; otherwise, the behavior is
36645f5050Syouri * undefined." In particular, an argument of type "char" is problematic
37645f5050Syouri * (gcc:  warning: array subscript has type 'char').
38645f5050Syouri */
390bbfda8aSnia#define Isascii(c)      isascii((int)(unsigned char)(c))
400bbfda8aSnia#define Isdigit(c)      isdigit((int)(unsigned char)(c))
410bbfda8aSnia#define Islower(c)      islower((int)(unsigned char)(c))
420bbfda8aSnia#define Isupper(c)      isupper((int)(unsigned char)(c))
430bbfda8aSnia#define Tolower(c)      tolower((int)(unsigned char)(c))
440bbfda8aSnia#define Toupper(c)      toupper((int)(unsigned char)(c))
45645f5050Syouri
460bbfda8aSniachar     *ExpandFilename(const char *name);
470bbfda8aSniachar     *ExpandFilePath(char *path);
48645f5050Syouri
490bbfda8aSniavoid GetColor(int kind, Pixel *what, const char *name);
500bbfda8aSniavoid GetShadeColors(ColorPair *cp);
51645f5050Syourivoid GetFont(MyFont *font);
520bbfda8aSniabool UpdateFont(MyFont *font, int height);
530bbfda8aSnia#if 0
540bbfda8aSniavoid move_to_after(TwmWindow *t, TwmWindow *after);
55645f5050Syouri#endif
560bbfda8aSniavoid RescueWindows(void);
570bbfda8aSniavoid DebugTrace(char *file);
58645f5050Syouri
59645f5050Syouri
600bbfda8aSniavoid safe_strncpy(char *dest, const char *src, size_t size);
61645f5050Syouri
620bbfda8aSniaextern FILE *tracefile;
63645f5050Syouri
640bbfda8aSnia#endif /* _CTWM_UTIL_H */
65