Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize F-Script #3

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cffbf77
Modernize F-Script by adding new frameworks, dropping GC-support and …
Kentzo Oct 3, 2012
8cf16a6
Replaced ->isa with object_getClass() to conform to requirements of t…
Nov 25, 2012
9876563
Added newline to end of heder to silence warnings generated from -Wal…
Nov 26, 2012
a1391a5
Removed direct use of ->isa and replaced with object_getClass()
Nov 26, 2012
79b56e3
Merge with https://github.com/mugginsoft/F-Script
Kentzo Jan 30, 2013
c04a74c
Fixed error for building it on OSX 10.8.4
whatsbcn Aug 18, 2013
6cd4411
Merge pull request #2 from whatsbcn/master
Kentzo Aug 19, 2013
5452637
Explicitly set canBecomeKeyWindow on ArgumentsWindow.
mblsha Jan 25, 2014
1836c7a
Use compiler-default C dialect to fix SceneKit compilation errors.
mblsha Jan 25, 2014
bc4df55
Fix compilation on 10.9 Mavericks.
mblsha Jan 25, 2014
7789fdb
Merge pull request #4 from mblsha/master
Kentzo Jan 26, 2014
d983e10
Fix NSString object assigned to NSMutableString variable.
Kentzo Feb 3, 2014
2b3fe68
Update project settings, add some missing frameworks from 10.9 and up…
Kentzo Feb 3, 2014
96cf7a1
Add schemes and targets for platform dependant builds.
Kentzo Feb 3, 2014
e6fbabe
Update README.
Kentzo Feb 3, 2014
0ef1eba
Update README.md
Kentzo Feb 3, 2014
d663e00
Update README.md
Kentzo May 14, 2014
947aa53
Disable quote substitution in FScriptTextView.m
ludwig May 19, 2014
2e59b14
Merge pull request #9 from ludwig/patch-1
Kentzo May 25, 2014
75daec4
Add 10.10.
Kentzo Oct 26, 2014
4228bad
Ensure dSYM are generated for release build. Remove Java from 10.10.
Kentzo Oct 26, 2014
4df2995
Update README.
Kentzo Oct 26, 2014
cb97d98
Match behavior of [[NSArray reverseObjectEnumerator] allObjects]. {1,…
Apr 8, 2013
daee784
Other xcscheme fixes.
Kentzo Oct 26, 2014
85377a7
Default to x86_64 arch.
Kentzo Oct 27, 2014
1a432e3
Remove Kernel.framework from requirements for all targets.
Kentzo Oct 27, 2014
623136d
Set target SDK of targets to target OS version rather than latest.
Kentzo Oct 27, 2014
fd39e97
CoreBluetooth is not available under 10.9.
Kentzo Oct 27, 2014
7e30ae2
Remove all Java dependencies.
Kentzo Oct 27, 2014
d4daa36
Remove unused headers from FSConstantsDictionaryGenerator.
Kentzo Oct 27, 2014
ef152b0
Remove frameworks that are not available under 10.7.
Kentzo Oct 27, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions F-Script/FScriptAppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
@class NSButton;
@class NSApplication;

void RestartWithCorrectGarbageCollectionSettingIfNecessary();

@interface FScriptAppController : NSObject
{
IBOutlet FSInterpreterView *interpreterView;
Expand All @@ -19,7 +17,6 @@ void RestartWithCorrectGarbageCollectionSettingIfNecessary();
IBOutlet NSTextField *fontSizeUI;
IBOutlet NSButton *shouldJournalUI;
IBOutlet NSButton *confirmWhenQuittingUI;
IBOutlet NSButton *runWithObjCAutomaticGarbageCollectionUI;
IBOutlet NSButton *displayObjectBrowserAtLaunchTimeUI;
IBOutlet NSButton *automaticallyIntrospectDeclaredPropertiesUI;

Expand Down
124 changes: 9 additions & 115 deletions F-Script/FScriptAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,83 +19,6 @@

extern char **environ;

void RestartWithCorrectGarbageCollectionSettingIfNecessary()
{
/* Inspired by code provided by Scotty of the Mac Developer Network. */
/* See http://www.mac-developer-network.com/podcasts/lnc/lnc036/ */

// NSLog(@"Entering in RestartWithCorrectGarbageCollectionSettingIfNecessary()");

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

NSDictionary* garbageCollectionUserDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"FScriptRunWithObjCAutomaticGarbageCollection", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:garbageCollectionUserDefaults];

BOOL requireRestart = NO;

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptRunWithObjCAutomaticGarbageCollection"] == YES && [NSGarbageCollector defaultCollector] == nil)
{
// NSLog(@"unsetenv OBJC_DISABLE_GC");
unsetenv("OBJC_DISABLE_GC");
requireRestart = YES;
}
else if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptRunWithObjCAutomaticGarbageCollection"] == NO && [NSGarbageCollector defaultCollector])
{
// NSLog(@"setenv OBJC_DISABLE_GC");
setenv("OBJC_DISABLE_GC", "YES", 1);
requireRestart = YES;
}

if (requireRestart)
{
// NSLog(@"Require restart");

cpu_type_t cpuTypes[2];

#ifdef __ppc__
// 32-bit PowerPC code
cpuTypes[0] = CPU_TYPE_POWERPC;
#else
#ifdef __ppc64__
cpuTypes[0] = CPU_TYPE_POWERPC64;
#else
#ifdef __i386__
// 32-bit Intel code
cpuTypes[0] = CPU_TYPE_I386;
#else
#ifdef __x86_64__
// 64-bit Intel code
cpuTypes[0] = CPU_TYPE_X86_64;
#else
#error UNKNOWN ARCHITECTURE
#endif
#endif
#endif
#endif

cpuTypes[1] = CPU_TYPE_ANY; // Things should work without this entry, but we use it just in case of an unforeseen problem

size_t ocount;
posix_spawnattr_t attribute;
posix_spawnattr_init(&attribute);
posix_spawnattr_setbinpref_np(&attribute, 2, cpuTypes, &ocount);

const int spawnReturnValue = posix_spawn(NULL, (*_NSGetArgv())[0], NULL, &attribute, *_NSGetArgv(), environ);

if(spawnReturnValue == 0)
{
exit(0);
}
else
{
perror("posix_spawn() failed, continuing...");
}
}

[pool release];
}


NSString *findPathToFileInLibraryWithinUserDomain(NSString *fileName)
/*" Returns the path to the first occurrence of fileName in a Library directory within the User domain. "*/
{
Expand Down Expand Up @@ -154,7 +77,6 @@ + (void)initialize
[registrationDict setObject:@"NO" forKey:@"FScriptShouldJournal"];
[registrationDict setObject:@"NO" forKey:@"FScriptConfirmWhenQuitting"];
[registrationDict setObject:@"YES" forKey:@"FScriptDisplayObjectBrowserAtLaunchTime"];
[registrationDict setObject:@"YES" forKey:@"FScriptRunWithObjCAutomaticGarbageCollection"];
[registrationDict setObject:@"YES" forKey:@"FScriptAutomaticallyIntrospectDeclaredProperties"];

[registrationDict setObject:@"NO" forKey:@"FScriptShowDemoAssistant"];
Expand Down Expand Up @@ -198,8 +120,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptLoadSystemFrameworks"])
[self loadSystemFrameworks];
if (floor(NSAppKitVersionNumber) > 949)

if (floor(NSAppKitVersionNumber) > 949)
{
// 10.6 or later system
NSString *systemFrameworksDirectoryPath;
Expand All @@ -219,7 +141,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification

}
}
//
if (!repositoryPath || ![fileManager fileExistsAtPath:repositoryPath isDirectory:&b])
{
NSError *error = nil;
Expand Down Expand Up @@ -300,7 +222,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
NSLog(@"fatal problem: the repository file \"%@\" is not a directory or is not writable", repositoryPath);
exit(1);
}

// Initialize the random number generator with random seeds
srandomdev();
srand48(random());
Expand All @@ -312,12 +234,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
[[interpreterView interpreter] setShouldJournal:[[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptShouldJournal"]];
if (repositoryPath) [[NSUserDefaults standardUserDefaults] setObject:[repositoryPath stringByAppendingPathComponent:@"journal.txt"] forKey:@"FScriptJournalName"];
[[interpreterView interpreter] setJournalName:[[NSUserDefaults standardUserDefaults] stringForKey:@"FScriptJournalName"]];

//
// JG
servicesProvider = [[FSServicesProvider alloc] initWithFScriptInterpreterViewProvider:self];
[servicesProvider registerExports];
// Latent block processing
//
// // Latent block processing
latentPath = [[[NSUserDefaults standardUserDefaults] stringForKey:@"FScriptRepositoryPath"] stringByAppendingPathComponent:@"fs_latent"];

if (latentPath && [[NSFileManager defaultManager] fileExistsAtPath:latentPath])
Expand Down Expand Up @@ -350,12 +272,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
}
}
//----------

[[interpreterView window] makeKeyAndOrderFront:nil];

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptDisplayObjectBrowserAtLaunchTime"])
[[interpreterView interpreter] browse];

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptShowDemoAssistant"])
[[[FSDemoAssistant alloc] initWithInterpreterView:interpreterView] activate];
}
Expand Down Expand Up @@ -477,7 +399,6 @@ - (void)showPreferencePanel:(id)sender
[fontSizeUI setDoubleValue:[interpreterView fontSize]];
[shouldJournalUI setState:[[interpreterView interpreter] shouldJournal]];
[confirmWhenQuittingUI setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptConfirmWhenQuitting"]];
[runWithObjCAutomaticGarbageCollectionUI setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptRunWithObjCAutomaticGarbageCollection"]];
[displayObjectBrowserAtLaunchTimeUI setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptDisplayObjectBrowserAtLaunchTime"]];
[automaticallyIntrospectDeclaredPropertiesUI setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptAutomaticallyIntrospectDeclaredProperties"]];

Expand Down Expand Up @@ -509,33 +430,6 @@ - (void)updatePreference:(id)sender // action
{
[[NSUserDefaults standardUserDefaults] setBool:[automaticallyIntrospectDeclaredPropertiesUI state] forKey:@"FScriptAutomaticallyIntrospectDeclaredProperties"];
}
else if (sender == runWithObjCAutomaticGarbageCollectionUI)
{
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"Restart"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"Restart F-Script?"];
[alert setInformativeText:@"F-Script needs to be restarted to change the memory management mode"];
[alert setAlertStyle:NSWarningAlertStyle];

if ([alert runModal] == NSAlertFirstButtonReturn)
{
// Restart clicked

[[NSUserDefaults standardUserDefaults] setBool:[runWithObjCAutomaticGarbageCollectionUI state] forKey:@"FScriptRunWithObjCAutomaticGarbageCollection"];
[[NSUserDefaults standardUserDefaults] synchronize];

RestartWithCorrectGarbageCollectionSettingIfNecessary();
}
else
{
// Cancel clicked

[runWithObjCAutomaticGarbageCollectionUI setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptRunWithObjCAutomaticGarbageCollection"]];
}

[alert release];
}
}

////////// Window delegate methods (I'm the delegate of the the console window)
Expand Down
100 changes: 0 additions & 100 deletions F-Script/FScriptAppPreference.nib/classes.nib

This file was deleted.