304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
1 |
/*
|
554.1.6
by Matthew Fuller
Collapse away redundant license texts in most .h files. These are all |
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
|
|
1
by Claude Lecommandeur
CTWM version 1.1 |
9 |
*
|
10 |
* $XConsortium: util.h,v 1.10 89/12/10 17:47:04 jim Exp $
|
|
11 |
*
|
|
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
12 |
* 28-Oct-87 Thomas E. LaStrange File created
|
1
by Claude Lecommandeur
CTWM version 1.1 |
13 |
*
|
554.1.6
by Matthew Fuller
Collapse away redundant license texts in most .h files. These are all |
14 |
* Copyright 1992 Claude Lecommandeur.
|
15 |
*/
|
|
1
by Claude Lecommandeur
CTWM version 1.1 |
16 |
|
484
by Matthew Fuller
Consistently rename all the include guards so they match the filename, |
17 |
#ifndef _CTWM_UTIL_H
|
18 |
#define _CTWM_UTIL_H
|
|
1
by Claude Lecommandeur
CTWM version 1.1 |
19 |
|
435.1.17
by Matthew Fuller
Make of these files were only including ctype.h because it's needed by |
20 |
#include <ctype.h> |
521.1.54
by Matthew Fuller
tracefile is used broadly across the code for debug output. Move it |
21 |
#include <stdio.h> |
435.1.17
by Matthew Fuller
Make of these files were only including ctype.h because it's needed by |
22 |
|
614.2.5
by Matthew Fuller
Move max/min inlines to util.h alongside our extant MAX/MIN macros, |
23 |
|
24 |
/* Simple int utils */
|
|
25 |
static inline int max(int a, int b) |
|
26 |
{
|
|
27 |
return a > b ? a : b; |
|
28 |
}
|
|
29 |
||
30 |
static inline int min(int a, int b) |
|
31 |
{
|
|
32 |
return a < b ? a : b; |
|
33 |
}
|
|
34 |
||
240.1.2
by Rhialto
3 - Selected a number of cleanups from Stefan Monnier |
35 |
#ifndef MAX
|
614.2.5
by Matthew Fuller
Move max/min inlines to util.h alongside our extant MAX/MIN macros, |
36 |
#define MAX(x,y) (max(x,y))
|
240.1.2
by Rhialto
3 - Selected a number of cleanups from Stefan Monnier |
37 |
#endif
|
38 |
#ifndef MIN
|
|
614.2.5
by Matthew Fuller
Move max/min inlines to util.h alongside our extant MAX/MIN macros, |
39 |
#define MIN(x,y) (min(x,y))
|
240.1.2
by Rhialto
3 - Selected a number of cleanups from Stefan Monnier |
40 |
#endif
|
41 |
#ifndef ABS
|
|
42 |
#define ABS(x) ((x)<0?-(x):(x))
|
|
43 |
#endif
|
|
44 |
||
266
by Olaf 'Rhialto' Seibert
Avoid arguments of type 'char' to the isascii() etc macros. |
45 |
/*
|
46 |
* Define some helper macros, because "The argument to toupper() must be
|
|
47 |
* EOF or representable as an unsigned char; otherwise, the behavior is
|
|
48 |
* undefined." In particular, an argument of type "char" is problematic
|
|
49 |
* (gcc: warning: array subscript has type 'char').
|
|
50 |
*/
|
|
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
51 |
#define Isascii(c) isascii((int)(unsigned char)(c))
|
52 |
#define Isdigit(c) isdigit((int)(unsigned char)(c))
|
|
53 |
#define Islower(c) islower((int)(unsigned char)(c))
|
|
54 |
#define Isupper(c) isupper((int)(unsigned char)(c))
|
|
55 |
#define Tolower(c) tolower((int)(unsigned char)(c))
|
|
56 |
#define Toupper(c) toupper((int)(unsigned char)(c))
|
|
266
by Olaf 'Rhialto' Seibert
Avoid arguments of type 'char' to the isascii() etc macros. |
57 |
|
481.1.7
by Matthew Fuller
Get rid of some more extern prototypes. |
58 |
char *ExpandFilename(const char *name); |
59 |
char *ExpandFilePath(char *path); |
|
9
by Claude Lecommandeur
CTWM version 3.1 |
60 |
|
508
by Matthew Fuller
const-ify GetColor(). |
61 |
void GetColor(int kind, Pixel *what, const char *name); |
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
62 |
void GetShadeColors(ColorPair *cp); |
492.2.2
by Matthew Fuller
Convert various exported util.c funcs to C99 bool from X Bool. This |
63 |
bool UpdateFont(MyFont *font, int height); |
648.1.9
by Matthew Fuller
Move CreateFonts() over to util.c alongside the other related font |
64 |
void CreateFonts(ScreenInfo *scr); |
520.1.1
by Matthew Fuller
These functions appear to have been unused for several years at least, |
65 |
#if 0
|
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
66 |
void move_to_after(TwmWindow *t, TwmWindow *after);
|
520.1.1
by Matthew Fuller
These functions appear to have been unused for several years at least, |
67 |
#endif
|
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
68 |
void RescueWindows(void); |
69 |
void DebugTrace(char *file); |
|
1
by Claude Lecommandeur
CTWM version 1.1 |
70 |
|
93
by Richard Levitte
- Convert all functions to use proper prototypes. |
71 |
|
503.1.43
by Matthew Fuller
Rename safecopy() to safe_strncpy(), move it to util.c where it better |
72 |
void safe_strncpy(char *dest, const char *src, size_t size); |
18
by Claude Lecommandeur
CTWM version 3.5.2b |
73 |
|
521.1.54
by Matthew Fuller
tracefile is used broadly across the code for debug output. Move it |
74 |
extern FILE *tracefile; |
75 |
||
484
by Matthew Fuller
Consistently rename all the include guards so they match the filename, |
76 |
#endif /* _CTWM_UTIL_H */ |