Overview
| Comment: | Rewrite objfw-new in ObjC
This offers more flexibility in the future, e.g. to generate classes |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
1ad52a2f2cefbfea50dab974d1315487 |
| User & Date: | js on 2022-08-07 20:46:51 |
| Other Links: | manifest | tags |
Context
|
2022-08-07
| ||
| 20:57 | objfw-new: Use proper long options (check-in: ceee745736 user: js tags: trunk) | |
| 20:46 | Rewrite objfw-new in ObjC (check-in: 1ad52a2f2c user: js tags: trunk) | |
| 20:43 | Remove utils/objfw-new (check-in: 18e40d7a45 user: js tags: trunk) | |
Changes
Modified .fossil-settings/clean-glob from [c4150a9711] to [06b87ad48d].
| ︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 | tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp | > | 46 47 48 49 50 51 52 53 54 55 56 57 | tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/objfw-new/objfw-new utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp |
Modified .fossil-settings/ignore-glob from [ed0ba1aa38] to [23cb69850b].
| ︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 | tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp | > | 51 52 53 54 55 56 57 58 59 60 61 62 | tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/objfw-new/objfw-new utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp |
Modified .gitignore from [42e9f25720] to [726b780402].
| ︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 | tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp | > | 51 52 53 54 55 56 57 58 59 60 61 62 | tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/objfw-new/objfw-new utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp |
Modified configure.ac from [a6c1722c25] to [0ce2b7ad97].
| ︙ | ︙ | |||
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 |
AC_MSG_RESULT($atomic_ops)
AC_ARG_ENABLE(files,
AS_HELP_STRING([--disable-files], [disable file support]))
AS_IF([test x"$enable_files" != x"no"], [
AC_DEFINE(OF_HAVE_FILES, 1, [Whether we have files])
AC_SUBST(USE_SRCS_FILES, '${SRCS_FILES}')
AC_SUBST(OFARC, "ofarc")
AC_SUBST(OFHASH, "ofhash")
case "$host_os" in
msdosdjgpp*)
dnl DJGPP has the type, but it's not really usable.
;;
| > | 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 |
AC_MSG_RESULT($atomic_ops)
AC_ARG_ENABLE(files,
AS_HELP_STRING([--disable-files], [disable file support]))
AS_IF([test x"$enable_files" != x"no"], [
AC_DEFINE(OF_HAVE_FILES, 1, [Whether we have files])
AC_SUBST(USE_SRCS_FILES, '${SRCS_FILES}')
AC_SUBST(OBJFW_NEW, "objfw-new")
AC_SUBST(OFARC, "ofarc")
AC_SUBST(OFHASH, "ofhash")
case "$host_os" in
msdosdjgpp*)
dnl DJGPP has the type, but it's not really usable.
;;
|
| ︙ | ︙ |
Modified extra.mk.in from [8ae8820dcd] to [a3fba56a2a].
| ︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | LIBOBJFW_DEP_LVL2 = @LIBOBJFW_DEP_LVL2@ LINKLIB = @LINKLIB@ LOOKUP_ASM_A = @LOOKUP_ASM_A@ LOOKUP_ASM_AMIGALIB_A = @LOOKUP_ASM_AMIGALIB_A@ LOOKUP_ASM_LIB_A = @LOOKUP_ASM_LIB_A@ MAP_LDFLAGS = @MAP_LDFLAGS@ OBJC_SYNC = @OBJC_SYNC@ OFARC = @OFARC@ OFDNS = @OFDNS@ OFHASH = @OFHASH@ OFHTTP = @OFHTTP@ OFHTTP_LIBS = @OFHTTP_LIBS@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | LIBOBJFW_DEP_LVL2 = @LIBOBJFW_DEP_LVL2@ LINKLIB = @LINKLIB@ LOOKUP_ASM_A = @LOOKUP_ASM_A@ LOOKUP_ASM_AMIGALIB_A = @LOOKUP_ASM_AMIGALIB_A@ LOOKUP_ASM_LIB_A = @LOOKUP_ASM_LIB_A@ MAP_LDFLAGS = @MAP_LDFLAGS@ OBJC_SYNC = @OBJC_SYNC@ OBJFW_NEW = @OBJFW_NEW@ OFARC = @OFARC@ OFDNS = @OFDNS@ OFHASH = @OFHASH@ OFHTTP = @OFHTTP@ OFHTTP_LIBS = @OFHTTP_LIBS@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ |
| ︙ | ︙ |
Modified utils/Makefile from [b7affc6883] to [d5d46e8aaf].
1 2 | include ../extra.mk | | > | 1 2 3 4 5 6 7 8 9 10 11 |
include ../extra.mk
SUBDIRS += ${OBJFW_NEW} \
${OFARC} \
${OFDNS} \
${OFHASH} \
${OFHTTP} \
completions
include ../buildsys.mk
|
| ︙ | ︙ |
Added utils/objfw-new/Makefile version [c4471397ec].
> > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
include ../../extra.mk
PROG = objfw-new${PROG_SUFFIX}
SRCS = NewApp.m \
NewClass.m \
ObjFWNew.m
include ../../buildsys.mk
${PROG}: ${LIBOBJFW_DEP_LVL2} ${LIBOBJFWRT_DEP_LVL2}
CPPFLAGS += -I../../src \
-I../../src/runtime \
-I../../src/exceptions \
-I../..
LIBS := -L../../src -lobjfw \
-L../../src/runtime -L../../src/runtime/linklib ${RUNTIME_LIBS} \
${LIBS}
LD = ${OBJC}
LDFLAGS += ${LDFLAGS_RPATH}
|
Added utils/objfw-new/NewApp.m version [181e58f243].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* 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 <errno.h>
#import "OFApplication.h"
#import "OFFile.h"
#import "OFStdIOStream.h"
#import "OFString.h"
#import "OFOpenItemFailedException.h"
void
newApp(OFString *name)
{
OFString *path = [name stringByAppendingPathExtension: @"m"];
OFFile *file;
@try {
file = [OFFile fileWithPath: path mode: @"wx"];
} @catch (OFOpenItemFailedException *e) {
if (e.errNo != EEXIST)
@throw e;
[OFStdErr writeFormat: @"File %@ already exists! Aborting...\n",
e.path];
[OFApplication terminateWithStatus: 1];
}
[file writeFormat: @"#import <ObjFW/ObjFW.h>\n"
@"\n"
@"@interface %@: OFObject <OFApplicationDelegate>\n"
@"@end\n"
@"\n"
@"OF_APPLICATION_DELEGATE(%@)\n"
@"\n"
@"@implementation %@\n"
@"- (void)applicationDidFinishLaunching\n"
@"{\n"
@" [OFApplication terminate];\n"
@"}\n"
@"@end\n",
name, name, name];
[file close];
}
|
Added utils/objfw-new/NewClass.m version [fa825248af].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* 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 <errno.h>
#import "OFApplication.h"
#import "OFFile.h"
#import "OFStdIOStream.h"
#import "OFString.h"
#import "OFOpenItemFailedException.h"
void
newClass(OFString *name)
{
OFString *headerPath = [name stringByAppendingPathExtension: @"h"];
OFString *implPath = [name stringByAppendingPathExtension: @"m"];
OFFile *headerFile, *implFile;
@try {
headerFile = [OFFile fileWithPath: headerPath mode: @"wx"];
implFile = [OFFile fileWithPath: implPath mode: @"wx"];
} @catch (OFOpenItemFailedException *e) {
if (e.errNo != EEXIST)
@throw e;
[OFStdErr writeFormat: @"File %@ already exists! Aborting...\n",
e.path];
[OFApplication terminateWithStatus: 1];
}
[headerFile writeFormat: @"#import <ObjFW/ObjFW.h>\n"
@"\n"
@"@interface %@: OFObject\n"
@"@end\n",
name];
[implFile writeFormat: @"#import \"%@\"\n"
@"\n"
@"@implementation %@\n"
@"@end\n",
headerPath, name];
[headerFile close];
[implFile close];
}
|
Added utils/objfw-new/ObjFWNew.m version [aba8385948].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* 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"
#import "OFApplication.h"
#import "OFArray.h"
#import "OFObject.h"
#import "OFStdIOStream.h"
#import "OFString.h"
@interface ObjFWNew: OFObject <OFApplicationDelegate>
@end
extern void newApp(OFString *);
extern void newClass(OFString *);
OF_APPLICATION_DELEGATE(ObjFWNew)
static void
showUsage(void)
{
[OFStdErr writeFormat: @"Usage: %@ app|class name [properties]\n",
[OFApplication programName]];
[OFApplication terminateWithStatus: 1];
}
@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
OFArray OF_GENERIC(OFString *) *arguments = [OFApplication arguments];
OFString *type, *name;
if (arguments.count != 2)
showUsage();
type = [arguments objectAtIndex: 0];
name = [arguments objectAtIndex: 1];
if ([type isEqual: @"app"])
newApp(name);
else if ([type isEqual: @"class"])
newClass(name);
else
showUsage();
[OFApplication terminate];
}
@end
|