ObjFW  Check-in [7c7656f0ae]

Overview
Comment:OFColor: Fix shadowing of variable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7c7656f0ae77caacf8e765fae63c306526e771c6a157f34bef2611df0efbae3c
User & Date: js on 2020-05-21 22:18:39
Other Links: manifest | tags
Context
2020-05-21
23:18
OFStdIOStream: Add more terminal control methods check-in: 36960e428a user: js tags: trunk
22:18
OFColor: Fix shadowing of variable check-in: 7c7656f0ae user: js tags: trunk
17:58
OFStdIOStream: Add support for setting fg/bg color check-in: 30d639a494 user: js tags: trunk
Changes

Modified src/OFColor.m from [2fc8a36876] to [eeffafbeab].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#import "once.h"

#import "OFInvalidArgumentException.h"

@implementation OFColor
#define PREDEFINED_COLOR(name, r, g, b)					\
	static OFColor *name = nil;					\
									\
	static void							\
	initPredefinedColor_##name(void)				\
	{								\
		name = [[OFColor alloc] initWithRed: r			\
					      green: g			\
					       blue: b			\
					      alpha: 1];		\
	}								\
									\
	+ (OFColor *)name						\
	{								\
		static of_once_t onceControl = OF_ONCE_INIT;		\
		of_once(&onceControl, initPredefinedColor_##name);	\
									\
		return name;						\
	}

PREDEFINED_COLOR(black,   0.00, 0.00, 0.00)
PREDEFINED_COLOR(silver,  0.75, 0.75, 0.75)
PREDEFINED_COLOR(grey,    0.50, 0.50, 0.50)
PREDEFINED_COLOR(white,   1.00, 1.00, 1.00)
PREDEFINED_COLOR(maroon,  0.50, 0.00, 0.00)







|




|
|
|
|







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#import "once.h"

#import "OFInvalidArgumentException.h"

@implementation OFColor
#define PREDEFINED_COLOR(name, r, g, b)					\
	static OFColor *name##Color = nil;				\
									\
	static void							\
	initPredefinedColor_##name(void)				\
	{								\
		name##Color = [[OFColor alloc] initWithRed: r		\
						     green: g		\
						      blue: b		\
						     alpha: 1];		\
	}								\
									\
	+ (OFColor *)name						\
	{								\
		static of_once_t onceControl = OF_ONCE_INIT;		\
		of_once(&onceControl, initPredefinedColor_##name);	\
									\
		return name##Color;					\
	}

PREDEFINED_COLOR(black,   0.00, 0.00, 0.00)
PREDEFINED_COLOR(silver,  0.75, 0.75, 0.75)
PREDEFINED_COLOR(grey,    0.50, 0.50, 0.50)
PREDEFINED_COLOR(white,   1.00, 1.00, 1.00)
PREDEFINED_COLOR(maroon,  0.50, 0.00, 0.00)