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
63
64
65
|
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
63
64
65
66
67
68
69
|
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
*/
#include "config.h"
#import "OFApplication.h"
#import "OFFile.h"
#import "OFFileManager.h"
#import "OFURL.h"
#import "OFURI.h"
#import "OFXMLElement.h"
#import "FuncArrayGenerator.h"
#import "GlueGenerator.h"
#import "LinkLibGenerator.h"
@interface LibraryGenerator: OFObject <OFApplicationDelegate>
@end
OF_APPLICATION_DELEGATE(LibraryGenerator)
@implementation LibraryGenerator
- (void)applicationDidFinishLaunching
{
OFURL *sourcesURL = [[OFFileManager defaultManager].currentDirectoryURL
URLByAppendingPathComponent: @"../../src"];
OFURL *runtimeLibraryURL = [sourcesURL
URLByAppendingPathComponent: @"runtime/amiga-library.xml"];
OFURL *runtimeLinkLibURL = [sourcesURL
URLByAppendingPathComponent: @"runtime/linklib/linklib.m"];
OFURL *runtimeGlueHeaderURL = [sourcesURL
URLByAppendingPathComponent: @"runtime/amiga-glue.h"];
OFURL *runtimeGlueURL = [sourcesURL
URLByAppendingPathComponent: @"runtime/amiga-glue.m"];
OFURL *runtimeFuncArrayURL = [sourcesURL
URLByAppendingPathComponent: @"runtime/amiga-funcarray.inc"];
OFURI *sourcesURI = [[OFFileManager defaultManager].currentDirectoryURI
URIByAppendingPathComponent: @"../../src"];
OFURI *runtimeLibraryURI = [sourcesURI
URIByAppendingPathComponent: @"runtime/amiga-library.xml"];
OFURI *runtimeLinkLibURI = [sourcesURI
URIByAppendingPathComponent: @"runtime/linklib/linklib.m"];
OFURI *runtimeGlueHeaderURI = [sourcesURI
URIByAppendingPathComponent: @"runtime/amiga-glue.h"];
OFURI *runtimeGlueURI = [sourcesURI
URIByAppendingPathComponent: @"runtime/amiga-glue.m"];
OFURI *runtimeFuncArrayURI = [sourcesURI
URIByAppendingPathComponent: @"runtime/amiga-funcarray.inc"];
OFXMLElement *runtimeLibrary = [OFXMLElement elementWithStream:
[OFFile fileWithURL: runtimeLibraryURL
mode: @"r"]];
OFFile *runtimeLinkLib = [OFFile fileWithURL: runtimeLinkLibURL
mode: @"w"];
OFFile *runtimeGlueHeader = [OFFile fileWithURL: runtimeGlueHeaderURL
mode: @"w"];
OFFile *runtimeGlue = [OFFile fileWithURL: runtimeGlueURL
mode: @"w"];
OFFile *runtimeFuncArray = [OFFile fileWithURL: runtimeFuncArrayURL
mode: @"w"];
[OFFile fileWithPath: runtimeLibraryURI.fileSystemRepresentation
mode: @"r"]];
OFFile *runtimeLinkLib =
[OFFile fileWithPath: runtimeLinkLibURI.fileSystemRepresentation
mode: @"w"];
OFFile *runtimeGlueHeader =
[OFFile fileWithPath: runtimeGlueHeaderURI.fileSystemRepresentation
mode: @"w"];
OFFile *runtimeGlue =
[OFFile fileWithPath: runtimeGlueURI.fileSystemRepresentation
mode: @"w"];
OFFile *runtimeFuncArray =
[OFFile fileWithPath: runtimeFuncArrayURI.fileSystemRepresentation
mode: @"w"];
LinkLibGenerator *runtimeLinkLibGenerator = [[[LinkLibGenerator alloc]
initWithLibrary: runtimeLibrary
implementation: runtimeLinkLib] autorelease];
GlueGenerator *runtimeGlueGenerator = [[[GlueGenerator alloc]
initWithLibrary: runtimeLibrary
header: runtimeGlueHeader
implementation: runtimeGlue] autorelease];
|