Skip to content

Commit bb1724a

Browse files
committed
F-Script 2.0.2
1 parent 6da6483 commit bb1724a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+854
-15422
lines changed

F-Script/FSNewlyAllocatedObject.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* FSNewlyAllocatedObject.h Copyright (c) 2009 Philippe Mougin. */
2+
/* This software is open source. See the license. */
3+
4+
#import <Cocoa/Cocoa.h>
5+
6+
7+
@interface FSNewlyAllocatedObject : NSProxy
8+
{
9+
NSUInteger retainCount;
10+
id target;
11+
}
12+
13+
+ (id)newlyAllocatedObjectWithTarget:(id)theTarget;
14+
15+
- (NSString *)description;
16+
- (void)forwardInvocation:(NSInvocation *)anInvocation;
17+
- (id)initWithTarget:(id)theTarget;
18+
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
19+
- (void)release;
20+
- (id)retain;
21+
22+
@end

F-Script/FSNewlyAllocatedObject.m

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/* FSNewlyAllocatedObject.m Copyright (c) 2009 Philippe Mougin. */
2+
/* This software is open source. See the license. */
3+
4+
#import "FSNewlyAllocatedObject.h"
5+
6+
7+
@implementation FSNewlyAllocatedObject
8+
9+
+ (id)newlyAllocatedObjectWithTarget:(id)theTarget
10+
{
11+
return [[[self alloc] initWithTarget:theTarget] autorelease];
12+
}
13+
14+
- (NSString *)description
15+
{
16+
return [[@"Proxy for a newly allocated " stringByAppendingString:NSStringFromClass(target->isa)] stringByAppendingString:@". Don't forget to initialize it and to use the object returned by the init... method instead of this proxy." ];
17+
}
18+
19+
- (void)forwardInvocation:(NSInvocation *)anInvocation
20+
{
21+
[anInvocation setTarget:target];
22+
[anInvocation invoke];
23+
return;
24+
}
25+
26+
/*
27+
NSProxy (10.6) unfortunately does not support fast forwarding (i.e., forwardingTargetForSelector:)
28+
If it does in a future version, we will be able to replace forwardInvocation: and methodSignatureForSelector: by the method below
29+
30+
- (id)forwardingTargetForSelector:(SEL)aSelector
31+
{
32+
return target;
33+
}
34+
*/
35+
36+
- (id)initWithTarget:(id)theTarget
37+
{
38+
retainCount = 1;
39+
40+
// We do not retain the target, as we stand for an object that has just been allocated but not yet initialized
41+
// Retaining an uninitialized object is not a good idea, in particular because its retain count is not yet initialized
42+
target = theTarget;
43+
44+
return self;
45+
}
46+
47+
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
48+
{
49+
return [target methodSignatureForSelector:aSelector];
50+
}
51+
52+
- (NSString *)printString
53+
{
54+
return [self description];
55+
}
56+
57+
- (id)retain
58+
{
59+
retainCount++;
60+
return self;
61+
}
62+
63+
- (NSUInteger)retainCount
64+
{
65+
return retainCount;
66+
}
67+
68+
- (void)release
69+
{
70+
if (--retainCount == 0) [self dealloc];
71+
}
72+
73+
@end

F-Script/FScriptAppController.m

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ void RestartWithCorrectGarbageCollectionSettingIfNecessary()
9797

9898

9999
NSString *findPathToFileInLibraryWithinUserDomain(NSString *fileName)
100-
/*" Retuns the path to the first occurrence of fileName in a Library
101-
directory within the User domain. "*/
100+
/*" Returns the path to the first occurrence of fileName in a Library directory within the User domain. "*/
102101
{
103102
NSString *result = nil; // the returned path
104103
NSString *candidate; // candidate paths
@@ -113,15 +112,14 @@ void RestartWithCorrectGarbageCollectionSettingIfNecessary()
113112
result = [candidate stringByAppendingPathComponent:fileName];
114113
if(![[NSFileManager defaultManager] fileExistsAtPath:result])
115114
{
116-
result = nil;
115+
result = nil;
117116
}
118117
}
119118
return result;
120119
}
121120

122121
NSString *findPathToFileInLibraryWithinSystemDomain(NSString *fileName)
123-
/*" Retuns the path to the first occurrence of fileName in a Library
124-
directory within the System domain. "*/
122+
/*" Returns the path to the first occurrence of fileName in a Library directory within the System domain. "*/
125123
{
126124
NSString *result = nil; // the returned path
127125
NSString *candidate; // candidate paths
@@ -136,7 +134,7 @@ void RestartWithCorrectGarbageCollectionSettingIfNecessary()
136134
result = [candidate stringByAppendingPathComponent:fileName];
137135
if(![[NSFileManager defaultManager] fileExistsAtPath:result])
138136
{
139-
result = nil;
137+
result = nil;
140138
}
141139
}
142140
return result;
@@ -201,6 +199,27 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
201199
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptLoadSystemFrameworks"])
202200
[self loadSystemFrameworks];
203201

202+
if (floor(NSAppKitVersionNumber) > 949)
203+
{
204+
// 10.6 or later system
205+
NSString *systemFrameworksDirectoryPath;
206+
NSString *path;
207+
208+
systemFrameworksDirectoryPath = findPathToFileInLibraryWithinSystemDomain(@"Frameworks");
209+
if (systemFrameworksDirectoryPath)
210+
{
211+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"PreferencePanes.framework"]; [[NSBundle bundleWithPath:path] load];
212+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"ScreenSaver.framework"]; [[NSBundle bundleWithPath:path] load];
213+
214+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"CoreLocation.framework"]; [[NSBundle bundleWithPath:path] load];
215+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"CoreWLAN.framework"]; [[NSBundle bundleWithPath:path] load];
216+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"ImageCaptureCore.framework"]; [[NSBundle bundleWithPath:path] load];
217+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"OpenDirectory.framework"]; [[NSBundle bundleWithPath:path] load];
218+
path = [systemFrameworksDirectoryPath stringByAppendingPathComponent:@"ServerNotification.framework"]; [[NSBundle bundleWithPath:path] load];
219+
220+
}
221+
}
222+
204223
if (!repositoryPath || ![fileManager fileExistsAtPath:repositoryPath isDirectory:&b])
205224
{
206225
NSString *applicationSupportDirectoryPath = findPathToFileInLibraryWithinUserDomain(@"Application Support");
@@ -457,7 +476,7 @@ - (void)updatePreference:(id)sender // action
457476
//NSLog(@"** updatePreference");
458477
if (sender == fontSizeUI)
459478
{
460-
[[NSUserDefaults standardUserDefaults] setFloat:[fontSizeUI doubleValue] forKey:@"FScriptFontSize"];
479+
[[NSUserDefaults standardUserDefaults] setDouble:[fontSizeUI doubleValue] forKey:@"FScriptFontSize"];
461480
[interpreterView setFontSize:[fontSizeUI doubleValue]];
462481
}
463482
else if (sender == shouldJournalUI)

0 commit comments

Comments
 (0)