Unicode and character set updates.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9301 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Jonathan Gapen 2001-03-05 01:08:57 +00:00
parent eb798ac844
commit 05844a01b9
5 changed files with 6780 additions and 792 deletions

View file

@ -1,3 +1,11 @@
2001-03-04 Jonathan Gapen <jagapen@home.com>
* Documentation/gsdoc/NSCharacterSet.gsdoc: Documented some methods.
* Headers/gnustep/unicode/caseconv.h: Updated case-mapping tables.
* Source/NSBitmapCharSet.m: Added sanity check to initWithBitmap:
* Source/Unicode.m: Changed uni_toupper() and uni_tolower() to use
direct lookup in two-level tables, rather than a linear search.
2001-03-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBundle.m: Corrected

View file

@ -27,6 +27,10 @@
<sel>characterSetWithBitmapRepresentation:</sel>
<arg type="NSData*">data</arg>
<desc>
<p>
Returns a character set containing characters as encoded in the
<em>data</em> object.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
@ -55,16 +59,28 @@
<method type="NSCharacterSet*" factory="yes">
<sel>decimalDigitCharacterSet</sel>
<desc>
<p>
Returns a character set containing characters that represent
the decimal digits 0 through 9.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
<sel>decomposableCharacterSet</sel>
<desc>
<p>
Returns a character set containing individual charactars that
can be represented also by a composed character sequence.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
<sel>illegalCharacterSet</sel>
<desc>
<p>
Returns a character set containing unassigned (illegal)
character values.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
@ -75,6 +91,11 @@
<method type="NSCharacterSet*" factory="yes">
<sel>lowercaseLetterCharacterSet</sel>
<desc>
<p>
Returns a character set that contains the lowercase characters.
This set does not include caseless characters, only those that
have corresponding characters in uppercase and/or titlecase.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
@ -90,32 +111,56 @@
<method type="NSCharacterSet*" factory="yes">
<sel>uppercaseLetterCharacterSet</sel>
<desc>
<p>
Returns a character set that contains the uppercase characters.
This set does not include caseless characters, only those that
have corresponding characters in lowercase and/or titlecase.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
<sel>whitespaceAndNewlineCharacterSet</sel>
<desc>
<p>
Returns a character set that contains the whitespace characters,
plus the newline characters, values 0x000A and 0x000D.
</p>
</desc>
</method>
<method type="NSCharacterSet*" factory="yes">
<sel>whitespaceCharacterSet</sel>
<desc>
<p>
Returns a character set that contains the whitespace characters.
</p>
</desc>
</method>
<method type="NSData*">
<sel>bitmapRepresentation</sel>
<desc>
<p>
Returns a bitmap representation of the receiver's character set
suitable for archiving or writing to a file, in an NSData object.
</p>
</desc>
</method>
<method type="BOOL">
<sel>characterIsMember:</sel>
<arg type="unichar">aCharacter</arg>
<desc>
<p>
Returns YES if the receiver contains <em>aCharacter</em>, NO if
it does not.
</p>
</desc>
</method>
<method type="NSCharacterSet*">
<sel>invertedSet</sel>
<desc>
<p>
Returns a character set containing only characters that the
receiver does not contain.
</p>
</desc>
</method>
</class>

File diff suppressed because it is too large Load diff

View file

@ -37,7 +37,16 @@
- (id) initWithBitmap: (NSData*)bitmap
{
[super init];
if ([bitmap length] != BITMAP_SIZE)
{
NSLog(@"attempt to initialize character set with invalid bitmap");
[self dealloc];
return nil;
}
[bitmap getBytes: _data length: BITMAP_SIZE];
return self;
}

View file

@ -997,24 +997,24 @@ encode_ustrtostr_strict(char *s2, unichar *u1, int size, NSStringEncoding enc)
}
}
// These two functions use direct access into a two-level table to map cases.
// The two-level table method is less space efficient (but still not bad) than
// a single table and a linear search, but it reduces the number of
// conditional statements to just one.
unichar
uni_tolower(unichar ch)
{
int res;
int count = 0;
unichar result = gs_tolower_map[ch / 256][ch % 256];
while (((res = ch - t_tolower[count++][0]) > 0) && (count < t_len_tolower));
return res ? ch : t_tolower[--count][1];
return result ? result : ch;
}
unichar
uni_toupper(unichar ch)
{
int res;
int count = 0;
unichar result = gs_toupper_map[ch / 256][ch % 256];
while (((res = ch - t_toupper[count++][0]) > 0) && (count < t_len_toupper));
return res ? ch : t_toupper[--count][1];
return result ? result : ch;
}
unsigned char