mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Move definitions for string internals to GSString.h and update sources accordingly
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/mswin-ng@23994 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fcdf3e75f5
commit
007429a479
14 changed files with 221 additions and 86 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2006-10-29 Sheldon Gill <sheldon@westnet.net.au>
|
||||
|
||||
* Source\GSPrivate.h
|
||||
* Source\GSString.h
|
||||
* Source\GSString.m
|
||||
Move definitions for string internals to GSString.h
|
||||
|
||||
* Source\NSPropertyList.m
|
||||
* Source\NSScanner.m
|
||||
* Source\NSSerializer.m
|
||||
* Source\GSFormat.h
|
||||
* Source\GSFormat.m
|
||||
* Source\NSString.m
|
||||
Update to use string internals information from GSString.h
|
||||
|
||||
* Source\externs.m
|
||||
* Source\NSURLAuthenticationChallenge.m
|
||||
Fix compilation warnings
|
||||
|
||||
2006-10-29 Sheldon Gill <sheldon@westnet.net.au>
|
||||
|
||||
* Source\GSInvocation.h
|
||||
|
|
|
@ -275,7 +275,12 @@ null-load.h \
|
|||
simple-load.h \
|
||||
win32-load.h \
|
||||
NSCallBacks.h \
|
||||
tzfile.h
|
||||
tzfile.h \
|
||||
GSFormat.h \
|
||||
GSString.h \
|
||||
GSArray.h \
|
||||
GSPrivate.h \
|
||||
GSSeq.h \
|
||||
|
||||
FOUNDATION_HEADERS = \
|
||||
Foundation.h \
|
||||
|
|
78
Source/GSArray.h
Normal file
78
Source/GSArray.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/** Concrete implementation of NSArray
|
||||
Copyright (C) 1995-2006 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: March 1995
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Header by: Sheldon Gill <sheldon@westnet.net.au>
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
$Date: 2006-08-13 19:25:13 +0800 (Sun, 13 Aug 2006) $ $Revision: 23275 $
|
||||
*/
|
||||
|
||||
#ifndef __GSArray_h_GNUSTEP_BASE_INCLUDE_PRIVATE
|
||||
#define __GSArray_h_GNUSTEP_BASE_INCLUDE_PRIVATE
|
||||
|
||||
/* ********************************************************* */
|
||||
/* **** Internal Header for Private use by gnustep-base **** */
|
||||
/* ********************************************************* */
|
||||
|
||||
@class GSArray;
|
||||
|
||||
@interface GSArrayEnumerator : NSEnumerator
|
||||
{
|
||||
GSArray *array;
|
||||
unsigned pos;
|
||||
}
|
||||
- (id) initWithArray: (GSArray*)anArray;
|
||||
@end
|
||||
|
||||
@interface GSArrayEnumeratorReverse : GSArrayEnumerator
|
||||
@end
|
||||
|
||||
|
||||
@interface GSArray : NSArray
|
||||
{
|
||||
@public
|
||||
id *_contents_array;
|
||||
unsigned _count;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface GSInlineArray : GSArray
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@interface GSMutableArray : NSMutableArray
|
||||
{
|
||||
@public
|
||||
id *_contents_array;
|
||||
unsigned _count;
|
||||
unsigned _capacity;
|
||||
int _grow_factor;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface GSPlaceholderArray : NSArray
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
#endif /* __GSArray_h_GNUSTEP_BASE_INCLUDE_PRIVATE */
|
|
@ -21,13 +21,15 @@
|
|||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
#ifndef __GSFormat_h_GNUSTEP_BASE_INCLUDE_PRIVATE
|
||||
#define __GSFormat_h_GNUSTEP_BASE_INCLUDE_PRIVATE
|
||||
|
||||
#include <Foundation/NSZone.h>
|
||||
#include "GSPrivate.h"
|
||||
#include "GSString.h"
|
||||
|
||||
@class NSDictionary;
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -76,6 +78,7 @@
|
|||
#include "GNUstepBase/GSFunctions.h"
|
||||
|
||||
#include "GSFormat.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <string.h> // for strstr()
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -113,75 +113,6 @@ GS_EXPORT NSString *GSEncodingName(NSStringEncoding encoding);
|
|||
*/
|
||||
GS_EXPORT BOOL GSIsByteEncoding(NSStringEncoding encoding);
|
||||
|
||||
/*
|
||||
* Type to hold either UTF-16 (unichar) or 8-bit encodings,
|
||||
* while satisfying alignment constraints.
|
||||
*/
|
||||
typedef union {
|
||||
unichar *u; // 16-bit unicode characters.
|
||||
unsigned char *c; // 8-bit characters.
|
||||
} GSCharPtr;
|
||||
|
||||
/*
|
||||
* Private concrete string classes.
|
||||
* NB. All these concrete string classes MUST have the same initial ivar
|
||||
* layout so that we can swap between them as necessary.
|
||||
* The initial layout must also match that of NXConstantString (which is
|
||||
* determined by the compiler) - an initial pointer to the string data
|
||||
* followed by the string length (number of characters).
|
||||
*/
|
||||
@interface GSString : NSString
|
||||
{
|
||||
GSCharPtr _contents;
|
||||
unsigned int _count;
|
||||
struct {
|
||||
unsigned int wide: 1; // 16-bit characters in string?
|
||||
unsigned int free: 1; // Set if the instance owns the
|
||||
// _contents buffer
|
||||
unsigned int fixed: 1; // is fixed buffer
|
||||
unsigned int unused: 1;
|
||||
unsigned int hash: 28;
|
||||
} _flags;
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
* GSMutableString - concrete mutable string, capable of changing its storage
|
||||
* from holding 8-bit to 16-bit character set.
|
||||
*/
|
||||
@interface GSMutableString : NSMutableString
|
||||
{
|
||||
union {
|
||||
unichar *u;
|
||||
unsigned char *c;
|
||||
} _contents;
|
||||
unsigned int _count;
|
||||
struct {
|
||||
unsigned int wide: 1;
|
||||
unsigned int free: 1;
|
||||
unsigned int fixed: 1;
|
||||
unsigned int unused: 1;
|
||||
unsigned int hash: 28;
|
||||
} _flags;
|
||||
NSZone *_zone;
|
||||
unsigned int _capacity;
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
* Typedef for access to internals of concrete string objects.
|
||||
*/
|
||||
typedef struct {
|
||||
@defs(GSMutableString)
|
||||
} GSStr_t;
|
||||
typedef GSStr_t *GSStr;
|
||||
|
||||
/*
|
||||
* Functions to append to GSStr
|
||||
*/
|
||||
extern void GSStrAppendUnichar(GSStr s, unichar);
|
||||
extern void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l);
|
||||
|
||||
/*
|
||||
* Enumeration for MacOS-X compatibility user defaults settings.
|
||||
* For efficiency, we save defaults information which is used by the
|
||||
|
@ -201,11 +132,6 @@ typedef enum {
|
|||
*/
|
||||
BOOL GSUserDefaultsFlag(GSUserDefaultFlagType type);
|
||||
|
||||
/**
|
||||
* Get a flag from an environment variable - return def if not defined.
|
||||
*/
|
||||
BOOL GSEnvironmentFlag(const char *name, BOOL def);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
96
Source/GSString.h
Normal file
96
Source/GSString.h
Normal file
|
@ -0,0 +1,96 @@
|
|||
/* Definition for GNUStep of NSString concrete subclasses
|
||||
Copyright (C) 1997-2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
$Date: 2006-10-28 16:43:48 +0800 (Sat, 28 Oct 2006) $ $Revision: 23979 $
|
||||
*/
|
||||
|
||||
#ifndef __GSString_h_GNUSTEP_BASE_INCLUDE_PRIVATE
|
||||
#define __GSString_h_GNUSTEP_BASE_INCLUDE_PRIVATE
|
||||
|
||||
/*
|
||||
* Type to hold either UTF-16 (unichar) or 8-bit encodings,
|
||||
* while satisfying alignment constraints.
|
||||
*/
|
||||
typedef union {
|
||||
unichar *u; // 16-bit unicode characters.
|
||||
unsigned char *c; // 8-bit characters.
|
||||
} GSCharPtr;
|
||||
|
||||
/*
|
||||
* Private concrete string classes.
|
||||
* NB. All these concrete string classes MUST have the same initial ivar
|
||||
* layout so that we can swap between them as necessary.
|
||||
* The initial layout must also match that of NXConstantString (which is
|
||||
* determined by the compiler) - an initial pointer to the string data
|
||||
* followed by the string length (number of characters).
|
||||
*/
|
||||
@interface GSString : NSString
|
||||
{
|
||||
GSCharPtr _contents;
|
||||
unsigned int _count;
|
||||
struct {
|
||||
unsigned int wide: 1; // 16-bit characters in string?
|
||||
unsigned int free: 1; // Set if the instance owns the
|
||||
// _contents buffer
|
||||
unsigned int fixed: 1; // is fixed buffer
|
||||
unsigned int unused: 1;
|
||||
unsigned int hash: 28;
|
||||
} _flags;
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
* GSMutableString - concrete mutable string, capable of changing its storage
|
||||
* from holding 8-bit to 16-bit character set.
|
||||
*/
|
||||
@interface GSMutableString : NSMutableString
|
||||
{
|
||||
union {
|
||||
unichar *u;
|
||||
unsigned char *c;
|
||||
} _contents;
|
||||
unsigned int _count;
|
||||
struct {
|
||||
unsigned int wide: 1;
|
||||
unsigned int free: 1;
|
||||
unsigned int fixed: 1;
|
||||
unsigned int unused: 1;
|
||||
unsigned int hash: 28;
|
||||
} _flags;
|
||||
NSZone *_zone;
|
||||
unsigned int _capacity;
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
* Typedef for access to internals of concrete string objects.
|
||||
*/
|
||||
typedef struct {
|
||||
@defs(GSMutableString)
|
||||
} GSStr_t;
|
||||
typedef GSStr_t *GSStr;
|
||||
|
||||
/*
|
||||
* Functions to append to GSStr
|
||||
*/
|
||||
extern void GSStrAppendUnichar(GSStr s, unichar);
|
||||
extern void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l);
|
||||
|
||||
#endif /* __GSString_h_GNUSTEP_BASE_INCLUDE_PRIVATE */
|
|
@ -31,6 +31,8 @@
|
|||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -51,6 +53,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include "GSPrivate.h"
|
||||
#include "GSString.h"
|
||||
|
||||
extern BOOL GSEncodingSupported(NSStringEncoding enc);
|
||||
|
||||
|
@ -64,7 +67,6 @@ extern BOOL GSEncodingSupported(NSStringEncoding enc);
|
|||
struct objc_class _NSConstantStringClassReference;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* GSPlaceholderString - placeholder class for objects awaiting intialisation.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
|
@ -47,6 +48,7 @@
|
|||
#include "GNUstepBase/Unicode.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
#include "GSString.h"
|
||||
|
||||
extern BOOL GSScanDouble(unichar*, unsigned, double*);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <math.h>
|
||||
#include <ctype.h> /* FIXME: May go away once I figure out Unicode */
|
||||
#include "GSPrivate.h"
|
||||
#include "GSString.h"
|
||||
|
||||
/* BSD and Solaris have this */
|
||||
#if defined(HANDLE_LLONG_MAX) && !defined(HANDLE_LONG_LONG_MAX)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "Foundation/NSValue.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
#include "GSString.h"
|
||||
|
||||
@class GSDictionary;
|
||||
@class GSMutableDictionary;
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "Foundation/NSKeyedArchiver.h"
|
||||
#include "GNUstepBase/GSMime.h"
|
||||
#include "GSPrivate.h"
|
||||
#include "GSString.h"
|
||||
#include "GSFormat.h"
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -89,13 +90,11 @@
|
|||
|
||||
#include "GNUstepBase/Unicode.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
extern BOOL GSScanDouble(unichar*, unsigned, double*); // from NSScanner.m
|
||||
extern NSString* GetEncodingName(NSStringEncoding encoding); // from Additions/Unicode.m
|
||||
|
||||
@class GSString;
|
||||
@class GSMutableString;
|
||||
//@class GSString;
|
||||
//@class GSMutableString;
|
||||
@class GSPlaceholderString;
|
||||
@interface GSPlaceholderString : NSObject // Help the compiler
|
||||
@end
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
$Date: 2006-10-28 16:43:48 +0800 (Sat, 28 Oct 2006) $ $Revision: 23979 $
|
||||
*/
|
||||
|
||||
#include "GSURLPrivate.h"
|
||||
|
||||
#include "Foundation/NSError.h"
|
||||
|
||||
// Internal data storage
|
||||
typedef struct {
|
||||
|
@ -128,4 +130,3 @@ typedef struct {
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ NSString *StreamException = @"StreamException";
|
|||
|
||||
|
||||
|
||||
/* Standard domains */
|
||||
/* Standard domains for NSUserDefaults */
|
||||
NSString *NSArgumentDomain = @"NSArgumentDomain";
|
||||
|
||||
NSString *NSGlobalDomain = @"NSGlobalDomain";
|
||||
|
|
Loading…
Reference in a new issue