|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.0 (the 'License'). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License." ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: /* ! 25: NXStringPrivate.h ! 26: Copyright 1991, NeXT, Inc. ! 27: Responsibility: ! 28: */ ! 29: ! 30: #ifndef _OBJC_NXSTRINGPRIVATE_H_ ! 31: #define _OBJC_NXSTRINGPRIVATE_H_ ! 32: ! 33: #ifdef TESTING ! 34: #define NXString NxString ! 35: #define NXMutableString NxMutableString ! 36: #define NXReadWriteString NxReadWriteString ! 37: #define NXReadOnlyString NxReadOnlyString ! 38: #define NXReadOnlySubstring NxReadOnlySubstring ! 39: #define NXSimpleReadOnlyString NxSimpleReadOnlyString ! 40: #define NXUniquedString NxUniquedString ! 41: #define NXGapString NxGapString ! 42: #define NXBigString NxBigString ! 43: #define _NXStringZone _NxStringZone ! 44: #define _NXStringErrorRaise _NxStringErrorRaise ! 45: #define NXCompareCharacters NxCompareCharacters ! 46: #define NXFindCharacters NxFindCharacters ! 47: #define NXHashCharacters NxHashCharacters ! 48: #endif ! 49: ! 50: #import "NXString.h" ! 51: #import <string.h> ! 52: #import <stdlib.h> ! 53: #import <limits.h> ! 54: ! 55: #define CHARS_ARE_EIGHT_BIT 1 ! 56: #define SEPARATE_UNIQUED_ZONE 0 ! 57: ! 58: /* Separate zone for ref counted strings... */ ! 59: extern NXZone *_NXStringZone (void); ! 60: #define stringZone _NXStringZone () ! 61: ! 62: /* Where we allocate very temporary char buffers. */ ! 63: #define scratchZone NXDefaultMallocZone () ! 64: ! 65: #if CHARS_ARE_EIGHT_BIT ! 66: #define DATATYPEFORCHAR "c" ! 67: #define MAXCHARACTERCODE 0x0ff ! 68: #define NUMCHARACTERS 256 ! 69: #else ! 70: #define DATATYPEFORCHAR "s" ! 71: #define MAXCHARACTERCODE 0x0ffff ! 72: #define NUMCHARACTERS 65536 ! 73: #endif ! 74: ! 75: #define NX_STRING_MAXREFS USHRT_MAX ! 76: ! 77: /* Length of a temporary buffer allocated on the stack. ! 78: Used in several routines to avoid a malloc (). */ ! 79: #define MAXTMPBUFFERLEN 100 ! 80: ! 81: /* Number of characters copied from the strings for comparison. */ ! 82: #define COMPARELENGTH 32 ! 83: ! 84: #define MAXSTRINGLENFORHASHING NX_HASH_STRING_LENGTH ! 85: ! 86: #define NX_CHARALLOC(zone, num) \ ! 87: ((num) ? NXZoneMalloc ((zone), sizeof (unichar) * (num)) : NULL) ! 88: ! 89: #define NX_CHARCOPY(from, to, len) \ ! 90: bcopy ((from), (to), (len) * sizeof (unichar)) ! 91: ! 92: #define NX_BYTEALLOC(zone, num) \ ! 93: ((num) ? NXZoneMalloc ((zone), sizeof (char) * (num)) : NULL) ! 94: ! 95: #define RNGLEN(r) NX_LENGTH(r) ! 96: #define RNGLOC(r) NX_LOCATION(r) ! 97: ! 98: #ifndef MAX ! 99: #define MAX(a,b) ((a) > (b) ? (a) : (b)) ! 100: #endif ! 101: #ifndef MIN ! 102: #define MIN(a,b) ((a) < (b) ? (a) : (b)) ! 103: #endif ! 104: ! 105: extern void _initStrings (void); ! 106: ! 107: extern void _NXStringErrorRaise (int errorCode, const char *errorMsg); ! 108: ! 109: #define BOUNDSERROR _NXStringErrorRaise (NXStringBoundsError, "Out of bounds") ! 110: ! 111: #endif /* _OBJC_NXSTRINGPRIVATE_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.