mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
New improved GSI map macros and added support for GSM alphabet.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12210 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7ec92f15c5
commit
b43b20c392
18 changed files with 538 additions and 28 deletions
|
@ -2,6 +2,11 @@
|
|||
|
||||
* Source/NSRunLoop.m: Correct returns from within exception handler.
|
||||
* Source/NSUserDefaults.m: use NSDefaultRunLoopMode.
|
||||
* Headers/gnustep/unicode/gsm0338.h: New character set mapping.
|
||||
* Source/Unicode.m: Add support for the GSM default alphabet.
|
||||
* Headers/gnustep/base/GSIMap.h: Add support for macros update when
|
||||
built with GSM_NEW defined (for use with NSMapTable in future).
|
||||
Various source files updated to use new GSI macros.
|
||||
|
||||
Mon Jan 21 17:08:42 2002 Nicola Pero <nicola@brainstorm.co.uk>
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
*
|
||||
* GSI_MAP_EXTRA
|
||||
* If this value is defined, there is an 'extra' field in each
|
||||
* map table which is a pointer to void. This field can be used
|
||||
* map table whose type is that specified by the value of the
|
||||
* preprocessor constant. This field can be used
|
||||
* to store additional information for the map.
|
||||
*
|
||||
*/
|
||||
|
@ -71,30 +72,55 @@
|
|||
#define GSI_MAP_HAS_VALUE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If GSI_NEW is defined we expect to pass a pointer to the maptable as
|
||||
* the first argument to each macro so we can have the macros behave
|
||||
* differently for different maptables.
|
||||
* The old version will become obsolete and be removed at some point.
|
||||
*/
|
||||
#ifdef GSI_NEW
|
||||
|
||||
#ifndef GSI_MAP_RETAIN_KEY
|
||||
#define GSI_MAP_RETAIN_KEY(M, X) [(X).obj retain]
|
||||
#endif
|
||||
#ifndef GSI_MAP_RELEASE_KEY
|
||||
#define GSI_MAP_RELEASE_KEY(M, X) [(X).obj release]
|
||||
#endif
|
||||
#ifndef GSI_MAP_RETAIN_VAL
|
||||
#define GSI_MAP_RETAIN_VAL(M, X) [(X).obj retain]
|
||||
#endif
|
||||
#ifndef GSI_MAP_RELEASE_VAL
|
||||
#define GSI_MAP_RELEASE_VAL(M, X) [(X).obj release]
|
||||
#endif
|
||||
#ifndef GSI_MAP_HASH
|
||||
#define GSI_MAP_HASH(M, X) [(X).obj hash]
|
||||
#endif
|
||||
#ifndef GSI_MAP_EQUAL
|
||||
#define GSI_MAP_EQUAL(M, X, Y) [(X).obj isEqual: (Y).obj]
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef GSI_MAP_RETAIN_KEY
|
||||
#define GSI_MAP_RETAIN_KEY(X) [(X).obj retain]
|
||||
#endif
|
||||
|
||||
#ifndef GSI_MAP_RELEASE_KEY
|
||||
#define GSI_MAP_RELEASE_KEY(X) [(X).obj release]
|
||||
#endif
|
||||
|
||||
#ifndef GSI_MAP_RETAIN_VAL
|
||||
#define GSI_MAP_RETAIN_VAL(X) [(X).obj retain]
|
||||
#endif
|
||||
|
||||
#ifndef GSI_MAP_RELEASE_VAL
|
||||
#define GSI_MAP_RELEASE_VAL(X) [(X).obj release]
|
||||
#endif
|
||||
|
||||
#ifndef GSI_MAP_HASH
|
||||
#define GSI_MAP_HASH(X) [(X).obj hash]
|
||||
#define GSI_MAP_HASH(X) [(X).obj hash]
|
||||
#endif
|
||||
|
||||
#ifndef GSI_MAP_EQUAL
|
||||
#define GSI_MAP_EQUAL(X,Y) [(X).obj isEqual: (Y).obj]
|
||||
#define GSI_MAP_EQUAL(X, Y) [(X).obj isEqual: (Y).obj]
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If there is no bitmask defined to supply the types that
|
||||
|
@ -203,7 +229,7 @@ struct _GSIMapTable {
|
|||
size_t chunkCount; /* Number of chunks in array. */
|
||||
GSIMapNode *nodeChunks; /* Chunks of allocated memory. */
|
||||
#ifdef GSI_MAP_EXTRA
|
||||
void *extra;
|
||||
GSI_MAP_EXTRA extra;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -213,15 +239,21 @@ struct _GSIMapEnumerator {
|
|||
};
|
||||
|
||||
static INLINE GSIMapBucket
|
||||
GSIMapPickBucket(GSIMapKey key, GSIMapBucket buckets, size_t bucketCount)
|
||||
GSIMapPickBucket(unsigned hash, GSIMapBucket buckets, size_t bucketCount)
|
||||
{
|
||||
return buckets + GSI_MAP_HASH(key) % bucketCount;
|
||||
return buckets + hash % bucketCount;
|
||||
}
|
||||
|
||||
static INLINE GSIMapBucket
|
||||
GSIMapBucketForKey(GSIMapTable map, GSIMapKey key)
|
||||
{
|
||||
return GSIMapPickBucket(key, map->buckets, map->bucketCount);
|
||||
#ifdef GSI_NEW
|
||||
return GSIMapPickBucket(GSI_MAP_HASH(map, key),
|
||||
map->buckets, map->bucketCount);
|
||||
#else
|
||||
return GSIMapPickBucket(GSI_MAP_HASH(key),
|
||||
map->buckets, map->bucketCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
|
@ -327,7 +359,13 @@ GSIMapRemangleBuckets(GSIMapTable map,
|
|||
GSIMapBucket bkt;
|
||||
|
||||
GSIMapRemoveNodeFromBucket(old_buckets, node);
|
||||
bkt = GSIMapPickBucket(node->key, new_buckets, new_bucketCount);
|
||||
#ifdef GSI_NEW
|
||||
bkt = GSIMapPickBucket(GSI_MAP_HASH(map, node->key),
|
||||
new_buckets, new_bucketCount);
|
||||
#else
|
||||
bkt = GSIMapPickBucket(GSI_MAP_HASH(node->key),
|
||||
new_buckets, new_bucketCount);
|
||||
#endif
|
||||
GSIMapAddNodeToBucket(bkt, node);
|
||||
}
|
||||
old_buckets++;
|
||||
|
@ -445,14 +483,34 @@ GSIMapNewNode(GSIMapTable map, GSIMapKey key)
|
|||
static INLINE void
|
||||
GSIMapFreeNode(GSIMapTable map, GSIMapNode node)
|
||||
{
|
||||
#ifdef GSI_NEW
|
||||
GSI_MAP_RELEASE_KEY(map, node->key);
|
||||
#if GSI_MAP_HAS_VALUE
|
||||
GSI_MAP_RELEASE_VAL(map, node->value);
|
||||
#endif
|
||||
#else
|
||||
GSI_MAP_RELEASE_KEY(node->key);
|
||||
#if GSI_MAP_HAS_VALUE
|
||||
GSI_MAP_RELEASE_VAL(node->value);
|
||||
#endif
|
||||
#endif
|
||||
node->nextInMap = map->freeNodes;
|
||||
map->freeNodes = node;
|
||||
}
|
||||
|
||||
#ifdef GSI_NEW
|
||||
static INLINE GSIMapNode
|
||||
GSIMapNodeForKeyInBucket(GSIMapTable map, GSIMapBucket bucket, GSIMapKey key)
|
||||
{
|
||||
GSIMapNode node = bucket->firstNode;
|
||||
|
||||
while ((node != 0) && GSI_MAP_EQUAL(map, node->key, key) == NO)
|
||||
{
|
||||
node = node->nextInBucket;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
#else
|
||||
static INLINE GSIMapNode
|
||||
GSIMapNodeForKeyInBucket(GSIMapBucket bucket, GSIMapKey key)
|
||||
{
|
||||
|
@ -464,6 +522,7 @@ GSIMapNodeForKeyInBucket(GSIMapBucket bucket, GSIMapKey key)
|
|||
}
|
||||
return node;
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE GSIMapNode
|
||||
GSIMapNodeForKey(GSIMapTable map, GSIMapKey key)
|
||||
|
@ -474,7 +533,11 @@ GSIMapNodeForKey(GSIMapTable map, GSIMapKey key)
|
|||
if (map->nodeCount == 0)
|
||||
return 0;
|
||||
bucket = GSIMapBucketForKey(map, key);
|
||||
#ifdef GSI_NEW
|
||||
node = GSIMapNodeForKeyInBucket(map, bucket, key);
|
||||
#else
|
||||
node = GSIMapNodeForKeyInBucket(bucket, key);
|
||||
#endif
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@ -622,8 +685,13 @@ GSIMapAddPair(GSIMapTable map, GSIMapKey key, GSIMapVal value)
|
|||
{
|
||||
GSIMapNode node;
|
||||
|
||||
#ifdef GSI_NEW
|
||||
GSI_MAP_RETAIN_KEY(map, key);
|
||||
GSI_MAP_RETAIN_VAL(map, value);
|
||||
#else
|
||||
GSI_MAP_RETAIN_KEY(key);
|
||||
GSI_MAP_RETAIN_VAL(value);
|
||||
#endif
|
||||
node = GSIMapNewNode(map, key, value);
|
||||
|
||||
if (node != 0)
|
||||
|
@ -654,7 +722,11 @@ GSIMapAddKey(GSIMapTable map, GSIMapKey key)
|
|||
{
|
||||
GSIMapNode node;
|
||||
|
||||
#ifdef GSI_NEW
|
||||
GSI_MAP_RETAIN_KEY(map, key);
|
||||
#else
|
||||
GSI_MAP_RETAIN_KEY(key);
|
||||
#endif
|
||||
node = GSIMapNewNode(map, key);
|
||||
|
||||
if (node != 0)
|
||||
|
@ -673,8 +745,13 @@ GSIMapRemoveKey(GSIMapTable map, GSIMapKey key)
|
|||
|
||||
if (bucket != 0)
|
||||
{
|
||||
GSIMapNode node = GSIMapNodeForKeyInBucket(bucket, key);
|
||||
GSIMapNode node;
|
||||
|
||||
#ifdef GSI_NEW
|
||||
node = GSIMapNodeForKeyInBucket(map, bucket, key);
|
||||
#else
|
||||
node = GSIMapNodeForKeyInBucket(bucket, key);
|
||||
#endif
|
||||
if (node != 0)
|
||||
{
|
||||
GSIMapRemoveNodeFromMap(map, bucket, node);
|
||||
|
|
|
@ -91,7 +91,8 @@ typedef enum _NSStringEncoding
|
|||
NSISOLatin8StringEncoding = 62, // ISO-8859-14
|
||||
NSISOLatin9StringEncoding = 63, // ISO-8859-15; Replaces ISOLatin1
|
||||
NSGB2312StringEncoding = 56,
|
||||
NSUTF7StringEncoding = 64 // RFC 2152
|
||||
NSUTF7StringEncoding = 64, // RFC 2152
|
||||
NSGSM0338StringEncoding // GSM (mobile phone) default alphabet
|
||||
} NSStringEncoding;
|
||||
|
||||
enum {
|
||||
|
|
272
Headers/gnustep/unicode/gsm0338.h
Normal file
272
Headers/gnustep/unicode/gsm0338.h
Normal file
|
@ -0,0 +1,272 @@
|
|||
/* Created by Richard Frith-Macdonald <rfm@gnu.org> on 2002 Jan 24 */
|
||||
|
||||
// GSM0338 to Unicode maping
|
||||
|
||||
const unsigned int GSM0338_conv_base = 0x00;
|
||||
|
||||
unichar GSM0338_char_to_uni_table[] =
|
||||
{
|
||||
0x0040,
|
||||
0x00A3,
|
||||
0x0024,
|
||||
0x00A5,
|
||||
0x00E8,
|
||||
0x00E9,
|
||||
0x00F9,
|
||||
0x00EC,
|
||||
0x00F2,
|
||||
0x00E7,
|
||||
0x000A,
|
||||
0x00D8,
|
||||
0x00F8,
|
||||
0x000D,
|
||||
0x00C5,
|
||||
0x00E5,
|
||||
0x0394,
|
||||
0x005F,
|
||||
0x03A6,
|
||||
0x0393,
|
||||
0x039B,
|
||||
0x03A9,
|
||||
0x03A0,
|
||||
0x03A8,
|
||||
0x03A3,
|
||||
0x0398,
|
||||
0x039E,
|
||||
0x00A0,
|
||||
0x00C6,
|
||||
0x00E6,
|
||||
0x00DF,
|
||||
0x00C9,
|
||||
0x0020,
|
||||
0x0021,
|
||||
0x0022,
|
||||
0x0023,
|
||||
0x00A4,
|
||||
0x0025,
|
||||
0x0026,
|
||||
0x0027,
|
||||
0x0028,
|
||||
0x0029,
|
||||
0x002A,
|
||||
0x002B,
|
||||
0x002C,
|
||||
0x002D,
|
||||
0x002E,
|
||||
0x002F,
|
||||
0x0030,
|
||||
0x0031,
|
||||
0x0032,
|
||||
0x0033,
|
||||
0x0034,
|
||||
0x0035,
|
||||
0x0036,
|
||||
0x0037,
|
||||
0x0038,
|
||||
0x0039,
|
||||
0x003A,
|
||||
0x003B,
|
||||
0x003C,
|
||||
0x003D,
|
||||
0x003E,
|
||||
0x003F,
|
||||
0x00A1,
|
||||
0x0041,
|
||||
0x0042,
|
||||
0x0043,
|
||||
0x0044,
|
||||
0x0045,
|
||||
0x0046,
|
||||
0x0047,
|
||||
0x0048,
|
||||
0x0049,
|
||||
0x004A,
|
||||
0x004B,
|
||||
0x004C,
|
||||
0x004D,
|
||||
0x004E,
|
||||
0x004F,
|
||||
0x0050,
|
||||
0x0051,
|
||||
0x0052,
|
||||
0x0053,
|
||||
0x0054,
|
||||
0x0055,
|
||||
0x0056,
|
||||
0x0057,
|
||||
0x0058,
|
||||
0x0059,
|
||||
0x005A,
|
||||
0x00C4,
|
||||
0x00D6,
|
||||
0x00D1,
|
||||
0x00DC,
|
||||
0x00A7,
|
||||
0x00BF,
|
||||
0x0061,
|
||||
0x0062,
|
||||
0x0063,
|
||||
0x0064,
|
||||
0x0065,
|
||||
0x0066,
|
||||
0x0067,
|
||||
0x0068,
|
||||
0x0069,
|
||||
0x006A,
|
||||
0x006B,
|
||||
0x006C,
|
||||
0x006D,
|
||||
0x006E,
|
||||
0x006F,
|
||||
0x0070,
|
||||
0x0071,
|
||||
0x0072,
|
||||
0x0073,
|
||||
0x0074,
|
||||
0x0075,
|
||||
0x0076,
|
||||
0x0077,
|
||||
0x0078,
|
||||
0x0079,
|
||||
0x007A,
|
||||
0x00E4,
|
||||
0x00F6,
|
||||
0x00F1,
|
||||
0x00FC,
|
||||
0x00E0
|
||||
};
|
||||
|
||||
const unsigned int GSM0338_uni_to_char_table_size = 128;
|
||||
|
||||
struct _ucc_ GSM0338_uni_to_char_table[]=
|
||||
{
|
||||
{0x0080,0x80},
|
||||
{0x0081,0x81},
|
||||
{0x0082,0x82},
|
||||
{0x0083,0x83},
|
||||
{0x0084,0x84},
|
||||
{0x0085,0x85},
|
||||
{0x0086,0x86},
|
||||
{0x0087,0x87},
|
||||
{0x0088,0x88},
|
||||
{0x0089,0x89},
|
||||
{0x008A,0x8A},
|
||||
{0x008B,0x8B},
|
||||
{0x008C,0x8C},
|
||||
{0x008D,0x8D},
|
||||
{0x008E,0x8E},
|
||||
{0x008F,0x8F},
|
||||
{0x0090,0x90},
|
||||
{0x0091,0x91},
|
||||
{0x0092,0x92},
|
||||
{0x0093,0x93},
|
||||
{0x0094,0x94},
|
||||
{0x0095,0x95},
|
||||
{0x0096,0x96},
|
||||
{0x0097,0x97},
|
||||
{0x0098,0x98},
|
||||
{0x0099,0x99},
|
||||
{0x009A,0x9A},
|
||||
{0x009B,0x9B},
|
||||
{0x009C,0x9C},
|
||||
{0x009D,0x9D},
|
||||
{0x009E,0x9E},
|
||||
{0x009F,0x9F},
|
||||
{0x00A0,0xA0},
|
||||
{0x00A4,0xA4},
|
||||
{0x00A7,0xA7},
|
||||
{0x00A8,0xA8},
|
||||
{0x00AD,0xAD},
|
||||
{0x00B0,0xB0},
|
||||
{0x00B4,0xB4},
|
||||
{0x00B8,0xB8},
|
||||
{0x00C1,0xC1},
|
||||
{0x00C2,0xC2},
|
||||
{0x00C4,0xC4},
|
||||
{0x00C7,0xC7},
|
||||
{0x00C9,0xC9},
|
||||
{0x00CB,0xCB},
|
||||
{0x00CD,0xCD},
|
||||
{0x00CE,0xCE},
|
||||
{0x00D3,0xD3},
|
||||
{0x00D4,0xD4},
|
||||
{0x00D6,0xD6},
|
||||
{0x00D7,0xD7},
|
||||
{0x00DA,0xDA},
|
||||
{0x00DC,0xDC},
|
||||
{0x00DD,0xDD},
|
||||
{0x00DF,0xDF},
|
||||
{0x00E1,0xE1},
|
||||
{0x00E2,0xE2},
|
||||
{0x00E4,0xE4},
|
||||
{0x00E7,0xE7},
|
||||
{0x00E9,0xE9},
|
||||
{0x00EB,0xEB},
|
||||
{0x00ED,0xED},
|
||||
{0x00EE,0xEE},
|
||||
{0x00F3,0xF3},
|
||||
{0x00F4,0xF4},
|
||||
{0x00F6,0xF6},
|
||||
{0x00F7,0xF7},
|
||||
{0x00FA,0xFA},
|
||||
{0x00FC,0xFC},
|
||||
{0x00FD,0xFD},
|
||||
{0x0102,0xC3},
|
||||
{0x0103,0xE3},
|
||||
{0x0104,0xA1},
|
||||
{0x0105,0xB1},
|
||||
{0x0106,0xC6},
|
||||
{0x0107,0xE6},
|
||||
{0x010C,0xC8},
|
||||
{0x010D,0xE8},
|
||||
{0x010E,0xCF},
|
||||
{0x010F,0xEF},
|
||||
{0x0110,0xD0},
|
||||
{0x0111,0xF0},
|
||||
{0x0118,0xCA},
|
||||
{0x0119,0xEA},
|
||||
{0x011A,0xCC},
|
||||
{0x011B,0xEC},
|
||||
{0x0139,0xC5},
|
||||
{0x013A,0xE5},
|
||||
{0x013D,0xA5},
|
||||
{0x013E,0xB5},
|
||||
{0x0141,0xA3},
|
||||
{0x0142,0xB3},
|
||||
{0x0143,0xD1},
|
||||
{0x0144,0xF1},
|
||||
{0x0147,0xD2},
|
||||
{0x0148,0xF2},
|
||||
{0x0150,0xD5},
|
||||
{0x0151,0xF5},
|
||||
{0x0154,0xC0},
|
||||
{0x0155,0xE0},
|
||||
{0x0158,0xD8},
|
||||
{0x0159,0xF8},
|
||||
{0x015A,0xA6},
|
||||
{0x015B,0xB6},
|
||||
{0x015E,0xAA},
|
||||
{0x015F,0xBA},
|
||||
{0x0160,0xA9},
|
||||
{0x0161,0xB9},
|
||||
{0x0162,0xDE},
|
||||
{0x0163,0xFE},
|
||||
{0x0164,0xAB},
|
||||
{0x0165,0xBB},
|
||||
{0x016E,0xD9},
|
||||
{0x016F,0xF9},
|
||||
{0x0170,0xDB},
|
||||
{0x0171,0xFB},
|
||||
{0x0179,0xAC},
|
||||
{0x017A,0xBC},
|
||||
{0x017B,0xAF},
|
||||
{0x017C,0xBF},
|
||||
{0x017D,0xAE},
|
||||
{0x017E,0xBE},
|
||||
{0x02C7,0xB7},
|
||||
{0x02D8,0xA2},
|
||||
{0x02D9,0xFF},
|
||||
{0x02DB,0xB2},
|
||||
{0x02DD,0xBD},
|
||||
};
|
||||
|
|
@ -91,11 +91,20 @@
|
|||
|
||||
|
||||
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) [(X).obj isEqualToDictionary: (Y).obj]
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_EQUAL(X,Y) [(X).obj isEqualToDictionary: (Y).obj]
|
||||
#endif
|
||||
|
||||
#define GSI_MAP_KTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_INT
|
||||
|
||||
|
@ -152,7 +161,11 @@ unCacheAttributes(NSDictionary *attrs)
|
|||
{
|
||||
GSIMapNode node;
|
||||
|
||||
#ifdef GSI_NEW
|
||||
node = GSIMapNodeForKeyInBucket(&attrMap, bucket, (GSIMapKey)attrs);
|
||||
#else
|
||||
node = GSIMapNodeForKeyInBucket(bucket, (GSIMapKey)attrs);
|
||||
#endif
|
||||
if (node != 0)
|
||||
{
|
||||
if (--node->value.uint == 0)
|
||||
|
|
|
@ -32,8 +32,13 @@
|
|||
#include <Foundation/NSDebug.h>
|
||||
|
||||
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#endif
|
||||
#define GSI_MAP_KTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_INT
|
||||
|
||||
|
@ -292,7 +297,11 @@
|
|||
{
|
||||
GSIMapNode node;
|
||||
|
||||
#ifdef GSI_NEW
|
||||
node = GSIMapNodeForKeyInBucket(&map, bucket, (GSIMapKey)anObject);
|
||||
#else
|
||||
node = GSIMapNodeForKeyInBucket(bucket, (GSIMapKey)anObject);
|
||||
#endif
|
||||
if (node != 0)
|
||||
{
|
||||
if (--node->value.uint == 0)
|
||||
|
|
|
@ -39,10 +39,17 @@
|
|||
*/
|
||||
#define GSI_MAP_KTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_OBJ
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_HASH(M, X) [X.obj hash]
|
||||
#define GSI_MAP_EQUAL(M, X,Y) [X.obj isEqual: Y.obj]
|
||||
#define GSI_MAP_RETAIN_KEY(M, X) ((id)(X).obj) = \
|
||||
[((id)(X).obj) copyWithZone: map->zone]
|
||||
#else
|
||||
#define GSI_MAP_HASH(X) [X.obj hash]
|
||||
#define GSI_MAP_EQUAL(X,Y) [X.obj isEqual: Y.obj]
|
||||
#define GSI_MAP_EQUAL(X,Y) [X.obj isEqual: Y.obj]
|
||||
#define GSI_MAP_RETAIN_KEY(X) ((id)(X).obj) = \
|
||||
[((id)(X).obj) copyWithZone: map->zone]
|
||||
#endif
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -106,12 +106,21 @@ ReturnTypeEqualsReturnType (vacallReturnTypeInfo *a, vacallReturnTypeInfo *b)
|
|||
&& (a->type == b->type);
|
||||
}
|
||||
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_HASH(M, X) ReturnTypeHash (X.ptr)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) ReturnTypeEqualsReturnType (X.ptr, Y.ptr)
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#else
|
||||
#define GSI_MAP_HASH(X) ReturnTypeHash (X.ptr)
|
||||
#define GSI_MAP_EQUAL(X,Y) ReturnTypeEqualsReturnType (X.ptr, Y.ptr)
|
||||
#define GSI_MAP_RETAIN_KEY(X) ;
|
||||
#define GSI_MAP_RETAIN_VAL(X) ;
|
||||
#define GSI_MAP_RELEASE_KEY(X) ;
|
||||
#define GSI_MAP_RELEASE_VAL(X) ;
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#endif
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#
|
||||
|
||||
# Additional flags to pass to the preprocessor
|
||||
ADDITIONAL_CPPFLAGS = $(DEFS) $(CONFIG_SYSTEM_DEFS) -Wall
|
||||
ADDITIONAL_CPPFLAGS = -DGSI_NEW=1 $(DEFS) $(CONFIG_SYSTEM_DEFS) -Wall
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS = $(SSLFLAGS)
|
||||
|
|
|
@ -28,12 +28,21 @@
|
|||
/*
|
||||
* Setup for inline operation of pointer map tables.
|
||||
*/
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#define GSI_MAP_HASH(M, X) ((X).uint)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_HASH(X) ((X).uint)
|
||||
#define GSI_MAP_EQUAL(X,Y) ((X).uint == (Y).uint)
|
||||
#endif
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -37,12 +37,21 @@
|
|||
/*
|
||||
* Setup for inline operation of pointer map tables.
|
||||
*/
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#define GSI_MAP_HASH(M, X) ((X).uint ^ ((X).uint >> 3))
|
||||
#define GSI_MAP_EQUAL(M, X,Y) ((X).ptr == (Y).ptr)
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_HASH(X) ((X).uint ^ ((X).uint >> 3))
|
||||
#define GSI_MAP_EQUAL(X,Y) ((X).ptr == (Y).ptr)
|
||||
#endif
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -117,18 +117,28 @@ static void obsFree(Observation *o);
|
|||
|
||||
#include <base/GSIArray.h>
|
||||
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X) ({if ((((gsaddr)X.obj) & 1) == 0) \
|
||||
RELEASE(X.obj);})
|
||||
#define GSI_MAP_HASH(M, X) doHash(X.obj)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) doEqual(X.obj, Y.obj)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X) ({if ((((gsaddr)X.obj) & 1) == 0) \
|
||||
RELEASE(X.obj);})
|
||||
#define GSI_MAP_HASH(X) doHash(X.obj)
|
||||
#define GSI_MAP_EQUAL(X,Y) doEqual(X.obj, Y.obj)
|
||||
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#endif
|
||||
|
||||
#define GSI_MAP_KTYPES GSUNION_OBJ|GSUNION_INT
|
||||
#define GSI_MAP_VTYPES GSUNION_PTR
|
||||
#define GSI_MAP_VEXTRA Observation*
|
||||
#define GSI_MAP_EXTRA 1
|
||||
#define GSI_MAP_EXTRA void*
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -49,12 +49,21 @@
|
|||
/*
|
||||
* Setup for inline operation of pointer map tables.
|
||||
*/
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#define GSI_MAP_HASH(M, X) ((X).uint)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_HASH(X) ((X).uint)
|
||||
#define GSI_MAP_EQUAL(X,Y) ((X).uint == (Y).uint)
|
||||
#endif
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -337,6 +337,8 @@ static char **_gnu_noobjc_env;
|
|||
#if (CMDLINE_TERMINATED == 0)
|
||||
_gnu_noobjc_argc++;
|
||||
#endif
|
||||
fclose(ifp);
|
||||
|
||||
/*
|
||||
* Now _gnu_noobcj_argc is the number of arguments;
|
||||
* allocate memory accordingly.
|
||||
|
@ -345,7 +347,7 @@ static char **_gnu_noobjc_env;
|
|||
if (_gnu_noobjc_argv == NULL)
|
||||
goto malloc_error;
|
||||
|
||||
fclose(ifp);
|
||||
|
||||
ifp=fopen(proc_file_name,"r");
|
||||
//freopen(proc_file_name, "r", ifp);
|
||||
if (ifp == NULL)
|
||||
|
@ -551,8 +553,9 @@ int main(int argc, char *argv[], char *env[])
|
|||
}
|
||||
|
||||
if (!_gnu_sharedProcessInfoObject)
|
||||
_gnu_sharedProcessInfoObject = [[_NSConcreteProcessInfo alloc] init];
|
||||
|
||||
{
|
||||
_gnu_sharedProcessInfoObject = [[_NSConcreteProcessInfo alloc] init];
|
||||
}
|
||||
return _gnu_sharedProcessInfoObject;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,21 @@
|
|||
/*
|
||||
* Setup for inline operation of string map tables.
|
||||
*/
|
||||
#ifdef GSI_NEW
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
#define GSI_MAP_HASH(M, X) [(X).obj hash]
|
||||
#define GSI_MAP_EQUAL(M, X,Y) [(X).obj isEqualToString: (Y).obj]
|
||||
#else
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_HASH(X) [(X).obj hash]
|
||||
#define GSI_MAP_EQUAL(X,Y) [(X).obj isEqualToString: (Y).obj]
|
||||
#endif
|
||||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ struct _ucc_ {unichar from; char to;};
|
|||
#include "unicode/caseconv.h"
|
||||
#include "unicode/cop.h"
|
||||
#include "unicode/decomp.h"
|
||||
#include "unicode/gsm0338.h"
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#ifdef HAVE_GICONV_H
|
||||
|
@ -101,6 +102,7 @@ static NSStringEncoding _availableEncodings[] = {
|
|||
NSISOGreekStringEncoding,
|
||||
NSISOHebrewStringEncoding,
|
||||
NSGB2312StringEncoding,
|
||||
NSGSM0338StringEncoding,
|
||||
0
|
||||
};
|
||||
#else
|
||||
|
@ -133,6 +135,7 @@ static NSStringEncoding _availableEncodings[] = {
|
|||
// NSISOGreekStringEncoding,
|
||||
// NSISOHebrewStringEncoding,
|
||||
// NSGB2312StringEncoding,
|
||||
NSGSM0338StringEncoding,
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
@ -174,6 +177,7 @@ const struct _strenc_ str_encoding_table[]=
|
|||
{NSISOLatin9StringEncoding, "NSISOLatin9StringEncoding"},
|
||||
{NSUTF7StringEncoding, "NSUTF7StringEncoding"},
|
||||
{NSGB2312StringEncoding, "NSGB2312StringEncoding"},
|
||||
{NSGSM0338StringEncoding, "NSGSM0338StringEncoding"},
|
||||
|
||||
{0, "Unknown encoding"}
|
||||
};
|
||||
|
@ -457,6 +461,9 @@ encode_chartouni(char c, NSStringEncoding enc)
|
|||
else
|
||||
return(Latin2_char_to_uni_table[(unc)c - Latin2_conv_base]);
|
||||
|
||||
case NSGSM0338StringEncoding:
|
||||
return(GSM0338_char_to_uni_table[(unc)c]);
|
||||
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
if ((unc)c < Symbol_conv_base)
|
||||
|
@ -538,6 +545,12 @@ encode_unitochar(unichar u, NSStringEncoding enc)
|
|||
return res ? '*' : Latin2_uni_to_char_table[--i].to;
|
||||
}
|
||||
|
||||
case NSGSM0338StringEncoding:
|
||||
{
|
||||
while (((res = u - GSM0338_uni_to_char_table[i++].from) > 0)
|
||||
&& (i < GSM0338_uni_to_char_table_size));
|
||||
return res ? '*' : GSM0338_uni_to_char_table[--i].to;
|
||||
}
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
if (u < (unichar)Symbol_conv_base)
|
||||
|
@ -626,6 +639,13 @@ encode_unitochar_strict(unichar u, NSStringEncoding enc)
|
|||
return res ? 0 : Latin2_uni_to_char_table[--i].to;
|
||||
}
|
||||
|
||||
case NSGSM0338StringEncoding:
|
||||
{
|
||||
while (((res = u - GSM0338_uni_to_char_table[i++].from) > 0)
|
||||
&& (i < GSM0338_uni_to_char_table_size));
|
||||
return res ? 0 : GSM0338_uni_to_char_table[--i].to;
|
||||
}
|
||||
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
if (u < (unichar)Symbol_conv_base)
|
||||
|
@ -923,6 +943,25 @@ int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
|||
return 0; // Not all characters converted.
|
||||
return count;
|
||||
|
||||
case NSGSM0338StringEncoding:
|
||||
for (count = 0; count < sl && count < dl; count++)
|
||||
{
|
||||
int res;
|
||||
int i = 0;
|
||||
|
||||
u = src[count];
|
||||
|
||||
while (((res = u - GSM0338_uni_to_char_table[i++].from) > 0)
|
||||
&& (i < GSM0338_uni_to_char_table_size));
|
||||
if (!res)
|
||||
dst[count] = GSM0338_uni_to_char_table[--i].to;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (count < sl)
|
||||
return 0; // Not all characters converted.
|
||||
return count;
|
||||
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
for (count = 0; count < sl && count < dl; count++)
|
||||
|
@ -1063,6 +1102,22 @@ int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
|||
return 0; // Not all characters converted.
|
||||
return count;
|
||||
|
||||
case NSGSM0338StringEncoding:
|
||||
for (count = 0; count < sl && count < dl; count++)
|
||||
{
|
||||
int res;
|
||||
int i = 0;
|
||||
|
||||
u = src[count];
|
||||
|
||||
while (((res = u - GSM0338_uni_to_char_table[i++].from) > 0)
|
||||
&& (i < GSM0338_uni_to_char_table_size));
|
||||
dst[count] = res ? '*' : GSM0338_uni_to_char_table[--i].to;
|
||||
}
|
||||
if (count < sl)
|
||||
return 0; // Not all characters converted.
|
||||
return count;
|
||||
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
for (count = 0; count < sl && count < dl; count++)
|
||||
|
@ -1157,6 +1212,17 @@ int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
|
|||
return 0; // Not all characters converted.
|
||||
return count;
|
||||
|
||||
case NSGSM0338StringEncoding:
|
||||
for (count = 0; count < sl && count < dl; count++)
|
||||
{
|
||||
unc c = (unc)src[count];
|
||||
|
||||
dst[count] = GSM0338_char_to_uni_table[c];
|
||||
}
|
||||
if (count < sl)
|
||||
return 0; // Not all characters converted.
|
||||
return count;
|
||||
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
for (count = 0; count < sl && count < dl; count++)
|
||||
|
|
|
@ -88,9 +88,8 @@ include Makefile.preamble
|
|||
|
||||
-include GNUmakefile.local
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/ctool.make
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
include $(GNUSTEP_MAKEFILES)/test-tool.make
|
||||
include $(GNUSTEP_MAKEFILES)/ctool.make
|
||||
|
||||
ifeq ($(doc),yes)
|
||||
include $(GNUSTEP_MAKEFILES)/documentation.make
|
||||
|
|
|
@ -430,6 +430,9 @@ main(int argc, char **argv, char **env)
|
|||
gFiles = [NSMutableArray array];
|
||||
hFiles = [NSMutableArray array];
|
||||
count = [files count];
|
||||
NSLog(@"Proc ... %@", proc);
|
||||
NSLog(@"Name ... %@", [proc processName]);
|
||||
NSLog(@"Files ... %@", files);
|
||||
for (i = 1; i < count; i++)
|
||||
{
|
||||
NSString *arg = [files objectAtIndex: i];
|
||||
|
|
Loading…
Reference in a new issue