Overview
Comment: | Add -[description] to OFNumber. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b965dad5f85842c4a3154612fd76e032 |
User & Date: | js on 2010-12-06 13:24:39 |
Other Links: | manifest | tags |
Context
2010-12-07
| ||
23:53 | Rename -[string] to -[description] in OFException. check-in: 684d24b23e user: js tags: trunk | |
2010-12-06
| ||
13:24 | Add -[description] to OFNumber. check-in: b965dad5f8 user: js tags: trunk | |
2010-12-05
| ||
21:32 |
Don't use the lahf instruction. Some early AMD64 CPUs don't support it. check-in: 0272a8686f user: js tags: trunk | |
Changes
Modified src/OFNumber.m from [f20700cf69] to [e3d984f0cd].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | */ #include "config.h" #include <math.h> #import "OFNumber.h" #import "OFExceptions.h" #import "macros.h" #define RETURN_AS(t) \ switch (type) { \ case OF_NUMBER_BOOL: \ return (t)value.bool_; \ | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | */ #include "config.h" #include <math.h> #import "OFNumber.h" #import "OFString.h" #import "OFExceptions.h" #import "macros.h" #define RETURN_AS(t) \ switch (type) { \ case OF_NUMBER_BOOL: \ return (t)value.bool_; \ |
︙ | ︙ | |||
398 399 400 401 402 403 404 | + numberWithIntMax: (intmax_t)intmax { return [[[self alloc] initWithIntMax: intmax] autorelease]; } + numberWithUIntMax: (uintmax_t)uintmax { | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | + numberWithIntMax: (intmax_t)intmax { return [[[self alloc] initWithIntMax: intmax] autorelease]; } + numberWithUIntMax: (uintmax_t)uintmax { return [[[self alloc] initWithUIntMax: uintmax] autorelease]; } + numberWithPtrDiff: (ptrdiff_t)ptrdiff { return [[[self alloc] initWithPtrDiff: ptrdiff] autorelease]; } |
︙ | ︙ | |||
953 954 955 956 957 958 959 960 961 962 963 964 965 966 | { CALCULATE3(- 1) } - (OFNumber*)remainderOfDivisionWithNumber: (OFNumber*)num { switch (type) { case OF_NUMBER_CHAR: return [OFNumber numberWithChar: value.char_ % [num charValue]]; case OF_NUMBER_SHORT: return [OFNumber numberWithShort: value.short_ % [num shortValue]]; case OF_NUMBER_INT: return [OFNumber numberWithInt: value.int_ % [num intValue]]; | > > | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | { CALCULATE3(- 1) } - (OFNumber*)remainderOfDivisionWithNumber: (OFNumber*)num { switch (type) { case OF_NUMBER_BOOL: return [OFNumber numberWithBool: value.bool_ % [num boolValue]]; case OF_NUMBER_CHAR: return [OFNumber numberWithChar: value.char_ % [num charValue]]; case OF_NUMBER_SHORT: return [OFNumber numberWithShort: value.short_ % [num shortValue]]; case OF_NUMBER_INT: return [OFNumber numberWithInt: value.int_ % [num intValue]]; |
︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 1042 | } } - copy { return [self retain]; } @end | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | } } - copy { return [self retain]; } - (OFString*)description { switch (type) { case OF_NUMBER_BOOL: return (value.bool_ ? @"YES" : @"NO"); case OF_NUMBER_UCHAR: case OF_NUMBER_USHORT: case OF_NUMBER_UINT: case OF_NUMBER_ULONG: case OF_NUMBER_UINT8: case OF_NUMBER_UINT16: case OF_NUMBER_UINT32: case OF_NUMBER_UINT64: case OF_NUMBER_SIZE: case OF_NUMBER_UINTMAX: case OF_NUMBER_UINTPTR: return [OFString stringWithFormat: @"%ju", [self uIntMaxValue]]; case OF_NUMBER_CHAR: case OF_NUMBER_SHORT: case OF_NUMBER_INT: case OF_NUMBER_LONG: case OF_NUMBER_INT8: case OF_NUMBER_INT16: case OF_NUMBER_INT32: case OF_NUMBER_INT64: case OF_NUMBER_SSIZE: case OF_NUMBER_INTMAX: case OF_NUMBER_PTRDIFF: case OF_NUMBER_INTPTR: return [OFString stringWithFormat: @"%jd", [self intMaxValue]]; case OF_NUMBER_FLOAT: return [OFString stringWithFormat: @"%f", [self floatValue]]; case OF_NUMBER_DOUBLE: return [OFString stringWithFormat: @"%lf", [self doubleValue]]; default: @throw [OFInvalidFormatException newWithClass: isa]; } } @end |
Modified src/OFString.m from [93873903ed] to [b78aed1909].
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #import "macros.h" #import "asprintf.h" #import "unicode.h" extern const uint16_t of_iso_8859_15[256]; extern const uint16_t of_windows_1252[256]; static inline int memcasecmp(const char *s1, const char *s2, size_t len) { size_t i; for (i = 0; i < len; i++) { if (tolower((int)s1[i]) > tolower((int)s2[i])) return OF_ORDERED_DESCENDING; if (tolower((int)s1[i]) < tolower((int)s2[i])) return OF_ORDERED_ASCENDING; } return OF_ORDERED_SAME; } | > > > > > > > > > < < < < < < < < < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #import "macros.h" #import "asprintf.h" #import "unicode.h" extern const uint16_t of_iso_8859_15[256]; extern const uint16_t of_windows_1252[256]; /* References for static linking */ void _references_to_categories_of_OFString() { _OFString_Hashing_reference = 1; _OFString_URLEncoding_reference = 1; _OFString_XMLEscaping_reference = 1; _OFString_XMLUnescaping_reference = 1; }; static inline int memcasecmp(const char *s1, const char *s2, size_t len) { size_t i; for (i = 0; i < len; i++) { if (tolower((int)s1[i]) > tolower((int)s2[i])) return OF_ORDERED_DESCENDING; if (tolower((int)s1[i]) < tolower((int)s2[i])) return OF_ORDERED_ASCENDING; } return OF_ORDERED_SAME; } int of_string_check_utf8(const char *str, size_t len) { size_t i; int utf8 = 0; madvise((void*)str, len, MADV_SEQUENTIAL); |
︙ | ︙ |