Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,6 +1,6 @@ -AC_INIT(ObjFW, 1.1-dev, js@nil.im) +AC_INIT(ObjFW, 1.1dev, js@nil.im) AC_CONFIG_SRCDIR(src) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_MACRO_DIR(build-aux/m4) AC_DEFINE(OBJFW_VERSION_MAJOR, 1, [The major version of ObjFW]) Index: src/OFFileManager.h ================================================================== --- src/OFFileManager.h +++ src/OFFileManager.h @@ -406,10 +406,21 @@ * @param URL The URL to the directory whose items should be returned * @return An array with the URLs of the items in the specified directory */ - (OFArray OF_GENERIC(OFURL *) *)contentsOfDirectoryAtURL: (OFURL *)URL; +/** + * @brief Returns an array with all subpaths of the specified directory. + * + * @note `.` and `..` (of the directory itself or any subdirectory) are not + * part of the returned array. + * + * @param path The path to the directory whose subpaths should be returned + * @return An array of OFString with the subpaths of the specified directory + */ +- (OFArray OF_GENERIC(OFString *) *)subpathsOfDirectoryAtPath: (OFString *)path; + #ifdef OF_HAVE_FILES /** * @brief Changes the current working directory. * * @param path The new directory to change to Index: src/OFFileManager.m ================================================================== --- src/OFFileManager.m +++ src/OFFileManager.m @@ -446,10 +446,41 @@ ret = [OFMutableArray arrayWithCapacity: URLs.count]; for (OFURL *URL in URLs) [ret addObject: URL.lastPathComponent]; + [ret makeImmutable]; + [ret retain]; + + objc_autoreleasePoolPop(pool); + + return [ret autorelease]; +} + +- (OFArray OF_GENERIC(OFString *) *)subpathsOfDirectoryAtPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFMutableArray OF_GENERIC(OFString *) *ret = + [OFMutableArray arrayWithObject: path]; + + for (OFString *subpath in [self contentsOfDirectoryAtPath: path]) { + void *pool2 = objc_autoreleasePoolPush(); + OFString *fullSubpath = + [path stringByAppendingPathComponent: subpath]; + OFFileAttributes attributes = + [self attributesOfItemAtPath: fullSubpath]; + + if ([attributes.fileType isEqual: OFFileTypeDirectory]) + [ret addObjectsFromArray: + [self subpathsOfDirectoryAtPath: fullSubpath]]; + else + [ret addObject: fullSubpath]; + + objc_autoreleasePoolPop(pool2); + } + + [ret makeImmutable]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -205,11 +205,11 @@ @property (readonly, nonatomic, getter=isAtEndOfStream) bool atEndOfStream; /** * @brief Whether writes are buffered. */ -@property (nonatomic, nonatomic) bool buffersWrites; +@property (nonatomic) bool buffersWrites; /** * @brief Whether data is present in the internal read buffer. */ @property (readonly, nonatomic) bool hasDataInReadBuffer; Index: src/OFTLSKey.m ================================================================== --- src/OFTLSKey.m +++ src/OFTLSKey.m @@ -20,9 +20,9 @@ #if defined(OF_HAVE_PTHREADS) # include "platform/POSIX/OFTLSKey.m" #elif defined(OF_WINDOWS) # include "platform/Windows/OFTLSKey.m" #elif defined(OF_MORPHOS) -# include "platform/MorphOs/OFTLSKey.m" +# include "platform/MorphOS/OFTLSKey.m" #elif defined(OF_AMIGAOS) # include "platform/AmigaOS/OFTLSKey.m" #endif ADDED src/runtime/lookup-asm/lookup-asm-powerpc64-elf.S Index: src/runtime/lookup-asm/lookup-asm-powerpc64-elf.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-powerpc64-elf.S +++ src/runtime/lookup-asm/lookup-asm-powerpc64-elf.S @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2008-2021 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include "platform.h" + +.globl objc_msg_lookup +.globl objc_msg_lookup_stret +.globl objc_msg_lookup_super +.globl objc_msg_lookup_super_stret + +.section .text +.macro GENERATE_LOOKUP name notFound +.section .opd, "aw", @progbits +\name: + .p2align 3 + .quad .Lbegin_\name + .quad .TOC.@tocbase + .quad 0 +.text +.Lbegin_\name: + cmpdi %r3, 0 + beq- .LreturnNilMethod + + andi. %r0, %r3, 1 + bne- .LtaggedPointer_\name + + ld %r5, 0(%r3) + ld %r5, 64(%r5) + +.Lmain_\name: + ld %r8, 0(%r4) +#ifdef OF_SELUID24 + rlwinm %r6, %r8, 19, 0x7F8 +#endif + rlwinm %r7, %r8, 27, 0x7F8 + rlwinm %r8, %r8, 3, 0x7F8 + +#ifdef OF_SELUID24 + ldx %r5, %r5, %r6 +#endif + ldx %r5, %r5, %r7 + ldx %r5, %r5, %r8 + + cmpdi %r5, 0 + beq- 0f + + mr %r3, %r5 + blr + +0: + mflr %r0 + std %r0, 16(%r1) + stdu %r1, -112(%r1) + bl \notFound + nop + addi %r1, %r1, 112 + ld %r0, 16(%r1) + mtlr %r0 + blr + +.LtaggedPointer_\name: + addis %r5, %r2, objc_taggedPointerSecret@toc@ha + ld %r5, objc_taggedPointerSecret@toc@l(%r5) + xor %r5, %r3, %r5 + rlwinm %r5, %r5, 2, 0x38 + + addis %r6, %r2, objc_taggedPointerClasses@toc@ha + addi %r6, %r6, objc_taggedPointerClasses@toc@l + ldx %r5, %r6, %r5 + ld %r5, 64(%r5) + + b .Lmain_\name +.type \name, @function +.size \name, .-.Lbegin_\name +.endm + +.macro GENERATE_LOOKUP_SUPER name lookup +.section .opd, "aw", @progbits +\name: + .p2align 3 + .quad .Lbegin_\name + .quad .TOC.@tocbase + .quad 0 +.text +.Lbegin_\name: + mr %r5, %r3 + ld %r3, 0(%r3) + cmpdi %r3, 0 + beq- .LreturnNilMethod + + ld %r5, 8(%r5) + ld %r5, 64(%r5) + + b .Lmain_\lookup +.type \name, @function +.size \name, .-.Lbegin_\name +.endm + +GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound +GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret +GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup +GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret + +.LreturnNilMethod: + addis %r3, %r2, nilMethod@toc@ha + addi %r3, %r3, nilMethod@toc@l + blr + +.section .opd, "aw", @progbits +nilMethod: + .p2align 3 + .quad .Lbegin_nilMethod + .quad .TOC.@tocbase + .quad 0 +.text +.Lbegin_nilMethod: + li %r3, 0 + blr +.type nilMethod, @function +.size nilMethod, .-.Lbegin_nilMethod + +#ifdef OF_LINUX +.section .note.GNU-stack, "", @progbits +#endif Index: src/runtime/lookup-asm/lookup-asm.S ================================================================== --- src/runtime/lookup-asm/lookup-asm.S +++ src/runtime/lookup-asm/lookup-asm.S @@ -24,10 +24,12 @@ # include "lookup-asm-x86-elf.S" # elif defined(OF_ARM64) # include "lookup-asm-arm64-elf.S" # elif defined(OF_ARM) # include "lookup-asm-arm-elf.S" +# elif defined(OF_POWERPC64) +# include "lookup-asm-powerpc64-elf.S" # elif defined(OF_POWERPC) # include "lookup-asm-powerpc-elf.S" # elif defined(OF_MIPS64_N64) # include "lookup-asm-mips64-n64-elf.S" # elif defined(OF_MIPS) Index: src/runtime/private.h ================================================================== --- src/runtime/private.h +++ src/runtime/private.h @@ -356,11 +356,12 @@ #define OBJC_ERROR(...) \ objc_error("ObjFWRT @ " __FILE__ ":" OF_STRINGIFY(__LINE__), \ __VA_ARGS__) #if defined(OF_ELF) -# if defined(OF_X86_64) || defined(OF_X86) || defined(OF_POWERPC) || \ +# if defined(OF_X86_64) || defined(OF_X86) || \ + defined(OF_POWERPC64) || defined(OF_POWERPC) || \ defined(OF_ARM64) || defined(OF_ARM) || \ defined(OF_MIPS64_N64) || defined(OF_MIPS) || \ defined(OF_SPARC64) || defined(OF_SPARC) # define OF_ASM_LOOKUP # endif Index: utils/ofarc/LHAArchive.m ================================================================== --- utils/ofarc/LHAArchive.m +++ utils/ofarc/LHAArchive.m @@ -480,12 +480,17 @@ attributes.fileGroupOwnerAccountID]; entry.owner = attributes.fileOwnerAccountName; entry.group = attributes.fileGroupOwnerAccountName; #endif - if ([type isEqual: OFFileTypeDirectory]) + if ([type isEqual: OFFileTypeDirectory]) { entry.compressionMethod = @"-lhd-"; + + if (![entry.fileName hasSuffix: @"/"]) + entry.fileName = [entry.fileName + stringByAppendingString: @"/"]; + } output = [_archive streamForWritingEntry: entry]; if ([type isEqual: OFFileTypeRegular]) { unsigned long long written = 0; Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -142,10 +142,31 @@ [OFStdErr writeLine: OF_LOCALIZED( @"writing_not_supported", @"Writing archives of type %[type] is not (yet) supported!", @"type", type)]; } + +static void +addFiles(id archive, OFArray OF_GENERIC(OFString *) *files) +{ + OFMutableArray *expandedFiles = + [OFMutableArray arrayWithCapacity: files.count]; + OFFileManager *fileManager = [OFFileManager defaultManager]; + + for (OFString *file in files) { + OFFileAttributes attributes = + [fileManager attributesOfItemAtPath: file]; + + if ([attributes.fileType isEqual: OFFileTypeDirectory]) + [expandedFiles addObjectsFromArray: + [fileManager subpathsOfDirectoryAtPath: file]]; + else + [expandedFiles addObject: file]; + } + + [archive addFiles: expandedFiles]; +} @implementation OFArc - (void)applicationDidFinishLaunching { OFString *outputDir, *encodingString, *type; @@ -334,11 +355,11 @@ openArchiveWithPath: remainingArguments.firstObject type: type mode: mode encoding: encoding]; - [archive addFiles: files]; + addFiles(archive, files); break; case 'l': if (remainingArguments.count != 1) help(OFStdErr, false, 1); Index: utils/ofhash/OFHash.m ================================================================== --- utils/ofhash/OFHash.m +++ utils/ofhash/OFHash.m @@ -41,12 +41,12 @@ static void help(void) { [OFStdErr writeLine: OF_LOCALIZED(@"usage", - @"Usage: %[prog] [--md5|--ripemd160|--sha1|--sha224|--sha256|" - @"--sha384|--sha512] file1 [file2 ...]", + @"Usage: %[prog] [--md5] [--ripemd160] [--sha1] [--sha224] " + @"[--sha256] [--sha384] [--sha512] file1 [file2 ...]", @"prog", [OFApplication programName])]; [OFApplication terminateWithStatus: 1]; } Index: utils/ofhash/lang/de.json ================================================================== --- utils/ofhash/lang/de.json +++ utils/ofhash/lang/de.json @@ -1,10 +1,10 @@ { "usage": [ - "Benutzung: %[prog] [--md5|--ripemd160|--sha1|--sha224|--sha256|", - "--sha384|--sha512] datei1 [datei2 ...]" + "Benutzung: %[prog] [--md5] [--ripemd160] [--sha1] [--sha224] ", + "[--sha256] [--sha384] [--sha512] datei1 [datei2 ...]" ], "unknown_long_option": "%[prog]: Unbekannte Option: --%[opt]", "unknown_option": "%[prog]: Unbekannte Option: -%[opt]", "failed_to_open_file": "Fehler beim Öffnen der Datei %[file]: %[error]", "failed_to_read_file": "Fehler beim Lesen der Datei %[file]: %[error]" }