Merge branch 'master' into add-weak-table-tests

This commit is contained in:
Fred Kiefer 2019-12-07 11:00:44 +01:00 committed by GitHub
commit 260a2cb969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 2909 additions and 109 deletions

View file

@ -1,24 +1,30 @@
language: cpp
dist: trusty
dist: xenial
compiler:
- clang
- gcc
env:
- LIBRARY_COMBO=gnu-gnu-gnu
- LIBRARY_COMBO=ng-gnu-gnu
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixed-abi
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi
- LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-2.0
matrix:
exclude:
- compiler: gcc
env: LIBRARY_COMBO=ng-gnu-gnu
- compiler: gcc
env: LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixed-abi
env: LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi
- compiler: gcc
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0
- compiler: gcc
env: LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-2.0
- compiler: clang
env: LIBRARY_COMBO=gnu-gnu-gnu
sudo: required
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y cmake pkg-config libgnutls28-dev libgmp-dev libffi-dev libicu-dev libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev libblocksruntime-dev
- sudo apt-get install -y cmake pkg-config libgnutls28-dev libgmp-dev libffi-dev libicu-dev libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev
- >
if [ $LIBRARY_COMBO = 'gnu-gnu-gnu' ];
then
@ -26,14 +32,32 @@ before_install:
then
sudo apt-get install -y gobjc;
fi;
sudo apt-get install -y libobjc-4.8-dev;
sudo apt-get install -y libobjc-4.8-dev libblocksruntime-dev;
else
sudo apt-get install -y libkqueue-dev libpthread-workqueue-dev;
curl -s -o - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -;
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" && sudo apt-get update -qq;
sudo apt-get install -y clang-9 libkqueue-dev libpthread-workqueue-dev;
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-9;
export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/local\/clang-7.0.0\/bin//');
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ];
then
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10;
fi;
fi;
# libdispatch requires a fairly recent version of cmake
- >
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ];
then
curl -LO https://cmake.org/files/v3.15/cmake-3.15.5-Linux-x86_64.tar.gz;
tar xf cmake-3.15.5-Linux-x86_64.tar.gz;
mv cmake-3.15.5-Linux-x86_64 $HOME/cmake;
export PATH=$HOME/cmake/:$HOME/cmake/bin:$PATH
fi;
install: ./travis-deps.sh
before_script: >
export LIBRARY_PATH=$HOME/staging/lib:$LIBRARY_PATH;
export LD_LIBRARY_PATH=$HOME/staging/lib:$LD_LIBRARY_PATH;
export LIBRARY_PATH=$HOME/staging/lib:$HOME/staging/lib64:$LIBRARY_PATH;
export LD_LIBRARY_PATH=$HOME/staging/lib:$HOME/staging/lib64:$LD_LIBRARY_PATH;
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ];
then
export CPATH=$HOME/staging/include;
@ -44,5 +68,5 @@ before_script: >
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles;
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh;
script: >
./configure $BASE_ABI;
./configure $BASE_ABI || (cat config.log && false);
make && make install && make check || (cat Tests/tests.log && false);

View file

@ -5,6 +5,42 @@
Added tests for [NSHashTable weakObjectsHashTable] and
[NSMapTable strongToWeakObjectsMapTable].
2019-11-26 Niels Grewe <niels.grewe@halbordnung.de>
* Source/NSRunLoop.m:
* Tests/base/NSRunLoop/dispatch.m:
Fix runloop integration for libdispatch from swift-corelibs
* .travis.yml:
* travis-deps.yml:
Fix CI related to libdispatch.
2019-11-15 Frederik Seiffert <frederik@algoriddim.com>
* configure.ac: check for unwind.h
* configure: regenerate
* Source/NSException.m: Added support for backtrace symbolication
using libunwind, which will be used when backtrace() is unavailable.
2019-11-14 Fred Kiefer <fredkiefer@gmx.de>
* Headers/Foundation/NSXPCConnection.h,
* Source/NSXPCConnection.m: Fix broken compilation on gcc.
2019-11-12 Richard Frith-Macdonald <rfm@gnu.org>
* NSTimeZones/NSTimeZones.tar: updated to latest info
2019-11-05 Frederik Seiffert <frederik@algoriddim.com>
* Headers/Foundation/NSProcessInfo.h:
* Source/NSPathUtilities.m:
* Source/NSProcessInfo.m:
Added support for NSTemporaryDirectory() on Android using subfolder
in folder returned by Context.getCacheDir(), as there is no official
temp dir prior to API level 26. Clean up temp dir on launch in
GSInitializeProcessAndroid(). Also use Context.getCacheDir()
as NSCachesDirectory (with NSUserDomainMask) on Android.
2019-10-27 Fred Kiefer <fredkiefer@gmx.de>
* Headers/Foundation/NSUnit.h,

View file

@ -31,6 +31,7 @@
#import <objc/objc.h>
#import <Foundation/FoundationErrors.h>
#import <Foundation/FoundationLegacySwiftCompatibility.h>
#import <Foundation/NSObjCRuntime.h>
#import <GNUstepBase/GSConfig.h>
#import <Foundation/NSDebug.h>
@ -57,6 +58,7 @@
#import <Foundation/NSCompoundPredicate.h>
#import <Foundation/NSConnection.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDateComponentsFormatter.h>
#import <Foundation/NSDateFormatter.h>
#import <Foundation/NSDateInterval.h>
#import <Foundation/NSDateIntervalFormatter.h>
@ -71,6 +73,9 @@
#import <Foundation/NSError.h>
#import <Foundation/NSException.h>
#import <Foundation/NSExpression.h>
#import <Foundation/NSExtensionContext.h>
#import <Foundation/NSExtensionItem.h>
#import <Foundation/NSExtensionRequestHandling.h>
#import <Foundation/NSFileCoordinator.h>
#import <Foundation/NSFileHandle.h>
#import <Foundation/NSFileManager.h>
@ -90,11 +95,14 @@
#import <Foundation/NSInvocation.h>
#import <Foundation/NSInvocationOperation.h>
#import <Foundation/NSISO8601DateFormatter.h>
#import <Foundation/NSItemProvider.h>
#import <Foundation/NSItemProviderReadingWriting.h>
#import <Foundation/NSJSONSerialization.h>
#import <Foundation/NSKeyedArchiver.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSKeyValueObserving.h>
#import <Foundation/NSLengthFormatter.h>
#import <Foundation/NSLinguisticTagger.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSLocale.h>
#import <Foundation/NSMapTable.h>
@ -111,6 +119,7 @@
#import <Foundation/NSObjectScripting.h>
#import <Foundation/NSOperation.h>
#import <Foundation/NSOrderedSet.h>
#import <Foundation/NSOrthography.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSPersonNameComponents.h>
#import <Foundation/NSPersonNameComponentsFormatter.h>
@ -179,6 +188,7 @@
#import <Foundation/NSXMLNode.h>
#import <Foundation/NSXMLNodeOptions.h>
#import <Foundation/NSXMLParser.h>
#import <Foundation/NSXPCConnection.h>
#import <Foundation/NSZone.h>
#ifdef __has_include

View file

@ -0,0 +1,30 @@
/* Definition of header FoundationLegacySwiftCompatibility
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Tue Nov 12 23:50:29 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _FoundationLegacySwiftCompatibility_h_GNUSTEP_BASE_INCLUDE
#define _FoundationLegacySwiftCompatibility_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObjCRuntime.h>
#endif

View file

@ -15,16 +15,7 @@ Missing macros:
Missing headers:
==
FoundationLegacySwiftCompatibility.h
NSDateComponentsFormatter.h
NSExtensionContext.h
NSExtensionItem.h
NSExtensionRequestHandling.h
NSItemProvider.h
NSItemProviderReadingWriting.h
NSLinguisticTagger.h
NSOrthography.h
NSXPCConnection.h
NONE
-------------------------------------------------------------
FoundationErrors:

View file

@ -107,11 +107,12 @@ GS_NSByteCountFormatter_IVARS;
- (BOOL) zeroPadsFractionDigits;
- (void) setZeroPadsFractionDigits: (BOOL)flag;
/* Beta methods... not yet implemented.
- (NSString *)stringForObjectValue: (id)obj;
- (NSString *)stringFromMeasurement
*/
- (NSString *) stringForObjectValue: (id)obj;
/* Beta methods...
- (NSString *) stringFromMeasurement: (NSMeasurement *)measurement;
End beta methods. */
- (NSString *)stringFromByteCount: (long long)byteCount;
+ (NSString *)stringFromByteCount: (long long)byteCount

View file

@ -0,0 +1,142 @@
/* Definition of class NSDateComponentsFormatter
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Wed Nov 6 00:24:02 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSDateComponentsFormatter_h_GNUSTEP_BASE_INCLUDE
#define _NSDateComponentsFormatter_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSFormatter.h>
#include <Foundation/NSCalendar.h>
#if OS_API_VERSION(MAC_OS_X_10_10, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
enum
{
// "1:10; may fall back to abbreviated units in some cases (such as 3d)"
NSDateComponentsFormatterUnitsStylePositional = 0,
// "1h 10m"
NSDateComponentsFormatterUnitsStyleAbbreviated,
// "1hr, 10min"
NSDateComponentsFormatterUnitsStyleShort,
// "1 hour, 10 minutes"
NSDateComponentsFormatterUnitsStyleFull,
// "One hour, ten minutes"
NSDateComponentsFormatterUnitsStyleSpellOut,
// "1hr 10min" - Brief is shorter than Short
NSDateComponentsFormatterUnitsStyleBrief,
};
typedef NSInteger NSDateComponentsFormatterUnitsStyle;
enum
{
//drop none, pad none
NSDateComponentsFormatterZeroFormattingBehaviorNone = (0),
//Positional units: drop leading zeros, pad other zeros. All others: drop all zeros.
NSDateComponentsFormatterZeroFormattingBehaviorDefault = (1 << 0),
// Off: "0h 10m", On: "10m"
NSDateComponentsFormatterZeroFormattingBehaviorDropLeading = (1 << 1),
// Off: "1h 0m 10s", On: "1h 10s"
NSDateComponentsFormatterZeroFormattingBehaviorDropMiddle = (1 << 2),
// Off: "1h 0m", On: "1h"
NSDateComponentsFormatterZeroFormattingBehaviorDropTrailing = (1 << 3),
NSDateComponentsFormatterZeroFormattingBehaviorDropAll = (NSDateComponentsFormatterZeroFormattingBehaviorDropLeading |
NSDateComponentsFormatterZeroFormattingBehaviorDropMiddle |
NSDateComponentsFormatterZeroFormattingBehaviorDropTrailing),
// Off: "1:0:10", On: "01:00:10"
NSDateComponentsFormatterZeroFormattingBehaviorPad = (1 << 16),
};
typedef NSUInteger NSDateComponentsFormatterZeroFormattingBehavior;
@class NSString, NSDate;
@interface NSDateComponentsFormatter : NSFormatter
{
NSCalendar *_calendar;
NSDate *_referenceDate;
BOOL _allowsFractionalUnits;
BOOL _collapsesLargestUnit;
BOOL _includesApproximationPhrase;
NSFormattingContext _formattingContext;
NSInteger _maximumUnitCount;
NSDateComponentsFormatterZeroFormattingBehavior _zeroFormattingBehavior;
NSCalendarUnit _allowedUnits;
NSDateComponentsFormatterUnitsStyle _unitsStyle;
}
- (NSString *) stringForObjectValue: (id)obj;
- (NSString *) stringFromDateComponents: (NSDateComponents *)components;
- (NSString *) stringFromDate: (NSDate *)startDate toDate: (NSDate *)endDate;
- (NSString *) stringFromTimeInterval: (NSTimeInterval)ti;
- (NSDateComponentsFormatterUnitsStyle) unitsStyle;
- (void) setUnitsStyle: (NSDateComponentsFormatterUnitsStyle)style;
- (NSCalendarUnit) allowedUnits;
- (void) setAllowedUnits: (NSCalendarUnit)units;
- (NSDateComponentsFormatterZeroFormattingBehavior) zeroFormattingBehavior;
- (void) setZeroFormattingBehavior: (NSDateComponentsFormatterZeroFormattingBehavior)behavior;
- (NSCalendar *) calendar;
- (void) setCalender: (NSCalendar *)calendar;
- (NSDate *) referenceDate;
- (void) setReferenceDate: (NSDate *)referenceDate;
- (BOOL) allowsFractionalUnits;
- (void) setAllowsFractionalUnits: (BOOL)allowsFractionalUnits;
- (NSInteger) maximumUnitCount;
- (void) setMaximumUnitCount: (NSInteger)maximumUnitCount;
- (BOOL) collapsesLargestUnit;
- (void) setCollapsesLargestUnit: (BOOL)collapsesLargestUnit;
- (BOOL) includesApproximationPhrase;
- (void) setIncludesApproximationPhrase: (BOOL)includesApproximationPhrase;
- (NSFormattingContext) formattingContext;
- (void) setFormattingContext: (NSFormattingContext)formattingContext;
- (BOOL) getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error;
+ (NSString *) localizedStringFromDateComponents: (NSDateComponents *)components
unitsStyle: (NSDateComponentsFormatterUnitsStyle)unitsStyle;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSDateComponentsFormatter_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,74 @@
/* Definition of class NSExtensionContext
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sun Nov 10 03:59:38 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSExtensionContext_h_GNUSTEP_BASE_INCLUDE
#define _NSExtensionContext_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
DEFINE_BLOCK_TYPE(GSExtensionContextReturningItemsCompletionHandler, void, BOOL);
DEFINE_BLOCK_TYPE(GSOpenURLCompletionHandler, void, BOOL);
@class NSError, NSArray, NSURL;
@interface NSExtensionContext : NSObject
{
NSArray *_inputItems;
}
- (void) setInputItems: (NSArray *)inputItems;
- (NSArray *) inputItems;
- (void)completeRequestReturningItems: (NSArray *)items completionHandler: (GSExtensionContextReturningItemsCompletionHandler)completionHandler;
- (void)cancelRequestWithError:(NSError *)error;
- (void)openURL: (NSURL *)URL completionHandler: (GSOpenURLCompletionHandler)completionHandler;
@end
GS_EXPORT NSString* const NSExtensionItemsAndErrorsKey;
GS_EXPORT NSString* const NSExtensionHostWillEnterForegroundNotification;
GS_EXPORT NSString* const NSExtensionHostDidEnterBackgroundNotification;
GS_EXPORT NSString* const NSExtensionHostWillResignActiveNotification;
GS_EXPORT NSString* const NSExtensionHostDidBecomeActiveNotification;
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSExtensionContext_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,73 @@
/* Definition of class NSExtensionItem
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sun Nov 10 03:59:46 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSExtensionItem_h_GNUSTEP_BASE_INCLUDE
#define _NSExtensionItem_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSAttributedString, NSArray, NSDictionary;
@interface NSExtensionItem : NSObject
{
NSAttributedString *_attributedTitle;
NSAttributedString *_attributedContentText;
NSArray *_attachments;
NSDictionary *_userInfo;
}
- (NSAttributedString *) attributedTitle;
- (void) setAttributedTitle: (NSAttributedString *)string;
- (NSAttributedString *) attributedContentText;
- (void) setAttributedContentText: (NSAttributedString *)string;
- (NSArray *) attachments;
- (void) setAttachments: (NSArray *)attachments;
- (NSDictionary *) userInfo;
- (void) setUserInfo: (NSDictionary *) userInfo;
@end
GS_EXPORT NSString * const NSExtensionItemAttributedTitleKey;
GS_EXPORT NSString * const NSExtensionItemAttributedContentTextKey;
GS_EXPORT NSString * const NSExtensionItemAttachmentsKey;
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSExtensionItem_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,51 @@
/* Definition of class NSExtensionRequestHandling
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sun Nov 10 04:00:05 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSExtensionRequestHandling_h_GNUSTEP_BASE_INCLUDE
#define _NSExtensionRequestHandling_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSExtensionContext;
@protocol NSExtensionRequestHandling <NSObject>
- (void) beginRequestWithExtensionContext: (NSExtensionContext *)context;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSExtensionRequestHandling_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,185 @@
/* Definition of class NSItemProvider
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sun Nov 10 04:00:17 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSItemProvider_h_GNUSTEP_BASE_INCLUDE
#define _NSItemProvider_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSItemProvider, NSProgress, NSData, NSError, NSURL, NSProgress, NSDictionary;;
DEFINE_BLOCK_TYPE(GSProviderCompletionHandler, void, NSData*, NSError**);
DEFINE_BLOCK_TYPE(GSProviderURLCompletionHandler, void, NSURL*, NSError**);
DEFINE_BLOCK_TYPE(GSProviderURLBOOLCompletionHandler, void, NSURL*, BOOL, NSError**);
DEFINE_BLOCK_TYPE(GSProgressHandler, NSProgress*, GSProviderCompletionHandler);
DEFINE_BLOCK_TYPE(GSProgressURLBOOLHandler, NSProgress*, GSProviderURLBOOLCompletionHandler);
DEFINE_BLOCK_TYPE(GSItemProviderWritingHandler, id, NSError**);
DEFINE_BLOCK_TYPE(GSItemProviderReadingHandler, id, NSError**);
DEFINE_BLOCK_TYPE(GSProgressItemProviderWritingLoadHandler, NSProgress*, GSItemProviderWritingHandler);
DEFINE_BLOCK_TYPE(GSProgressItemProviderReadingLoadHandler, NSProgress*, GSItemProviderReadingHandler);
DEFINE_BLOCK_TYPE(NSItemProviderCompletionHandler, void, id, NSError**);
DEFINE_BLOCK_TYPE(NSItemProviderLoadHandler, NSItemProviderCompletionHandler, Class, NSDictionary*);
enum
{
NSItemProviderRepresentationVisibilityAll = 0,
NSItemProviderRepresentationVisibilityTeam = 1,
NSItemProviderRepresentationVisibilityGroup = 2 ,
NSItemProviderRepresentationVisibilityOwnProcess = 3,
};
typedef NSInteger NSItemProviderRepresentationVisibility;
enum
{
NSItemProviderFileOptionOpenInPlace = 1,
};
typedef NSInteger NSItemProviderFileOptions;
@protocol NSItemProviderWriting <NSObject>
- (NSArray *) writableTypeIdentifiersForItemProvider;
- (void) setWritableTypeIdentifiersForItemProvider: (NSArray *)anArray;
+ (NSItemProviderRepresentationVisibility) itemProviderVisibilityForRepresentationWithTypeIdentifier: (NSString *)typeIdentifier;
- (NSItemProviderRepresentationVisibility) itemProviderVisibilityForRepresentationWithTypeIdentifier: (NSString *)typeIdentifier;
- (NSProgress *) loadDataWithTypeIdentifier: (NSString *)typeIdentifier
forItemProviderCompletionHandler: (GSProviderCompletionHandler)completionHandler;
@end
@protocol NSItemProviderReading <NSObject>
- (NSArray *) readableTypeIdentifiersForItemProvider;
- (void) setReadableTypeIdentifiersForItemProvider: (NSArray *)array;
+ (instancetype) objectWithItemProviderData: (NSData *)data
typeIdentifier: (NSString *)typeIdentifier
error: (NSError **)outError;
@end
@interface NSItemProvider : NSObject <NSCopying>
- (instancetype) init;
- (void) registerDataRepresentationForTypeIdentifier: (NSString *)typeIdentifier
visibility: (NSItemProviderRepresentationVisibility)visibility
loadHandler: (GSProgressHandler)loadHandler;
- (void) registerFileRepresentationForTypeIdentifier: (NSString *)typeIdentifier
fileOptions: (NSItemProviderFileOptions)fileOptions
visibility: (NSItemProviderRepresentationVisibility)visibility
loadHandler: (GSProgressURLBOOLHandler)loadHandler;
- (NSArray *) registeredTypeIdentifiers;
- (NSArray *) registeredTypeIdentifiersWithFileOptions: (NSItemProviderFileOptions)fileOptions;
- (BOOL) hasItemConformingToTypeIdentifier: (NSString *)typeIdentifier;
- (BOOL) hasRepresentationConformingToTypeIdentifier: (NSString *)typeIdentifier
fileOptions: (NSItemProviderFileOptions)fileOptions;
- (NSProgress *) loadDataRepresentationForTypeIdentifier: (NSString *)typeIdentifier
completionHandler: (GSProviderCompletionHandler)completionHandler;
- (NSProgress *) loadFileRepresentationForTypeIdentifier: (NSString *)typeIdentifier
completionHandler: (GSProviderURLCompletionHandler)completionHandler;
- (NSProgress *) loadInPlaceFileRepresentationForTypeIdentifier: (NSString *)typeIdentifier
completionHandler: (GSProviderURLBOOLCompletionHandler)completionHandler;
- (NSString *) suggestedName;
- (void) setSuggestedName: (NSString *)suggestedName;
- (instancetype) initWithObject: (id<NSItemProviderWriting>)object;
- (void) registerObject: (id<NSItemProviderWriting>)object visibility: (NSItemProviderRepresentationVisibility)visibility;
- (void) registerObjectOfClass: (Class<NSItemProviderWriting>)aClass // NSItemProviderWriting conforming class...
visibility: (NSItemProviderRepresentationVisibility)visibility
loadHandler: (GSItemProviderWritingHandler)loadHandler;
- (BOOL) canLoadObjectOfClass: (Class<NSItemProviderReading>)aClass;
- (NSProgress *) loadObjectOfClass: (Class<NSItemProviderReading>)aClass // NSItemProviderReading conforming class...
completionHandler: (GSItemProviderReadingHandler)completionHandler;
- (instancetype) initWithItem: (id<NSSecureCoding>)item typeIdentifier: (NSString *)typeIdentifier; // designated init
- (instancetype) initWithContentsOfURL: (NSURL *)fileURL;
- (void) registerItemForTypeIdentifier: (NSString *)typeIdentifier loadHandler: (NSItemProviderLoadHandler)loadHandler;
- (void)loadItemForTypeIdentifier: (NSString *)typeIdentifier
options: (NSDictionary *)options
completionHandler: (NSItemProviderCompletionHandler)completionHandler;
@end
// Preview support
GS_EXPORT NSString * const NSItemProviderPreferredImageSizeKey;
@interface NSItemProvider (NSPreviewSupport)
- (NSItemProviderLoadHandler) previewImageHandler;
- (void) setPreviewImageHandler: (NSItemProviderLoadHandler) previewImageHandler;
- (void) loadPreviewImageWithOptions: (NSDictionary *)options
completionHandler: (NSItemProviderCompletionHandler)completionHandler;
@end
GS_EXPORT NSString * const NSExtensionJavaScriptPreprocessingResultsKey;
GS_EXPORT NSString * const NSExtensionJavaScriptFinalizeArgumentKey;
GS_EXPORT NSString * const NSItemProviderErrorDomain;
enum {
NSItemProviderUnknownError = -1,
NSItemProviderItemUnavailableError = -1000,
NSItemProviderUnexpectedValueClassError = -1100,
NSItemProviderUnavailableCoercionError = -1200
};
typedef NSInteger NSItemProviderErrorCode;
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSItemProvider_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,47 @@
/* Definition of class NSItemProviderReadingWriting
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sun Nov 10 04:00:24 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSItemProviderReadingWriting_h_GNUSTEP_BASE_INCLUDE
#define _NSItemProviderReadingWriting_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@interface NSItemProviderReadingWriting : NSObject
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSItemProviderReadingWriting_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,239 @@
/* Definition of class NSLinguisticTagger
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory John Casamento <greg.casamento@gmail.com>
Date: Sat Nov 2 21:37:50 EDT 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSLinguisticTagger_h_GNUSTEP_BASE_INCLUDE
#define _NSLinguisticTagger_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#include <Foundation/NSRange.h>
#include <Foundation/NSString.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSString, NSArray, NSOrthography;
typedef NSString* NSLinguisticTagScheme;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeTokenType;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeLexicalClass;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeNameType;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeNameTypeOrLexicalClass;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeLemma;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeLanguage;
GS_EXPORT NSLinguisticTagScheme const NSLinguisticTagSchemeScript;
typedef NSString* NSLinguisticTag;
/* Tags for NSLinguisticTagSchemeTokenType */
GS_EXPORT NSLinguisticTag const NSLinguisticTagWord;
GS_EXPORT NSLinguisticTag const NSLinguisticTagPunctuation;
GS_EXPORT NSLinguisticTag const NSLinguisticTagWhitespace;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOther;
/* Tags for NSLinguisticTagSchemeLexicalClass */
GS_EXPORT NSLinguisticTag const NSLinguisticTagNoun;
GS_EXPORT NSLinguisticTag const NSLinguisticTagVerb;
GS_EXPORT NSLinguisticTag const NSLinguisticTagAdjective;
GS_EXPORT NSLinguisticTag const NSLinguisticTagAdverb;
GS_EXPORT NSLinguisticTag const NSLinguisticTagPronoun;
GS_EXPORT NSLinguisticTag const NSLinguisticTagDeterminer;
GS_EXPORT NSLinguisticTag const NSLinguisticTagParticle;
GS_EXPORT NSLinguisticTag const NSLinguisticTagPreposition;
GS_EXPORT NSLinguisticTag const NSLinguisticTagNumber;
GS_EXPORT NSLinguisticTag const NSLinguisticTagConjunction;
GS_EXPORT NSLinguisticTag const NSLinguisticTagInterjection;
GS_EXPORT NSLinguisticTag const NSLinguisticTagClassifier;
GS_EXPORT NSLinguisticTag const NSLinguisticTagIdiom;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOtherWord;
GS_EXPORT NSLinguisticTag const NSLinguisticTagSentenceTerminator;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOpenQuote;
GS_EXPORT NSLinguisticTag const NSLinguisticTagCloseQuote;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOpenParenthesis;
GS_EXPORT NSLinguisticTag const NSLinguisticTagCloseParenthesis;
GS_EXPORT NSLinguisticTag const NSLinguisticTagWordJoiner;
GS_EXPORT NSLinguisticTag const NSLinguisticTagDash;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOtherPunctuation;
GS_EXPORT NSLinguisticTag const NSLinguisticTagParagraphBreak;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOtherWhitespace;
/* Tags for NSLinguisticTagSchemeNameType */
GS_EXPORT NSLinguisticTag const NSLinguisticTagPersonalName;
GS_EXPORT NSLinguisticTag const NSLinguisticTagPlaceName;
GS_EXPORT NSLinguisticTag const NSLinguisticTagOrganizationName;
enum
{
NSLinguisticTaggerUnitWord,
NSLinguisticTaggerUnitSentence,
NSLinguisticTaggerUnitParagraph,
NSLinguisticTaggerUnitDocument
};
typedef NSUInteger NSLinguisticTaggerUnit;
enum
{
NSLinguisticTaggerOmitWords = 1 << 0,
NSLinguisticTaggerOmitPunctuation = 1 << 1,
NSLinguisticTaggerOmitWhitespace = 1 << 2,
NSLinguisticTaggerOmitOther = 1 << 3,
NSLinguisticTaggerJoinNames = 1 << 4
};
typedef NSUInteger NSLinguisticTaggerOptions;
DEFINE_BLOCK_TYPE(GSLinguisticTagRangeBoolBlock, void, NSLinguisticTag, NSRange, BOOL);
DEFINE_BLOCK_TYPE(GSLinguisticTagRangeRangeBoolBlock, void, NSLinguisticTag, NSRange, NSRange, BOOL);
@interface NSLinguisticTagger : NSObject
{
NSArray *_schemes;
NSString *_string;
NSString *_dominantLanguage;
NSArray *_tokenArray;
NSArray *_orthographyArray;
NSUInteger _options;
}
- (instancetype) initWithTagSchemes: (NSArray *)tagSchemes
options: (NSUInteger)opts;
- (NSArray *) tagSchemes;
- (NSString *) string;
- (void) setString: (NSString *)string;
+ (NSArray *) availableTagSchemesForUnit: (NSLinguisticTaggerUnit)unit
language: (NSString *)language;
+ (NSArray *) availableTagSchemesForLanguage: (NSString *)language;
- (void) setOrthography: (NSOrthography *)orthography
range: (NSRange)range;
- (NSOrthography *) orthographyAtIndex: (NSUInteger)charIndex
effectiveRange: (NSRangePointer)effectiveRange;
- (void) stringEditedInRange: (NSRange)newRange
changeInLength: (NSInteger)delta;
- (NSRange) tokenRangeAtIndex: (NSUInteger)charIndex
unit: (NSLinguisticTaggerUnit)unit;
- (NSRange) sentenceRangeForRange: (NSRange)range;
- (void) enumerateTagsInRange: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
usingBlock: (GSLinguisticTagRangeBoolBlock)block;
- (NSLinguisticTag) tagAtIndex: (NSUInteger)charIndex
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
tokenRange: (NSRangePointer)tokenRange;
- (NSArray *) tagsInRange: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
tokenRanges: (NSArray **)tokenRanges;
- (void) enumerateTagsInRange: (NSRange)range
scheme: (NSLinguisticTagScheme)tagScheme
options: (NSLinguisticTaggerOptions)opts
usingBlock: (GSLinguisticTagRangeRangeBoolBlock)block;
- (NSLinguisticTag) tagAtIndex: (NSUInteger)charIndex
scheme: (NSLinguisticTagScheme)scheme
tokenRange: (NSRangePointer)tokenRange
sentenceRange: (NSRangePointer)sentenceRange;
- (NSArray *) tagsInRange: (NSRange)range
scheme: (NSString *)tagScheme
options: (NSLinguisticTaggerOptions)opts
tokenRanges: (NSArray **)tokenRanges;
- (NSString *) dominantLanguage;
+ (NSString *) dominantLanguageForString: (NSString *)string;
+ (NSLinguisticTag) tagForString: (NSString *)string
atIndex: (NSUInteger)charIndex
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
orthography: (NSOrthography *)orthography
tokenRange: (NSRangePointer)tokenRange;
+ (NSArray *)tagsForString: (NSString *)string
range: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
orthography: (NSOrthography *)orthography
tokenRanges: (NSArray **)tokenRanges;
+ (void) enumerateTagsForString: (NSString *)string
range: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
orthography: (NSOrthography *)orthography
usingBlock: (GSLinguisticTagRangeBoolBlock)block;
- (NSArray *) possibleTagsAtIndex: (NSUInteger)charIndex
scheme: (NSString *)tagScheme
tokenRange: (NSRangePointer)tokenRange
sentenceRange: (NSRangePointer)sentenceRange
scores: (NSArray **)scores;
@end
@interface NSString (NSLinguisticAnalysis)
- (NSArray *) linguisticTagsInRange: (NSRange)range
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
orthography: (NSOrthography *)orthography
tokenRanges: (NSArray **)tokenRanges;
- (void) enumerateLinguisticTagsInRange: (NSRange)range
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
orthography: (NSOrthography *)orthography
usingBlock: (GSLinguisticTagRangeRangeBoolBlock)block;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSLinguisticTagger_h_GNUSTEP_BASE_INCLUDE */

View file

@ -0,0 +1,69 @@
/* Definition of class NSOrthography
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Tue Nov 5 03:43:39 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSOrthography_h_GNUSTEP_BASE_INCLUDE
#define _NSOrthography_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSDictionary, NSString, NSArray;
@interface NSOrthography : NSObject <NSCopying, NSCoding>
{
NSDictionary *_languageMap;
NSString *_dominantScript;
}
- (instancetype) initWithDominantScript: (NSString *)script
languageMap: (NSDictionary *)map;
- (NSString *) dominantScript;
- (NSDictionary *) languationMap;
- (NSArray *) languagesForScript: (NSString *)script;
- (NSString *) dominantLanguageForScript: (NSString *)script;
- (NSString *) dominantLanguage;
- (NSArray *) allScripts;
- (NSArray *) allLanguages;
+ (instancetype) defaultOrthographyForLanguage: (NSString *)language;
+ (instancetype) orthographyWithDominantScript: (NSString *)script languageMap: (NSDictionary *)map;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSOrthography_h_GNUSTEP_BASE_INCLUDE */

View file

@ -273,6 +273,7 @@ DEFINE_BLOCK_TYPE(GSPerformExpiringActivityBlock, void, BOOL);
#ifdef __ANDROID__
- (jobject) androidContext;
- (NSString *) androidFilesDir;
- (NSString *) androidCacheDir;
#endif
@end

View file

@ -0,0 +1,165 @@
/* Definition of class NSXPCConnection
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Tue Nov 12 23:50:29 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#ifndef _NSXPCConnection_h_GNUSTEP_BASE_INCLUDE
#define _NSXPCConnection_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#include <Foundation/NSError.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSMutableDictionary, NSString, NSOperationQueue, NSSet, NSLock, NSError;
@class NSXPCConnection, NSXPCListener, NSXPCInterface, NSXPCListenerEndpoint;
@protocol NSXPCListenerDelegate;
DEFINE_BLOCK_TYPE(GSXPCProxyErrorHandler, void, NSError *);
DEFINE_BLOCK_TYPE_NO_ARGS(GSXPCInterruptionHandler, void);
DEFINE_BLOCK_TYPE_NO_ARGS(GSXPCInvalidationHandler, void);
@protocol NSXPCProxyCreating
- (id) remoteObjectProxy;
- (id) remoteObjectProxyWithErrorHandler: (GSXPCProxyErrorHandler)handler;
- (id) synchronousRemoteObjectProxyWithErrorHandler: (GSXPCProxyErrorHandler)handler;
@end
enum
{
NSXPCConnectionPrivileged = (1 << 12UL)
};
typedef NSUInteger NSXPCConnectionOptions;
@interface NSXPCConnection : NSObject <NSXPCProxyCreating>
- (instancetype)initWithServiceName:(NSString *)serviceName;
- (NSString *) serviceName;
- (void) setServiceName: (NSString *)serviceName;
- (instancetype)initWithMachServiceName:(NSString *)name options:(NSXPCConnectionOptions)options;
- (instancetype)initWithListenerEndpoint:(NSXPCListenerEndpoint *)endpoint;
- (NSXPCListenerEndpoint *) endpoint;
- (void) setEndpoint: (NSXPCListenerEndpoint *) endpoint;
- (NSXPCInterface *) exportedInterface;
- (void) setExportInterface: (NSXPCInterface *)exportedInterface;
- (NSXPCInterface *) remoteObjectInterface;
- (void) setRemoteObjectInterface: (NSXPCInterface *)remoteObjectInterface;
- (id) remoteObjectProxy;
- (void) setRemoteObjectProxy: (id)remoteObjectProxy;
- (id) remoteObjectProxyWithErrorHandler:(GSXPCProxyErrorHandler)handler;
- (id) synchronousRemoteObjectProxyWithErrorHandler:(GSXPCProxyErrorHandler)handler;
- (GSXPCInterruptionHandler) interruptionHandler;
- (void) setInterruptionHandler: (GSXPCInterruptionHandler)handler;
- (GSXPCInvalidationHandler) invalidationHandler;
- (void) setInvalidationHandler: (GSXPCInvalidationHandler)handler;
- (void) resume;
- (void) suspend;
- (void) invalidate;
- (NSUInteger) auditSessionIdentifier;
- (NSUInteger) processIdentifier;
- (NSUInteger) effectiveUserIdentifier;
- (NSUInteger) effectiveGroupIdentifier;
@end
@interface NSXPCListener : NSObject
+ (NSXPCListener *) serviceListener;
+ (NSXPCListener *) anonymousListener;
- (instancetype) initWithMachServiceName:(NSString *)name;
- (id <NSXPCListenerDelegate>) delegate;
- (void) setDelegate: (id <NSXPCListenerDelegate>) delegate;
- (NSXPCListenerEndpoint *) endpoint;
- (void) setEndpoint: (NSXPCListenerEndpoint *)endpoint;
- (void) resume;
- (void) suspend;
- (void) invalidate;
@end
@protocol NSXPCListenerDelegate <NSObject>
- (BOOL) listener: (NSXPCListener *)listener shouldAcceptNewConnection: (NSXPCConnection *)newConnection;
@end
@interface NSXPCInterface : NSObject
+ (NSXPCInterface *) interfaceWithProtocol: (Protocol *)protocol;
- (Protocol *) protocol;
- (void) setProtocol: (Protocol *)protocol;
- (void) setClasses: (NSSet *)classes forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply;
- (NSSet *) classesForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply;
- (void) setInterface: (NSXPCInterface *)ifc forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply;
- (NSXPCInterface *) interfaceForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply;
@end
@interface NSXPCListenerEndpoint : NSObject <NSCoding> // NSSecureCoding
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSXPCConnection_h_GNUSTEP_BASE_INCLUDE */

View file

@ -450,7 +450,7 @@ GSIMapAddNodeToMap(GSIMapTable map, GSIMapNode node)
{
GSIMapBucket bucket;
bucket = GSIMapBucketForKey(map, node->key);
bucket = GSIMapBucketForKey(map, GSI_MAP_READ_KEY(map, &node->key));
GSIMapAddNodeToBucket(bucket, node);
map->nodeCount++;
}
@ -543,7 +543,7 @@ GSIMapRemangleBuckets(GSIMapTable map,
GSIMapBucket bkt;
GSIMapRemoveNodeFromBucket(old_buckets, node);
bkt = GSIMapPickBucket(GSI_MAP_HASH(map, node->key),
bkt = GSIMapPickBucket(GSI_MAP_HASH(map, GSI_MAP_READ_KEY(map, &node->key)),
new_buckets, new_bucketCount);
GSIMapAddNodeToBucket(bkt, node);
}
@ -561,7 +561,7 @@ GSIMapRemangleBuckets(GSIMapTable map,
GSIMapBucket bkt;
GSIMapRemoveNodeFromBucket(old_buckets, node);
bkt = GSIMapPickBucket(GSI_MAP_HASH(map, node->key),
bkt = GSIMapPickBucket(GSI_MAP_HASH(map, GSI_MAP_READ_KEY(map, &node->key)),
new_buckets, new_bucketCount);
GSIMapAddNodeToBucket(bkt, node);
}

View file

@ -737,6 +737,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <unwind.h> header file. */
#undef HAVE_UNWIND_H
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP

Binary file not shown.

View file

@ -215,6 +215,7 @@ NSConcreteMapTable.m \
NSConnection.m \
NSData.m \
NSDate.m \
NSDateComponentsFormatter.m \
NSDateFormatter.m \
NSDateInterval.m \
NSDateIntervalFormatter.m \
@ -229,6 +230,8 @@ NSEnergyFormatter.m \
NSEnumerator.m \
NSError.m \
NSException.m \
NSExtensionContext.m \
NSExtensionItem.m \
NSFileCoordinator.m \
NSFileHandle.m \
NSFileManager.m \
@ -247,12 +250,15 @@ NSIndexSet.m \
NSInvocation.m \
NSInvocationOperation.m \
NSISO8601DateFormatter.m \
NSItemProvider.m \
NSItemProviderReadingWriting.m \
NSJSONSerialization.m \
NSKeyedArchiver.m \
NSKeyedUnarchiver.m \
NSKeyValueCoding.m \
NSKeyValueObserving.m \
NSLengthFormatter.m \
NSLinguisticTagger.m \
NSLocale.m \
NSLock.m \
NSLog.m \
@ -275,6 +281,7 @@ NSObjectScripting.m \
NSObject+NSComparisonMethods.m \
NSOperation.m \
NSOrderedSet.m \
NSOrthography.m \
NSPage.m \
NSPathUtilities.m \
NSPersonNameComponents.m \
@ -348,6 +355,7 @@ NSXMLDTDNode.m \
NSXMLElement.m \
NSXMLNode.m \
NSXMLParser.m \
NSXPCConnection.m \
NSZone.m \
externs.m \
objc-load.m
@ -397,6 +405,7 @@ tzfile.h
FOUNDATION_HEADERS = \
Foundation.h \
FoundationErrors.h \
FoundationLegacySwiftCompatibility.h \
NSAffineTransform.h \
NSAppleEventDescriptor.h \
NSAppleEventManager.h \
@ -419,6 +428,7 @@ NSComparisonPredicate.h \
NSCompoundPredicate.h \
NSConnection.h \
NSData.h \
NSDateComponentsFormatter.h \
NSDateFormatter.h \
NSDateInterval.h \
NSDateIntervalFormatter.h \
@ -435,6 +445,9 @@ NSEnumerator.h \
NSError.h \
NSErrorRecoveryAttempting.h \
NSException.h \
NSExtensionContext.h \
NSExtensionItem.h \
NSExtensionRequestHandling.h \
NSExpression.h \
NSFileCoordinator.h \
NSFileHandle.h \
@ -455,11 +468,14 @@ NSIndexSet.h \
NSInvocation.h \
NSInvocationOperation.h \
NSISO8601DateFormatter.h \
NSItemProvider.h \
NSItemProviderReadingWriting.h \
NSJSONSerialization.h \
NSKeyedArchiver.h \
NSKeyValueCoding.h \
NSKeyValueObserving.h \
NSLengthFormatter.h \
NSLinguisticTagger.h \
NSLocale.h \
NSLock.h \
NSMapTable.h \
@ -479,6 +495,7 @@ NSObject.h \
NSObjectScripting.h \
NSOperation.h \
NSOrderedSet.h \
NSOrthography.h \
NSPathUtilities.h \
NSPersonNameComponents.h \
NSPersonNameComponentsFormatter.h \
@ -551,6 +568,7 @@ NSXMLElement.h \
NSXMLNode.h \
NSXMLNodeOptions.h \
NSXMLParser.h \
NSXPCConnection.h \
NSZone.h
HEADERS_INSTALL = \

View file

@ -69,7 +69,13 @@ GS_PRIVATE_INTERNAL(NSByteCountFormatter)
- (NSString *)stringForObjectValue: (id)obj
{
long long byteCount = [obj longLongValue];
long long byteCount = 0;
if([obj respondsToSelector: @selector(longLongValue)])
{
byteCount = [obj longLongValue];
}
return [self stringFromByteCount: byteCount];
}

View file

@ -75,7 +75,9 @@ typedef GSIMapNode_t *GSIMapNode;
#define GSI_MAP_KTYPES GSUNION_PTR | GSUNION_OBJ
#define GSI_MAP_TABLE_T NSConcreteHashTable
#define GSI_MAP_TABLE_S instanceSize
#define IS_WEAK(M) \
M->cb.pf.options & (NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsWeakMemory)
#define GSI_MAP_HASH(M, X)\
(M->legacy ? M->cb.old.hash(M, X.ptr) \
: pointerFunctionsHash(&M->cb.pf, X.ptr))
@ -84,13 +86,13 @@ typedef GSIMapNode_t *GSIMapNode;
: pointerFunctionsEqual(&M->cb.pf, X.ptr, Y.ptr))
#define GSI_MAP_RELEASE_KEY(M, X)\
(M->legacy ? M->cb.old.release(M, X.ptr) \
: pointerFunctionsRelinquish(&M->cb.pf, &X.ptr))
: IS_WEAK(M) ? nil : pointerFunctionsRelinquish(&M->cb.pf, &X.ptr))
#define GSI_MAP_RETAIN_KEY(M, X)\
(M->legacy ? M->cb.old.retain(M, X.ptr) \
: pointerFunctionsAcquire(&M->cb.pf, &X.ptr, X.ptr))
: IS_WEAK(M) ? nil : pointerFunctionsAcquire(&M->cb.pf, &X.ptr, X.ptr))
#define GSI_MAP_ZEROED(M)\
(M->legacy ? 0 \
: ((M->cb.pf.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
: (IS_WEAK(M) ? YES : NO))
#define GSI_MAP_WRITE_KEY(M, addr, x) \
if (M->legacy) \
@ -100,9 +102,6 @@ typedef GSIMapNode_t *GSIMapNode;
#define GSI_MAP_READ_KEY(M,addr) \
(M->legacy ? *(addr) :\
(typeof(*addr))pointerFunctionsRead(&M->cb.pf, (void**)addr))
#define GSI_MAP_ZEROED(M)\
(M->legacy ? 0 \
: ((M->cb.pf.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
#define GSI_MAP_ENUMERATOR NSHashEnumerator
@ -628,7 +627,13 @@ NSNextHashEnumeratorItem(NSHashEnumerator *enumerator)
}
else
{
return n->key.ptr;
NSConcreteHashTable *map = enumerator->map;
GSIMapKey k = GSI_MAP_READ_KEY(map, &n->key);
if (k.ptr == NULL)
{
return NSNextHashEnumeratorItem(enumerator);
}
return k.ptr;
}
}
else if (enumerator->node != 0) // Got an enumerator object

View file

@ -81,6 +81,10 @@ typedef GSIMapNode_t *GSIMapNode;
#define GSI_MAP_KTYPES GSUNION_PTR | GSUNION_OBJ
#define GSI_MAP_VTYPES GSUNION_PTR | GSUNION_OBJ
#define IS_WEAK_KEY(M) \
M->cb.pf.k.options & (NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsWeakMemory)
#define IS_WEAK_VALUE(M) \
M->cb.pf.v.options & (NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsWeakMemory)
#define GSI_MAP_HASH(M, X)\
(M->legacy ? M->cb.old.k.hash(M, X.ptr) \
: pointerFunctionsHash(&M->cb.pf.k, X.ptr))
@ -89,16 +93,16 @@ typedef GSIMapNode_t *GSIMapNode;
: pointerFunctionsEqual(&M->cb.pf.k, X.ptr, Y.ptr))
#define GSI_MAP_RELEASE_KEY(M, X)\
(M->legacy ? M->cb.old.k.release(M, X.ptr) \
: pointerFunctionsRelinquish(&M->cb.pf.k, &X.ptr))
: IS_WEAK_KEY(M) ? nil : pointerFunctionsRelinquish(&M->cb.pf.k, &X.ptr))
#define GSI_MAP_RETAIN_KEY(M, X)\
(M->legacy ? M->cb.old.k.retain(M, X.ptr) \
: pointerFunctionsAcquire(&M->cb.pf.k, &X.ptr, X.ptr))
: IS_WEAK_KEY(M) ? nil : pointerFunctionsAcquire(&M->cb.pf.k, &X.ptr, X.ptr))
#define GSI_MAP_RELEASE_VAL(M, X)\
(M->legacy ? M->cb.old.v.release(M, X.ptr) \
: pointerFunctionsRelinquish(&M->cb.pf.v, &X.ptr))
: IS_WEAK_VALUE(M) ? nil : pointerFunctionsRelinquish(&M->cb.pf.v, &X.ptr))
#define GSI_MAP_RETAIN_VAL(M, X)\
(M->legacy ? M->cb.old.v.retain(M, X.ptr) \
: pointerFunctionsAcquire(&M->cb.pf.v, &X.ptr, X.ptr))
: IS_WEAK_VALUE(M) ? nil : pointerFunctionsAcquire(&M->cb.pf.v, &X.ptr, X.ptr))
/* 2013-05-25 Here are the macros originally added for GC/ARC ...
* but they caused map table entries to be doubly retained :-(
@ -120,12 +124,12 @@ typedef GSIMapNode_t *GSIMapNode;
if (M->legacy) \
*(addr) = x;\
else\
*(id*)(addr) = (x).obj;
(IS_WEAK_KEY(M) ? pointerFunctionsAssign(&M->cb.pf.k, (void**)addr, (x).obj) : (*(id*)(addr) = (x).obj));
#define GSI_MAP_WRITE_VAL(M, addr, x) \
if (M->legacy) \
*(addr) = x;\
else\
*(id*)(addr) = (x).obj;
(IS_WEAK_VALUE(M) ? pointerFunctionsAssign(&M->cb.pf.v, (void**)addr, (x).obj) : (*(id*)(addr) = (x).obj));
#define GSI_MAP_READ_KEY(M,addr) \
(M->legacy ? *(addr)\
: (typeof(*addr))pointerFunctionsRead(&M->cb.pf.k, (void**)addr))
@ -134,8 +138,7 @@ typedef GSIMapNode_t *GSIMapNode;
: (typeof(*addr))pointerFunctionsRead(&M->cb.pf.v, (void**)addr))
#define GSI_MAP_ZEROED(M)\
(M->legacy ? 0\
: (((M->cb.pf.k.options | M->cb.pf.v.options)\
& NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
: (IS_WEAK_KEY(M) || IS_WEAK_VALUE(M)) ? YES : NO)
#define GSI_MAP_ENUMERATOR NSMapEnumerator
@ -879,23 +882,17 @@ NSNextMapEnumeratorPair(NSMapEnumerator *enumerator,
}
else
{
if (key != 0)
NSConcreteMapTable *map = enumerator->map;
GSIMapKey k = GSI_MAP_READ_KEY(map, &n->key);
GSIMapVal v = GSI_MAP_READ_VALUE(map, &n->value);
if (k.ptr == NULL || v.ptr == NULL)
{
*key = n->key.ptr;
}
else
{
NSWarnFLog(@"Null key return address");
return NSNextMapEnumeratorPair(enumerator, key, value);
}
if (value != 0)
{
*value = n->value.ptr;
}
else
{
NSWarnFLog(@"Null value return address");
}
*key = k.ptr;
*value = v.ptr;
return YES;
}
}
@ -1332,7 +1329,7 @@ const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
if (node)
{
return node->value.obj;
return GSI_MAP_READ_VALUE(self, &node->value).obj;
}
}
return nil;
@ -1384,7 +1381,7 @@ const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
node = GSIMapNodeForKey(self, (GSIMapKey)aKey);
if (node)
{
if (node->value.obj != anObject)
if (GSI_MAP_READ_VALUE(self, &node->value).obj != anObject)
{
GSI_MAP_RELEASE_VAL(self, node->value);
node->value.obj = anObject;

View file

@ -0,0 +1,510 @@
/* Implementation of class NSDateComponentsFormatter
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Wed Nov 6 00:24:02 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSDateComponentsFormatter.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSString.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSException.h>
#include <Foundation/NSNumberFormatter.h>
@implementation NSDateComponentsFormatter
- (instancetype) init
{
self = [super init];
if(self != nil)
{
_calendar = nil;
_referenceDate = nil;
_allowsFractionalUnits = NO;
_collapsesLargestUnit = NO;
_includesApproximationPhrase = NO;
_formattingContext = NSFormattingContextUnknown;
_maximumUnitCount = 0;
_zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorDefault;
_allowedUnits = NSCalendarUnitYear |
NSCalendarUnitMonth |
NSCalendarUnitDay |
NSCalendarUnitHour |
NSCalendarUnitMinute |
NSCalendarUnitSecond;
_unitsStyle = NSDateComponentsFormatterUnitsStylePositional;
}
return self;
}
- (instancetype) initWithCoder: (NSCoder *)coder
{
self = [super initWithCoder: coder];
if(self != nil)
{
// TODO: Implement coding...
}
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
[super encodeWithCoder: coder];
// TODO: Implement coding...
}
- (void) dealloc
{
RELEASE(_calendar);
RELEASE(_referenceDate);
[super dealloc];
}
- (NSString *) stringForObjectValue: (id)obj
{
NSString *result = nil;
if([obj isKindOfClass: [NSDateComponents class]])
{
result = [self stringFromDateComponents: obj];
}
else if([obj isKindOfClass: [NSNumber class]])
{
NSTimeInterval ti = [obj longLongValue];
result = [self stringFromTimeInterval: ti];
}
return result;
}
- (NSString *) stringFromDateComponents: (NSDateComponents *)components
{
NSString *result = @"";
if(_allowedUnits | NSCalendarUnitYear)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components year]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" years"];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%4ld", [components year]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" yr "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" yr "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" yr "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" years "];
}
}
}
if(_allowedUnits | NSCalendarUnitMonth)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components month]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" months "];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%2ld", [components month]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" mn "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" mon "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" months "];
}
}
}
if(_allowedUnits | NSCalendarUnitDay)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components day]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" days "];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%2ld", [components day]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" d "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" day "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" days "];
}
}
}
if(_allowedUnits | NSCalendarUnitHour)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components hour]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" hours "];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%2ld", [components hour]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" h "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" hrs "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" hours "];
}
}
}
if(_allowedUnits | NSCalendarUnitMinute)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components minute]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" minutes "];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%2ld", [components minute]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" min "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" mins "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" minutes "];
}
}
}
if(_allowedUnits | NSCalendarUnitSecond)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components second]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" seconds "];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%2ld", [components second]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" s "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" secs "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" seconds "];
}
}
}
if(_allowedUnits | NSCalendarUnitWeekOfMonth)
{
if(_unitsStyle == NSDateComponentsFormatterUnitsStyleSpellOut)
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
NSNumber *num = [NSNumber numberWithInteger: [components weekOfMonth]];
AUTORELEASE(fmt);
[fmt setNumberStyle: NSNumberFormatterSpellOutStyle];
result = [result stringByAppendingString: [fmt stringFromNumber: num]];
result = [result stringByAppendingString: @" days "];
}
else
{
if(_zeroFormattingBehavior | NSDateComponentsFormatterZeroFormattingBehaviorDefault)
{
NSString *s = [NSString stringWithFormat: @"%2ld", [components weekOfMonth]];
result = [result stringByAppendingString: s];
}
if(_unitsStyle == NSDateComponentsFormatterUnitsStylePositional)
{
result = [result stringByAppendingString: @" "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleAbbreviated)
{
result = [result stringByAppendingString: @" wm "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleShort)
{
result = [result stringByAppendingString: @" wom "];
}
else if(_unitsStyle == NSDateComponentsFormatterUnitsStyleFull)
{
result = [result stringByAppendingString: @" week of month "];
}
}
}
return result;
}
- (NSString *) stringFromDate: (NSDate *)startDate
toDate: (NSDate *)endDate
{
NSDateComponents *dc = nil;
NSCalendar *calendar = ( _calendar != nil ) ? _calendar : [NSCalendar currentCalendar];
dc = [calendar components: _allowedUnits
fromDate: startDate
toDate: endDate
options: NSCalendarMatchStrictly];
return [self stringFromDateComponents: dc];
}
- (NSString *) stringFromTimeInterval: (NSTimeInterval)ti
{
NSDate *startDate = [NSDate date];
NSDate *endDate = [startDate dateByAddingTimeInterval: (ti > 0) ? ti : -ti];
return [self stringFromDate: startDate toDate: endDate];
}
- (NSDateComponentsFormatterUnitsStyle) unitsStyle
{
return _unitsStyle;
}
- (void) setUnitsStyle: (NSDateComponentsFormatterUnitsStyle)style
{
_unitsStyle = style;
}
- (NSCalendarUnit) allowedUnits
{
return _allowedUnits;
}
- (void) setAllowedUnits: (NSCalendarUnit)units
{
if(units | NSCalendarUnitYear &&
units | NSCalendarUnitMonth &&
units | NSCalendarUnitDay &&
units | NSCalendarUnitHour &&
units | NSCalendarUnitMinute &&
units | NSCalendarUnitSecond &&
units | NSCalendarUnitWeekOfMonth)
{
[NSException raise: NSInvalidArgumentException
format: @"Passed invalid unit into allowedUnits"];
}
_allowedUnits = units;
}
- (NSDateComponentsFormatterZeroFormattingBehavior) zeroFormattingBehavior
{
return _zeroFormattingBehavior;
}
- (void) setZeroFormattingBehavior: (NSDateComponentsFormatterZeroFormattingBehavior)behavior;
{
_zeroFormattingBehavior = behavior;
}
- (NSCalendar *) calendar
{
return _calendar;
}
- (void) setCalender: (NSCalendar *)calendar
{
ASSIGNCOPY(_calendar, calendar);
}
- (NSDate *) referenceDate
{
return _referenceDate;
}
- (void) setReferenceDate: (NSDate *)referenceDate
{
ASSIGNCOPY(_referenceDate, referenceDate);
}
- (BOOL) allowsFractionalUnits
{
return _allowsFractionalUnits;
}
- (void) setAllowsFractionalUnits: (BOOL)allowsFractionalUnits
{
_allowsFractionalUnits = allowsFractionalUnits;
}
- (NSInteger) maximumUnitCount
{
return _maximumUnitCount;
}
- (void) setMaximumUnitCount: (NSInteger)maximumUnitCount
{
_maximumUnitCount = maximumUnitCount;
}
- (BOOL) collapsesLargestUnit
{
return _collapsesLargestUnit;
}
- (void) setCollapsesLargestUnit: (BOOL)collapsesLargestUnit
{
_collapsesLargestUnit = collapsesLargestUnit;
}
- (BOOL) includesApproximationPhrase
{
return _includesApproximationPhrase;
}
- (void) setIncludesApproximationPhrase: (BOOL)includesApproximationPhrase
{
_includesApproximationPhrase = includesApproximationPhrase;
}
- (NSFormattingContext) formattingContext
{
return _formattingContext;
}
- (void) setFormattingContext: (NSFormattingContext)formattingContext
{
_formattingContext = formattingContext;
}
- (BOOL) getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error
{
return NO;
}
+ (NSString *) localizedStringFromDateComponents: (NSDateComponents *)components
unitsStyle: (NSDateComponentsFormatterUnitsStyle)unitsStyle
{
NSDateComponentsFormatter *fmt = [[NSDateComponentsFormatter alloc] init];
[fmt setUnitsStyle: unitsStyle];
AUTORELEASE(fmt);
return [fmt stringFromDateComponents: components];
}
@end

View file

@ -565,6 +565,37 @@ GSListModules()
#endif /* USE_BFD */
#if defined(HAVE_UNWIND_H) && !defined(HAVE_BACKTRACE)
#include <unwind.h>
#if !defined(_WIN32)
#include <dlfcn.h>
#endif
struct GSBacktraceState
{
void **current;
void **end;
};
static _Unwind_Reason_Code
GSUnwindCallback(struct _Unwind_Context* context, void* arg)
{
struct GSBacktraceState *state = (struct GSBacktraceState*)arg;
uintptr_t pc = _Unwind_GetIP(context);
if (pc) {
if (state->current == state->end) {
return _URC_END_OF_STACK;
} else {
*state->current++ = (void*)pc;
}
}
return 0; //_URC_OK/_URC_NO_REASON
}
#endif /* HAVE_UNWIND_H && !HAVE_BACKTRACE */
#if defined(_WIN32) && !defined(USE_BFD)
typedef USHORT (WINAPI *CaptureStackBackTraceType)(ULONG,ULONG,PVOID*,PULONG);
typedef BOOL (WINAPI *SymInitializeType)(HANDLE,char*,BOOL);
@ -846,7 +877,7 @@ unsigned
GSPrivateReturnAddresses(NSUInteger **returns)
{
unsigned numReturns;
#if HAVE_BACKTRACE
#if defined(HAVE_BACKTRACE)
void *addr[MAXFRAMES*sizeof(void*)];
numReturns = backtrace(addr, MAXFRAMES);
@ -855,6 +886,18 @@ GSPrivateReturnAddresses(NSUInteger **returns)
*returns = malloc(numReturns * sizeof(void*));
memcpy(*returns, addr, numReturns * sizeof(void*));
}
#elif defined(HAVE_UNWIND_H)
void *addr[MAXFRAMES];
struct GSBacktraceState state = {addr, addr + MAXFRAMES};
_Unwind_Backtrace(GSUnwindCallback, &state);
numReturns = state.current - addr;
if (numReturns > 0)
{
*returns = malloc(numReturns * sizeof(void*));
memcpy(*returns, addr, numReturns * sizeof(void*));
}
#elif defined(_WIN32) && !defined(USE_BFD)
NSUInteger addr[MAXFRAMES];
@ -1225,6 +1268,36 @@ GSPrivateReturnAddresses(NSUInteger **returns)
}
symbols = [[NSArray alloc] initWithObjects: symbolArray count: count];
free(strs);
#elif defined(HAVE_UNWIND_H)
void **ptrs = (void**)&returns[FrameOffset];
NSString **symbolArray;
symbolArray = alloca(count * sizeof(NSString*));
for (i = 0; i < count; i++)
{
const void *addr = ptrs[i];
Dl_info info;
if (dladdr(addr, &info)) {
const char *libname = "unknown";
if (info.dli_fname) {
// strip library path
char *delim = strrchr(info.dli_fname, '/');
libname = delim ? delim + 1 : info.dli_fname;
}
if (info.dli_sname) {
symbolArray[i] = [NSString stringWithFormat:
@"%lu: %p %s %s + %d", (unsigned long)i, addr, libname,
info.dli_sname, (int)(addr - info.dli_saddr)];
} else {
symbolArray[i] = [NSString stringWithFormat:
@"%lu: %p %s unknown", (unsigned long)i, addr, libname];
}
} else {
symbolArray[i] = [NSString stringWithFormat:
@"%lu: %p unknown", (unsigned long)i, addr];
}
}
symbols = [[NSArray alloc] initWithObjects: symbolArray count: count];
#else
NSMutableArray *a;
@ -1233,8 +1306,8 @@ GSPrivateReturnAddresses(NSUInteger **returns)
{
NSString *s;
s = [[NSString alloc] initWithFormat: @"%@: symbol not available",
[a objectAtIndex: i]];
s = [[NSString alloc] initWithFormat: @"%p: symbol not available",
[[a objectAtIndex: i] pointerValue]];
[a replaceObjectAtIndex: i withObject: s];
RELEASE(s);
}

View file

@ -0,0 +1,66 @@
/* Implementation of class NSExtensionContext
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sun Nov 10 03:59:38 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSExtensionContext.h>
#include <Foundation/NSError.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSURL.h>
#include <Foundation/NSString.h>
@implementation NSExtensionContext
- (void) setInputItems: (NSArray *)inputItems
{
ASSIGNCOPY(_inputItems, inputItems);
}
- (NSArray *) inputItems
{
return _inputItems;
}
- (void)completeRequestReturningItems: (NSArray *)items completionHandler: (GSExtensionContextReturningItemsCompletionHandler)completionHandler
{
}
- (void)cancelRequestWithError:(NSError *)error
{
}
- (void)openURL: (NSURL *)URL completionHandler: (GSOpenURLCompletionHandler)completionHandler
{
}
@end
NSString* const NSExtensionItemsAndErrorsKey = @"NSExtensionItemsAndErrorsKey";
NSString* const NSExtensionHostWillEnterForegroundNotification = @"NSExtensionHostWillEnterForegroundNotification";
NSString* const NSExtensionHostDidEnterBackgroundNotification = @"NSExtensionHostDidEnterBackgroundNotification";
NSString* const NSExtensionHostWillResignActiveNotification = @"NSExtensionHostWillResignActiveNotification";
NSString* const NSExtensionHostDidBecomeActiveNotification = @"NSExtensionHostDidBecomeActiveNotification";

81
Source/NSExtensionItem.m Normal file
View file

@ -0,0 +1,81 @@
/* Implementation of class NSExtensionItem
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sun Nov 10 03:59:46 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSExtensionItem.h>
#include <Foundation/NSAttributedString.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSArray.h>
@implementation NSExtensionItem
- (NSAttributedString *) attributedTitle
{
return _attributedTitle;
}
- (void) setAttributedTitle: (NSAttributedString *)string
{
ASSIGNCOPY(_attributedTitle, string);
}
- (NSAttributedString *) attributedContentText
{
return _attributedContentText;
}
- (void) setAttributedContentText: (NSAttributedString *)string
{
ASSIGNCOPY(_attributedContentText, string);
}
- (NSArray *) attachments
{
return _attachments;
}
- (void) setAttachments: (NSArray *)attachments
{
ASSIGNCOPY(_attachments, attachments);
}
- (NSDictionary *) userInfo
{
return _userInfo;
}
- (void) setUserInfo: (NSDictionary *) userInfo
{
ASSIGNCOPY(_userInfo, userInfo);
}
@end
NSString * const NSExtensionItemAttributedTitleKey = @"NSExtensionItemAttributedTitleKey";
NSString * const NSExtensionItemAttributedContentTextKey = @"NSExtensionItemAttributedContentTextKey";
NSString * const NSExtensionItemAttachmentsKey = @"NSExtensionItemAttachmentsKey";

175
Source/NSItemProvider.m Normal file
View file

@ -0,0 +1,175 @@
/* Implementation of class NSItemProvider
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sun Nov 10 04:00:17 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSItemProvider.h>
#include <Foundation/NSString.h>
@implementation NSItemProvider
- (instancetype) init
{
return nil;
}
- (void) registerDataRepresentationForTypeIdentifier: (NSString *)typeIdentifier
visibility: (NSItemProviderRepresentationVisibility)visibility
loadHandler: (GSProgressHandler)loadHandler
{
}
- (void) registerFileRepresentationForTypeIdentifier: (NSString *)typeIdentifier
fileOptions: (NSItemProviderFileOptions)fileOptions
visibility: (NSItemProviderRepresentationVisibility)visibility
loadHandler: (GSProgressURLBOOLHandler)loadHandler
{
}
- (NSArray *) registeredTypeIdentifiers
{
return nil;
}
- (NSArray *) registeredTypeIdentifiersWithFileOptions: (NSItemProviderFileOptions)fileOptions
{
return nil;
}
- (BOOL) hasItemConformingToTypeIdentifier: (NSString *)typeIdentifier
{
return NO;
}
- (BOOL) hasRepresentationConformingToTypeIdentifier: (NSString *)typeIdentifier
fileOptions: (NSItemProviderFileOptions)fileOptions
{
return NO;
}
- (NSProgress *) loadDataRepresentationForTypeIdentifier: (NSString *)typeIdentifier
completionHandler: (GSProviderCompletionHandler)completionHandler
{
return nil;
}
- (NSProgress *) loadFileRepresentationForTypeIdentifier: (NSString *)typeIdentifier
completionHandler: (GSProviderURLCompletionHandler)completionHandler
{
return nil;
}
- (NSProgress *) loadInPlaceFileRepresentationForTypeIdentifier: (NSString *)typeIdentifier
completionHandler: (GSProviderURLBOOLCompletionHandler)completionHandler
{
return nil;
}
- (NSString *) suggestedName
{
return nil;
}
- (void) setSuggestedName: (NSString *)suggestedName
{
}
- (instancetype) initWithObject: (id<NSItemProviderWriting>)object
{
return nil;
}
- (void) registerObject: (id<NSItemProviderWriting>)object visibility: (NSItemProviderRepresentationVisibility)visibility
{
}
- (void) registerObjectOfClass: (Class<NSItemProviderWriting>)aClass // NSItemProviderWriting conforming class...
visibility: (NSItemProviderRepresentationVisibility)visibility
loadHandler: (GSItemProviderWritingHandler)loadHandler
{
}
- (BOOL) canLoadObjectOfClass: (Class<NSItemProviderReading>)aClass
{
return NO;
}
- (NSProgress *) loadObjectOfClass: (Class<NSItemProviderReading>)aClass // NSItemProviderReading conforming class...
completionHandler: (GSItemProviderReadingHandler)completionHandler
{
return nil;
}
- (instancetype) initWithItem: (id<NSSecureCoding>)item typeIdentifier: (NSString *)typeIdentifier // designated init
{
return nil;
}
- (instancetype) initWithContentsOfURL: (NSURL *)fileURL
{
return nil;
}
- (void) registerItemForTypeIdentifier: (NSString *)typeIdentifier loadHandler: (NSItemProviderLoadHandler)loadHandler
{
}
- (void)loadItemForTypeIdentifier: (NSString *)typeIdentifier
options: (NSDictionary *)options
completionHandler: (NSItemProviderCompletionHandler)completionHandler
{
}
- (instancetype) copyWithZone: (NSZone*)zone
{
return nil;
}
@end
// Preview support
NSString * const NSItemProviderPreferredImageSizeKey = @"NSItemProviderPreferredImageSizeKey";
@implementation NSItemProvider (NSPreviewSupport)
- (NSItemProviderLoadHandler) previewImageHandler
{
return nil;
}
- (void) setPreviewImageHandler: (NSItemProviderLoadHandler) previewImageHandler
{
}
- (void) loadPreviewImageWithOptions: (NSDictionary *)options
completionHandler: (NSItemProviderCompletionHandler)completionHandler
{
}
@end
NSString * const NSExtensionJavaScriptPreprocessingResultsKey = @"NSExtensionJavaScriptPreprocessingResultsKey";
NSString * const NSExtensionJavaScriptFinalizeArgumentKey = @"NSExtensionJavaScriptFinalizeArgumentKey";
NSString * const NSItemProviderErrorDomain = @"NSItemProviderErrorDomain" ;

View file

@ -0,0 +1,30 @@
/* Implementation of class NSItemProviderReadingWriting
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sun Nov 10 04:00:24 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSItemProviderReadingWriting.h>
@implementation NSItemProviderReadingWriting
@end

257
Source/NSLinguisticTagger.m Normal file
View file

@ -0,0 +1,257 @@
/* Implementation of class NSLinguisticTagger
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Sat Nov 2 21:37:50 EDT 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSLinguisticTagger.h>
#include <Foundation/NSRange.h>
#include <Foundation/NSString.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSOrthography.h>
NSLinguisticTagScheme const NSLinguisticTagSchemeTokenType = @"NSLinguisticTagSchemeTokenType";
NSLinguisticTagScheme const NSLinguisticTagSchemeLexicalClass = @"NSLinguisticTagSchemeLexicalClass";
NSLinguisticTagScheme const NSLinguisticTagSchemeNameType = @"NSLinguisticTagSchemeNameType";
NSLinguisticTagScheme const NSLinguisticTagSchemeNameTypeOrLexicalClass = @"NSLinguisticTagSchemeNameTypeOrLexicalClass";
NSLinguisticTagScheme const NSLinguisticTagSchemeLemma = @"NSLinguisticTagSchemeLemma";
NSLinguisticTagScheme const NSLinguisticTagSchemeLanguage = @"NSLinguisticTagSchemeLanguage";
NSLinguisticTagScheme const NSLinguisticTagSchemeScript = @"NSLinguisticTagSchemeScript";
/* Tags for NSLinguisticTagSchemeTokenType */
NSLinguisticTag const NSLinguisticTagWord = @"NSLinguisticTagWord";
NSLinguisticTag const NSLinguisticTagPunctuation = @"NSLinguisticTagPunctuation";
NSLinguisticTag const NSLinguisticTagWhitespace = @"NSLinguisticTagWhitespae";
NSLinguisticTag const NSLinguisticTagOther = @"NSLinguisticTagOther";
/* Tags for NSLinguisticTagSchemeLexicalClass */
NSLinguisticTag const NSLinguisticTagNoun = @"NSLinguisticTagNoun";
NSLinguisticTag const NSLinguisticTagVerb = @"NSLinguisticTagVerb";
NSLinguisticTag const NSLinguisticTagAdjective = @"NSLinguisticTagAdjective";
NSLinguisticTag const NSLinguisticTagAdverb = @"NSLinguisticTagAdverb";
NSLinguisticTag const NSLinguisticTagPronoun = @"NSLinguisticTagPronoun";
NSLinguisticTag const NSLinguisticTagDeterminer = @"NSLinguisticTagDeterminer";
NSLinguisticTag const NSLinguisticTagParticle = @"NSLinguisticTagParticle";
NSLinguisticTag const NSLinguisticTagPreposition = @"NSLinguisticTagPrepostion";
NSLinguisticTag const NSLinguisticTagNumber = @"NSLinguisticTagNumber";
NSLinguisticTag const NSLinguisticTagConjunction = @"NSLinguisticTagConjunction";
NSLinguisticTag const NSLinguisticTagInterjection = @"NSLinguisticTagInterjection";
NSLinguisticTag const NSLinguisticTagClassifier = @"NSLinguisticTagClassifier";
NSLinguisticTag const NSLinguisticTagIdiom = @"NSLinguisticTagIdiom";
NSLinguisticTag const NSLinguisticTagOtherWord = @"NSLinguisticTagOtherWord";
NSLinguisticTag const NSLinguisticTagSentenceTerminator = @"NSLinguisticTagSentenceTerminator";
NSLinguisticTag const NSLinguisticTagOpenQuote = @"NSLinguisticTagOpenQuote";
NSLinguisticTag const NSLinguisticTagCloseQuote = @"NSLinguisticTagCloseQuote";
NSLinguisticTag const NSLinguisticTagOpenParenthesis = @"NSLinguisticTagOpenParenthesis";
NSLinguisticTag const NSLinguisticTagCloseParenthesis = @"NSLinguisticTagCloseParenthesis";
NSLinguisticTag const NSLinguisticTagWordJoiner = @"NSLinguisticTagWordJoiner";
NSLinguisticTag const NSLinguisticTagDash = @"NSLinguisticTagDash";
NSLinguisticTag const NSLinguisticTagOtherPunctuation = @"NSLinguisticTagOtherPunctuation";
NSLinguisticTag const NSLinguisticTagParagraphBreak = @"NSLinguisticTagParagraphBreak";
NSLinguisticTag const NSLinguisticTagOtherWhitespace = @"NSLinguisticTagOtherWhitespace";
/* Tags for NSLinguisticTagSchemeNameType */
NSLinguisticTag const NSLinguisticTagPersonalName = @"NSLinguisticTagPersonalName";
NSLinguisticTag const NSLinguisticTagPlaceName = @"NSLinguisticTagPlaceName";
NSLinguisticTag const NSLinguisticTagOrganizationName = @"NSLinguisticTagOrganizationName";
@implementation NSLinguisticTagger
- (instancetype) initWithTagSchemes: (NSArray *)tagSchemes
options: (NSUInteger)opts
{
self = [super init];
if(self != nil)
{
ASSIGNCOPY(_schemes, tagSchemes);
_options = opts;
_string = nil;
_dominantLanguage = nil;
_tokenArray = nil;
_orthographyArray = nil;
}
return self;
}
- (void) dealloc
{
RELEASE(_schemes);
RELEASE(_string);
RELEASE(_dominantLanguage);
RELEASE(_tokenArray);
RELEASE(_orthographyArray);
[super dealloc];
}
- (NSArray *) tagSchemes
{
return _schemes;
}
- (NSString *) string
{
return _string;
}
- (void) setString: (NSString *)string
{
ASSIGNCOPY(_string, string);
}
+ (NSArray *) availableTagSchemesForUnit: (NSLinguisticTaggerUnit)unit
language: (NSString *)language
{
return nil;
}
+ (NSArray *) availableTagSchemesForLanguage: (NSString *)language
{
return nil;
}
- (void) setOrthography: (NSOrthography *)orthography
range: (NSRange)range
{
}
- (NSOrthography *) orthographyAtIndex: (NSUInteger)charIndex
effectiveRange: (NSRangePointer)effectiveRange
{
return nil;
}
- (void) stringEditedInRange: (NSRange)newRange
changeInLength: (NSInteger)delta
{
}
- (NSRange) tokenRangeAtIndex: (NSUInteger)charIndex
unit: (NSLinguisticTaggerUnit)unit
{
return NSMakeRange(0,0);
}
- (NSRange) sentenceRangeForRange: (NSRange)range
{
return NSMakeRange(0,0);
}
- (void) enumerateTagsInRange: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
usingBlock: (GSLinguisticTagRangeBoolBlock)block
{
}
- (NSLinguisticTag) tagAtIndex: (NSUInteger)charIndex
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
tokenRange: (NSRangePointer)tokenRange
{
return nil;
}
- (NSArray *) tagsInRange: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
tokenRanges: (NSArray **)tokenRanges
{
return nil;
}
- (void) enumerateTagsInRange: (NSRange)range
scheme: (NSLinguisticTagScheme)tagScheme
options: (NSLinguisticTaggerOptions)opts
usingBlock: (GSLinguisticTagRangeRangeBoolBlock)block
{
}
- (NSLinguisticTag) tagAtIndex: (NSUInteger)charIndex
scheme: (NSLinguisticTagScheme)scheme
tokenRange: (NSRangePointer)tokenRange
sentenceRange: (NSRangePointer)sentenceRange
{
return nil;
}
- (NSArray *) tagsInRange: (NSRange)range
scheme: (NSString *)tagScheme
options: (NSLinguisticTaggerOptions)opts
tokenRanges: (NSArray **)tokenRanges
{
return nil;
}
- (NSString *) dominantLanguage
{
return nil;
}
+ (NSString *) dominantLanguageForString: (NSString *)string
{
return nil;
}
+ (NSLinguisticTag) tagForString: (NSString *)string
atIndex: (NSUInteger)charIndex
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
orthography: (NSOrthography *)orthography
tokenRange: (NSRangePointer)tokenRange
{
return nil;
}
+ (NSArray *)tagsForString: (NSString *)string
range: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
orthography: (NSOrthography *)orthography
tokenRanges: (NSArray **)tokenRanges
{
return nil;
}
+ (void) enumerateTagsForString: (NSString *)string
range: (NSRange)range
unit: (NSLinguisticTaggerUnit)unit
scheme: (NSLinguisticTagScheme)scheme
options: (NSLinguisticTaggerOptions)options
orthography: (NSOrthography *)orthography
usingBlock: (GSLinguisticTagRangeBoolBlock)block
{
}
- (NSArray *) possibleTagsAtIndex: (NSUInteger)charIndex
scheme: (NSString *)tagScheme
tokenRange: (NSRangePointer)tokenRange
sentenceRange: (NSRangePointer)sentenceRange
scores: (NSArray **)scores
{
return nil;
}
@end

112
Source/NSOrthography.m Normal file
View file

@ -0,0 +1,112 @@
/* Implementation of class NSOrthography
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory John Casamento <greg.casamento@gmail.com>
Date: Tue Nov 5 03:43:39 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSOrthography.h>
@implementation NSOrthography
- (instancetype) initWithDominantScript: (NSString *)script
languageMap: (NSDictionary *)map
{
self = [super init];
if(self != nil)
{
ASSIGNCOPY(_dominantScript, script);
ASSIGNCOPY(_languageMap, map);
}
return self;
}
- (oneway void) release
{
RELEASE(_dominantScript);
RELEASE(_languageMap);
[super release];
}
- (NSString *) dominantScript
{
return _dominantScript;
}
- (NSDictionary *) languationMap
{
return _languageMap;
}
- (NSArray *) languagesForScript: (NSString *)script
{
return nil;
}
- (NSString *) dominantLanguageForScript: (NSString *)script
{
return nil;
}
- (NSString *) dominantLanguage
{
return nil;
}
- (NSArray *) allScripts
{
return nil;
}
- (NSArray *) allLanguages
{
return nil;
}
+ (instancetype) defaultOrthographyForLanguage: (NSString *)language
{
return nil;
}
+ (instancetype) orthographyWithDominantScript: (NSString *)script languageMap: (NSDictionary *)map
{
NSOrthography *result = [[NSOrthography alloc] initWithDominantScript: script
languageMap: map];
AUTORELEASE(result);
return result;
}
- (instancetype) initWithCoder: (NSCoder *)coder
{
return nil;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
}
- (instancetype) copyWithZone: (NSZone *)zone
{
return [[[self class] allocWithZone: zone]
initWithDominantScript: _dominantScript
languageMap: _languageMap];
}
@end

View file

@ -1950,9 +1950,7 @@ NSTemporaryDirectory(void)
int perm;
int owner;
BOOL flag;
#if !defined(_WIN32)
int uid;
#else
#if defined(_WIN32)
unichar buffer[1024];
if (GetTempPathW(1024, buffer))
@ -1960,6 +1958,20 @@ NSTemporaryDirectory(void)
baseTempDirName = [NSString stringWithCharacters: buffer
length: wcslen(buffer)];
}
#elif defined(__ANDROID__)
/*
* Use subfolder of cache directory as temp dir on Android, as there
* is no official temp dir prior to API level 26, and the cache dir
* is at least auto-purged by the system if disk space is needed.
* We also clean it up on launch in GSInitializeProcessAndroid().
*/
NSString *cacheDir = [[NSProcessInfo processInfo] androidCacheDir];
if (cacheDir)
{
baseTempDirName = [cacheDir stringByAppendingPathComponent: @"tmp"];
}
#else
int uid;
#endif
/*
@ -2004,10 +2016,31 @@ NSTemporaryDirectory(void)
if ([manager fileExistsAtPath: tempDirName isDirectory: &flag] == NO
|| flag == NO)
{
#ifdef __ANDROID__
/*
* Create our own temp dir on Android. We can disregard attributes
* since they are not supported.
*/
if ([manager createDirectoryAtPath: tempDirName
withIntermediateDirectories: YES
attributes: nil
error: NULL] == NO)
{
NSWarnFLog(@"Attempt to create temporary directory (%@)"
@" failed.", tempDirName);
return nil;
}
#else
NSWarnFLog(@"Temporary directory (%@) does not exist", tempDirName);
return nil;
#endif
}
// Mateu Batle: secure temporary directories don't work in MinGW
// Ivan Vucica: there are also problems with Cygwin
// probable cause: http://stackoverflow.com/q/9561759/39974
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__ANDROID__)
/*
* Check that we are the directory owner, and that we, and nobody else,
* have access to it. If other people have access, try to create a secure
@ -2018,20 +2051,11 @@ NSTemporaryDirectory(void)
perm = [[attr objectForKey: NSFilePosixPermissions] intValue];
perm = perm & 0777;
// Mateu Batle: secure temporary directories don't work in MinGW
// Ivan Vucica: there are also problems with Cygwin
// probable cause: http://stackoverflow.com/q/9561759/39974
#if !defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32)
uid = owner;
#else
#ifdef HAVE_GETEUID
uid = geteuid();
#else
uid = getuid();
#endif /* HAVE_GETEUID */
#endif
if ((perm != 0700 && perm != 0600) || owner != uid)
{
NSString *secure;
@ -2472,12 +2496,17 @@ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\GNUstep",
case NSCachesDirectory:
{
#ifdef __ANDROID__
/* Use system-provided cache directory on Android */
ADD_PATH(NSUserDomainMask, [[NSProcessInfo processInfo] androidCacheDir], @"");
#else
/* Uff - at the moment the only place to put Caches seems to
* be Library. Unfortunately under GNU/Linux Library will
* end up in /usr/lib/GNUstep which could be mounted
* read-only!
*/
ADD_PATH(NSUserDomainMask, gnustepUserLibrary, @"Caches");
#endif
ADD_PATH(NSLocalDomainMask, gnustepLocalLibrary, @"Caches");
ADD_PATH(NSNetworkDomainMask, gnustepNetworkLibrary, @"Caches");
ADD_PATH(NSSystemDomainMask, gnustepSystemLibrary, @"Caches");

View file

@ -234,6 +234,7 @@ static NSMutableSet *mySet = nil;
#ifdef __ANDROID__
static jobject _androidContext = NULL;
static NSString *_androidFilesDir = nil;
static NSString *_androidCacheDir = nil;
#endif
/*************************************************************************
@ -1607,21 +1608,36 @@ GSInitializeProcessAndroid(JNIEnv *env, jobject context)
free(arg0);
// get File class and path method
jclass fileCls = (*env)->FindClass(env, "java/io/File");
jmethodID getAbsolutePathMethod = (*env)->GetMethodID(env, fileCls, "getAbsolutePath", "()Ljava/lang/String;");
// get Android files dir
jmethodID filesDirMethod = (*env)->GetMethodID(env, cls, "getFilesDir", "()Ljava/io/File;");
jobject filesDirObj = (*env)->CallObjectMethod(env, context, filesDirMethod);
jclass filesDirCls = (*env)->GetObjectClass(env, filesDirObj);
jmethodID getStoragePath = (*env)->GetMethodID(env, filesDirCls, "getAbsolutePath", "()Ljava/lang/String;");
jstring filesDirJava = (*env)->CallObjectMethod(env, filesDirObj, getStoragePath);
const jchar *unichars = (*env)->GetStringChars(env, filesDirJava, NULL);
jsize length = (*env)->GetStringLength(env, filesDirJava);
_androidFilesDir = [NSString stringWithCharacters:unichars length:length];
(*env)->ReleaseStringChars(env, filesDirJava, unichars);
jstring filesDirJava = (*env)->CallObjectMethod(env, filesDirObj, getAbsolutePathMethod);
const jchar *filesDirUnichars = (*env)->GetStringChars(env, filesDirJava, NULL);
jsize filesDirLength = (*env)->GetStringLength(env, filesDirJava);
_androidFilesDir = [NSString stringWithCharacters:filesDirUnichars length:filesDirLength];
(*env)->ReleaseStringChars(env, filesDirJava, filesDirUnichars);
// get Android cache dir
jmethodID cacheDirMethod = (*env)->GetMethodID(env, cls, "getCacheDir", "()Ljava/io/File;");
jobject cacheDirObj = (*env)->CallObjectMethod(env, context, cacheDirMethod);
jstring cacheDirJava = (*env)->CallObjectMethod(env, cacheDirObj, getAbsolutePathMethod);
const jchar *cacheDirUnichars = (*env)->GetStringChars(env, cacheDirJava, NULL);
jsize cacheDirLength = (*env)->GetStringLength(env, cacheDirJava);
_androidCacheDir = [NSString stringWithCharacters:cacheDirUnichars length:cacheDirLength];
(*env)->ReleaseStringChars(env, cacheDirJava, cacheDirUnichars);
// get asset manager and initialize NSBundle
jmethodID assetManagerMethod = (*env)->GetMethodID(env, cls, "getAssets", "()Landroid/content/res/AssetManager;");
jstring assetManagerJava = (*env)->CallObjectMethod(env, context, assetManagerMethod);
[NSBundle setJavaAssetManager:assetManagerJava withJNIEnv:env];
// clean up our NSTemporaryDirectory() if it exists
NSString *tempDirName = [_androidCacheDir stringByAppendingPathComponent: @"tmp"];
[[NSFileManager defaultManager] removeItemAtPath:tempDirName error:NULL];
}
#endif
@ -1667,6 +1683,11 @@ GSInitializeProcessAndroid(JNIEnv *env, jobject context)
{
return _androidFilesDir;
}
- (NSString *) androidCacheDir
{
return _androidCacheDir;
}
#endif
@end

View file

@ -62,7 +62,7 @@
#include <math.h>
#include <time.h>
#if HAVE_LIBDISPATCH_RUNLOOP
#if GS_USE_LIBDISPATCH_RUNLOOP
# define RL_INTEGRATE_DISPATCH 1
# ifdef HAVE_DISPATCH_H
# include <dispatch.h>
@ -403,7 +403,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
#if HAVE_DISPATCH_GET_MAIN_QUEUE_HANDLE_NP
return (void*)(uintptr_t)dispatch_get_main_queue_handle_np();
#elif HAVE__DISPATCH_GET_MAIN_QUEUE_HANDLE_4CF
return (void*)_dispatch_get_main_queue_handle_4CF();
return (void*)(uintptr_t)_dispatch_get_main_queue_handle_4CF();
#else
#error libdispatch missing main queue handle function
#endif
@ -417,7 +417,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
#if HAVE_DISPATCH_MAIN_QUEUE_DRAIN_NP
dispatch_main_queue_drain_np();
#elif HAVE__DISPATCH_MAIN_QUEUE_CALLBACK_4CF
_dispatch_main_queue_callback_4CF(NULL)
_dispatch_main_queue_callback_4CF(NULL);
#else
#error libdispatch missing main queue callback function
#endif

245
Source/NSXPCConnection.m Normal file
View file

@ -0,0 +1,245 @@
/* Implementation of class NSXPCConnection
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Tue Nov 12 23:50:29 EST 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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 Lesser 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.
*/
#include <Foundation/NSXPCConnection.h>
@implementation NSXPCConnection
- (instancetype)initWithServiceName:(NSString *)serviceName
{
return nil;
}
- (NSString *) serviceName
{
return nil;
}
- (void) setServiceName: (NSString *)serviceName
{
}
- (instancetype)initWithMachServiceName:(NSString *)name options:(NSXPCConnectionOptions)options
{
return nil;
}
- (instancetype)initWithListenerEndpoint:(NSXPCListenerEndpoint *)endpoint
{
return nil;
}
- (NSXPCListenerEndpoint *) endpoint
{
return nil;
}
- (void) setEndpoint: (NSXPCListenerEndpoint *) endpoint
{
}
- (NSXPCInterface *) exportedInterface
{
return nil;
}
- (void) setExportInterface: (NSXPCInterface *)exportedInterface
{
}
- (NSXPCInterface *) remoteObjectInterface
{
return nil;
}
- (void) setRemoteObjectInterface: (NSXPCInterface *)remoteObjectInterface
{
}
- (id) remoteObjectProxy
{
return nil;
}
- (void) setRemoteObjectProxy: (id)remoteObjectProxy
{
}
- (id) remoteObjectProxyWithErrorHandler:(GSXPCProxyErrorHandler)handler
{
return nil;
}
- (id) synchronousRemoteObjectProxyWithErrorHandler:(GSXPCProxyErrorHandler)handler
{
return nil;
}
- (GSXPCInterruptionHandler) interruptionHandler
{
return NULL;
}
- (void) setInterruptionHandler: (GSXPCInterruptionHandler)handler
{
}
- (GSXPCInvalidationHandler) invalidationHandler
{
return NULL;
}
- (void) setInvalidationHandler: (GSXPCInvalidationHandler)handler
{
}
- (void) resume
{
}
- (void) suspend
{
}
- (void) invalidate
{
}
- (NSUInteger) auditSessionIdentifier
{
return 0;
}
- (NSUInteger) processIdentifier
{
return 0;
}
- (NSUInteger) effectiveUserIdentifier
{
return 0;
}
- (NSUInteger) effectiveGroupIdentifier
{
return 0;
}
@end
@implementation NSXPCListener
+ (NSXPCListener *) serviceListener
{
return nil;
}
+ (NSXPCListener *) anonymousListener
{
return nil;
}
- (instancetype) initWithMachServiceName:(NSString *)name
{
return nil;
}
- (id <NSXPCListenerDelegate>) delegate
{
return nil;
}
- (void) setDelegate: (id <NSXPCListenerDelegate>) delegate
{
}
- (NSXPCListenerEndpoint *) endpoint
{
return nil;
}
- (void) setEndpoint: (NSXPCListenerEndpoint *)endpoint
{
}
- (void) resume
{
}
- (void) suspend
{
}
- (void) invalidate
{
}
@end
@implementation NSXPCInterface
+ (NSXPCInterface *) interfaceWithProtocol: (Protocol *)protocol
{
return nil;
}
- (Protocol *) protocol
{
return nil;
}
- (void) setProtocol: (Protocol *)protocol
{
}
- (void) setClasses: (NSSet *)classes forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply
{
}
- (NSSet *) classesForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply
{
return nil;
}
- (void) setInterface: (NSXPCInterface *)ifc forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply
{
}
- (NSXPCInterface *) interfaceForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply
{
return nil;
}
@end
@implementation NSXPCListenerEndpoint
- (instancetype) initWithCoder: (NSCoder *)coder
{
return nil;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
}
@end

View file

@ -4,10 +4,12 @@
#import <Foundation/NSIndexSet.h>
#import <Foundation/NSString.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSValue.h>
static NSUInteger fooCount = 0;
static NSUInteger lastIndex = NSNotFound;
static BOOL reverse = NO;
int main()
{
START_SET("NSArray Blocks")
@ -16,10 +18,20 @@ int main()
# endif
# if __has_feature(blocks)
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSLock *lock = [[[NSLock alloc] init] autorelease];
NSArray *array = [NSArray arrayWithObjects: @"foo", @"bar", @"foo", nil];
void(^enumBlock)(id,NSUInteger,BOOL*) = ^(id obj, NSUInteger index, BOOL *stop){
if ([obj isEqual: @"foo"]){ fooCount++;} lastIndex = index;};
void(^enumBlock)(id,NSUInteger,BOOL*) = ^(id obj, NSUInteger index, BOOL *stop) {
[lock lock];
if ([obj isEqual: @"foo"]) {
fooCount++;
}
if (lastIndex == NSNotFound) {
lastIndex = index;
} else {
lastIndex = reverse ? MIN(lastIndex, index) : MAX(lastIndex, index);
}
[lock unlock];
};
[array enumerateObjectsUsingBlock: enumBlock];
PASS((2 == fooCount) && (lastIndex == 2),
"Can forward enumerate array using a block");
@ -31,9 +43,11 @@ int main()
"Can forward enumerate array concurrently using a block");
fooCount = 0;
lastIndex = NSNotFound;
reverse = YES;
[array enumerateObjectsWithOptions: NSEnumerationReverse
usingBlock: enumBlock];
PASS((0 == lastIndex), "Can enumerate array in reverse using a block");
reverse = NO;
fooCount = 0;
lastIndex = NSNotFound;
enumBlock = ^(id obj, NSUInteger index, BOOL *stop){if ([obj isEqual: @"foo"]){

View file

@ -8,14 +8,12 @@
const NSTimeInterval kDelay = 0.01;
#if HAVE_LIBDISPATCH_RUNLOOP && __has_feature(blocks)
#if GS_USE_LIBDISPATCH_RUNLOOP && __has_feature(blocks)
# define DISPATCH_RL_INTEGRATION 1
# ifdef HAVE_DISPATCH_H
# if __has_include(<dispatch.h>)
# include <dispatch.h>
# else
# ifdef HAVE_DISPATCH_DISPATCH_H
# include <dispatch/dispatch.h>
# endif
# include <dispatch/dispatch.h>
# endif
#endif

13
configure vendored
View file

@ -9079,6 +9079,19 @@ fi
done
for ac_header in unwind.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default"
if test "x$ac_cv_header_unwind_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UNWIND_H 1
_ACEOF
fi
done
#--------------------------------------------------------------------
# These headers/functions needed by NSLog.m
#--------------------------------------------------------------------

View file

@ -2321,6 +2321,8 @@ fi
AC_CHECK_FUNCS(__builtin_extract_return_address)
AC_CHECK_HEADERS(unwind.h)
#--------------------------------------------------------------------
# These headers/functions needed by NSLog.m
#--------------------------------------------------------------------

View file

@ -3,48 +3,55 @@
set -ex
DEP_SRC=$HOME/dependency_source/
DEP_ROOT=$HOME/staging
install_gnustep_make() {
cd $DEP_SRC
git clone https://github.com/gnustep/make.git
cd make
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ]
git clone https://github.com/gnustep/tools-make.git
cd tools-make
if [ -n "$RUNTIME_VERSION" ]
then
ADDITIONAL_FLAGS="--enable-objc-nonfragile-abi"
else
ADDITIONAL_FLAGS=""
echo "RUNTIME_VERSION=$RUNTIME_VERSION" > GNUstep.conf
fi
./configure --prefix=$HOME/staging --with-library-combo=$LIBRARY_COMBO $ADDITIONAL_FLAGS
./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO --with-user-config-file=$PWD/GNUstep.conf
make install
echo Objective-C build flags: `$HOME/staging/bin/gnustep-config --objc-flags`
}
install_ng_runtime() {
cd $DEP_SRC
git clone https://github.com/gnustep/libobjc2.git
cd libobjc2
git submodule init
git submodule sync
git submodule update
cd ..
mkdir libobjc2/build
cd libobjc2/build
export CC="clang"
export CXX="clang++"
cmake -DTESTS=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGNUSTEP_INSTALL_TYPE=NONE -DCMAKE_INSTALL_PREFIX:PATH=$HOME/staging ../
export CXXFLAGS="-std=c++11"
cmake -DTESTS=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGNUSTEP_INSTALL_TYPE=NONE -DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT ../
make install
}
install_libdispatch() {
cd $DEP_SRC
git clone https://github.com/ngrewe/libdispatch.git
mkdir libdispatch/build
cd libdispatch/build
# will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged
git clone -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git
mkdir swift-corelibs-libdispatch/build
cd swift-corelibs-libdispatch/build
export CC="clang"
export CXX="clang++"
export LIBRARY_PATH=$HOME/staging/lib;
export LD_LIBRARY_PATH=$HOME/staging/lib:$LD_LIBRARY_PATH;
export CPATH=$HOME/staging/include;
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=$HOME/staging ../
export LIBRARY_PATH=$DEP_ROOT/lib;
export LD_LIBRARY_PATH=$DEP_ROOT/lib:$LD_LIBRARY_PATH;
export CPATH=$DEP_ROOT/include;
cmake -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=$HOME/staging -DINSTALL_PRIVATE_HEADERS=1 -DBlocksRuntime_INCLUDE_DIR=$DEP_ROOT/include -DBlocksRuntime_LIBRARIES=$DEP_ROOT/lib/libobjc.so ../
make install
}
mkdir -p $DEP_SRC
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ]
if [ "$LIBRARY_COMBO" = 'ng-gnu-gnu' ]
then
install_ng_runtime
install_libdispatch