mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Move gnustep specific macros
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29729 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
55b04890c2
commit
bea3004de9
2 changed files with 17 additions and 20 deletions
|
@ -311,5 +311,22 @@ id __object = (id)(object); (__object != nil) ? [__object autorelease] : nil; })
|
|||
*/
|
||||
#define GSLocalizedStaticString(key, comment) key
|
||||
|
||||
/**
|
||||
* To be used inside a method for making sure that a range does not specify
|
||||
* anything outside the size of an array/string. Raises exception if range
|
||||
* extends beyond [0,size).
|
||||
*/
|
||||
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
||||
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
||||
[NSException raise: NSRangeException \
|
||||
format: @"in %s, range { %u, %u } extends beyond size (%u)", \
|
||||
GSNameFromSelector(_cmd), RANGE.location, RANGE.length, SIZE]
|
||||
|
||||
/** Checks whether INDEX is strictly less than OVER (within C array space). */
|
||||
#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \
|
||||
if (INDEX >= OVER) \
|
||||
[NSException raise: NSRangeException \
|
||||
format: @"in %s, index %d is out of range", \
|
||||
GSNameFromSelector(_cmd), INDEX]
|
||||
|
||||
#endif /* __GNUSTEP_GNUSTEP_H_INCLUDED_ */
|
||||
|
|
|
@ -228,26 +228,6 @@ GS_EXPORT NSRange NSRangeFromString(NSString *aString);
|
|||
#undef MIN
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
||||
/**
|
||||
* To be used inside a method for making sure that a range does not specify
|
||||
* anything outside the size of an array/string. Raises exception if range
|
||||
* extends beyond [0,size).
|
||||
*/
|
||||
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
||||
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
||||
[NSException raise: NSRangeException \
|
||||
format: @"in %s, range { %u, %u } extends beyond size (%u)", \
|
||||
GSNameFromSelector(_cmd), RANGE.location, RANGE.length, SIZE]
|
||||
|
||||
/** Checks whether INDEX is strictly less than OVER (within C array space). */
|
||||
#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \
|
||||
if (INDEX >= OVER) \
|
||||
[NSException raise: NSRangeException \
|
||||
format: @"in %s, index %d is out of range", \
|
||||
GSNameFromSelector(_cmd), INDEX]
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue