Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -128,11 +128,11 @@ + (instancetype)valueWithBytes: (const void *)bytes objCType: (const char *)objCType OF_UNAVAILABLE; + (instancetype)valueWithPointer: (const void *)pointer OF_UNAVAILABLE; + (instancetype)valueWithNonretainedObject: (id)object OF_UNAVAILABLE; + (instancetype)valueWithRange: (OFRange)range OF_UNAVAILABLE; -+ (instancetype)valueWithPoint: (of_point_t)point OF_UNAVAILABLE; ++ (instancetype)valueWithPoint: (OFPoint)point OF_UNAVAILABLE; + (instancetype)valueWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; + (instancetype)valueWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; #endif /** @@ -244,11 +244,11 @@ - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType OF_UNAVAILABLE; - (instancetype)initWithPointer: (const void *)pointer OF_UNAVAILABLE; - (instancetype)initWithNonretainedObject: (id)object OF_UNAVAILABLE; - (instancetype)initWithRange: (OFRange)range OF_UNAVAILABLE; -- (instancetype)initWithPoint: (of_point_t)point OF_UNAVAILABLE; +- (instancetype)initWithPoint: (OFPoint)point OF_UNAVAILABLE; - (instancetype)initWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; - (instancetype)initWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; #endif /** Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -141,33 +141,33 @@ * @brief A time interval in seconds. */ typedef double OFTimeInterval; /** - * @struct of_point_t OFObject.h ObjFW/OFObject.h + * @struct OFPoint OFObject.h ObjFW/OFObject.h * * @brief A point. */ -struct OF_BOXABLE of_point_t { +struct OF_BOXABLE OFPoint { /** The x coordinate of the point */ float x; /** The y coordinate of the point */ float y; }; -typedef struct of_point_t of_point_t; +typedef struct OFPoint OFPoint; /** - * @brief Creates a new of_point_t. + * @brief Creates a new OFPoint. * * @param x The x coordinate of the point * @param y The x coordinate of the point - * @return An of_point_t with the specified coordinates + * @return An OFPoint with the specified coordinates */ -static OF_INLINE of_point_t OF_CONST_FUNC -of_point(float x, float y) +static OF_INLINE OFPoint OF_CONST_FUNC +OFMakePoint(float x, float y) { - of_point_t point = { x, y }; + OFPoint point = { x, y }; return point; } /** @@ -176,11 +176,11 @@ * @param point1 The first point for the comparison * @param point2 The second point for the comparison * @return Whether the two points are equal */ static OF_INLINE bool -of_point_equal(of_point_t point1, of_point_t point2) +OFEqualPoints(OFPoint point1, OFPoint point2) { if (point1.x != point2.x) return false; if (point1.y != point2.y) @@ -241,11 +241,11 @@ * * @brief A rectangle. */ struct OF_BOXABLE of_rectangle_t { /** The point from where the rectangle originates */ - of_point_t origin; + OFPoint origin; /** The size of the rectangle */ of_dimension_t size; }; typedef struct of_rectangle_t of_rectangle_t; @@ -260,11 +260,11 @@ */ static OF_INLINE of_rectangle_t OF_CONST_FUNC of_rectangle(float x, float y, float width, float height) { of_rectangle_t rectangle = { - of_point(x, y), + OFMakePoint(x, y), of_dimension(width, height) }; return rectangle; } @@ -277,11 +277,11 @@ * @return Whether the two rectangles are equal */ static OF_INLINE bool of_rectangle_equal(of_rectangle_t rectangle1, of_rectangle_t rectangle2) { - if (!of_point_equal(rectangle1.origin, rectangle2.origin)) + if (!OFEqualPoints(rectangle1.origin, rectangle2.origin)) return false; if (!of_dimension_equal(rectangle1.size, rectangle2.size)) return false; Index: src/OFPointValue.h ================================================================== --- src/OFPointValue.h +++ src/OFPointValue.h @@ -17,12 +17,12 @@ OF_ASSUME_NONNULL_BEGIN @interface OFPointValue: OFValue { - of_point_t _point; + OFPoint _point; } -- (instancetype)initWithPoint: (of_point_t)point; +- (instancetype)initWithPoint: (OFPoint)point; @end OF_ASSUME_NONNULL_END Index: src/OFPointValue.m ================================================================== --- src/OFPointValue.m +++ src/OFPointValue.m @@ -20,11 +20,11 @@ #import "OFOutOfRangeException.h" @implementation OFPointValue @synthesize pointValue = _point; -- (instancetype)initWithPoint: (of_point_t)point +- (instancetype)initWithPoint: (OFPoint)point { self = [super init]; _point = point; @@ -31,11 +31,11 @@ return self; } - (const char *)objCType { - return @encode(of_point_t); + return @encode(OFPoint); } - (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_point)) @@ -45,8 +45,8 @@ } - (OFString *)description { return [OFString stringWithFormat: - @"", _point.x, _point.y]; + @"", _point.x, _point.y]; } @end Index: src/OFStdIOStream.h ================================================================== --- src/OFStdIOStream.h +++ src/OFStdIOStream.h @@ -116,19 +116,19 @@ * @brief Moves the cursor to the specified absolute position. Does nothing if * there is no underlying terminal. * * @param position The position to move the cursor to */ -- (void)setCursorPosition: (of_point_t)position; +- (void)setCursorPosition: (OFPoint)position; /** * @brief Moves the cursor to the specified relative position. Does nothing if * there is no underlying terminal. * * @param position The position to move the cursor to */ -- (void)setRelativeCursorPosition: (of_point_t)position; +- (void)setRelativeCursorPosition: (OFPoint)position; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -491,11 +491,11 @@ [self writeFormat: @"\033[%uG", column + 1]; #endif } -- (void)setCursorPosition: (of_point_t)position +- (void)setCursorPosition: (OFPoint)position { if (position.x < 0 || position.y < 0) @throw [OFInvalidArgumentException exception]; #ifdef HAVE_ISATTY @@ -505,11 +505,11 @@ [self writeFormat: @"\033[%u;%uH", (unsigned)position.y + 1, (unsigned)position.x + 1]; #endif } -- (void)setRelativeCursorPosition: (of_point_t)position +- (void)setRelativeCursorPosition: (OFPoint)position { #ifdef HAVE_ISATTY if (!isatty(_fd)) return; Index: src/OFValue.h ================================================================== --- src/OFValue.h +++ src/OFValue.h @@ -56,11 +56,11 @@ /** * @brief The value as a point. * * If the value is not point-sized, @ref OFOutOfRangeException is thrown. */ -@property (readonly, nonatomic) of_point_t pointValue; +@property (readonly, nonatomic) OFPoint pointValue; /** * @brief The value as a dimension. * * If the value is not dimension-sized, @ref OFOutOfRangeException is thrown. @@ -119,11 +119,11 @@ * @brief Creates a new, autoreleased OFValue containing the specified point. * * @param point The point the OFValue should contain * @return A new, autoreleased OFValue */ -+ (instancetype)valueWithPoint: (of_point_t)point; ++ (instancetype)valueWithPoint: (OFPoint)point; /** * @brief Creates a new, autoreleased OFValue containing the specified * dimension. * Index: src/OFValue.m ================================================================== --- src/OFValue.m +++ src/OFValue.m @@ -56,11 +56,11 @@ + (instancetype)valueWithRange: (OFRange)range { return [[[OFRangeValue alloc] initWithRange: range] autorelease]; } -+ (instancetype)valueWithPoint: (of_point_t)point ++ (instancetype)valueWithPoint: (OFPoint)point { return [[[OFPointValue alloc] initWithPoint: point] autorelease]; } + (instancetype)valueWithDimension: (of_dimension_t)dimension @@ -178,13 +178,13 @@ OFRange ret; [self getValue: &ret size: sizeof(ret)]; return ret; } -- (of_point_t)pointValue +- (OFPoint)pointValue { - of_point_t ret; + OFPoint ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_dimension_t)dimensionValue Index: src/OFWin32ConsoleStdIOStream.m ================================================================== --- src/OFWin32ConsoleStdIOStream.m +++ src/OFWin32ConsoleStdIOStream.m @@ -580,19 +580,19 @@ csbi.dwCursorPosition.X = column; SetConsoleCursorPosition(_handle, csbi.dwCursorPosition); } -- (void)setCursorPosition: (of_point_t)position +- (void)setCursorPosition: (OFPoint)position { if (position.x < 0 || position.y < 0) @throw [OFInvalidArgumentException exception]; SetConsoleCursorPosition(_handle, (COORD){ position.x, position.y }); } -- (void)setRelativeCursorPosition: (of_point_t)position +- (void)setRelativeCursorPosition: (OFPoint)position { CONSOLE_SCREEN_BUFFER_INFO csbi; if (!GetConsoleScreenBufferInfo(_handle, &csbi)) return; Index: tests/OFValueTests.m ================================================================== --- tests/OFValueTests.m +++ tests/OFValueTests.m @@ -24,11 +24,11 @@ @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { void *pool = objc_autoreleasePoolPush(); OFRange range = OFMakeRange(1, 64), range2; - of_point_t point = of_point(1.5f, 3.0f), point2; + OFPoint point = OFMakePoint(1.5f, 3.0f), point2; of_dimension_t dimension = of_dimension(4.5f, 5.0f), dimension2; of_rectangle_t rectangle = of_rectangle(1.5f, 3.0f, 4.5f, 6.0f); of_rectangle_t rectangle2; OFValue *value; void *pointer = &value; @@ -94,19 +94,19 @@ TEST(@"+[valueWithPoint:]", (value = [OFValue valueWithPoint: point])) TEST(@"-[pointValue]", - of_point_equal(value.pointValue, point) && + OFEqualPoints(value.pointValue, point) && (value = [OFValue valueWithBytes: &point - objCType: @encode(of_point_t)]) && - of_point_equal(value.pointValue, point)) + objCType: @encode(OFPoint)]) && + OFEqualPoints(value.pointValue, point)) TEST(@"-[getValue:size:] for OFPointValue", (value = [OFValue valueWithPoint: point]) && R([value getValue: &point2 size: sizeof(point2)]) && - of_point_equal(point2, point)) + OFEqualPoints(point2, point)) EXPECT_EXCEPTION(@"-[pointValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] pointValue]) Index: tests/terminal/TerminalTests.m ================================================================== --- tests/terminal/TerminalTests.m +++ tests/terminal/TerminalTests.m @@ -90,25 +90,25 @@ [OFThread sleepForTimeInterval: 2]; [of_stdout clear]; [OFThread sleepForTimeInterval: 2]; - [of_stdout setCursorPosition: of_point(5, 3)]; + [of_stdout setCursorPosition: OFMakePoint(5, 3)]; [of_stdout writeString: @"Text at (5, 3)"]; [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(-2, 0)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(2, 0)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(0, -2)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(0, 2)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(1, 1)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(-1, -1)]; + [of_stdout setRelativeCursorPosition: OFMakePoint(-2, 0)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(2, 0)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(0, -2)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(0, 2)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(1, 1)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(-1, -1)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setCursorColumn: 2]; [OFThread sleepForTimeInterval: 2];