Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
902 changes: 902 additions & 0 deletions FScript-iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions FScript.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2791,7 +2791,14 @@
isa = PBXProject;
buildConfigurationList = 8F2881FC08F9C040005B3C5A /* Build configuration list for PBXProject "FScript" */;
compatibilityVersion = "Xcode 3.0";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 0CD4E2FB00D7DD4D7BE9C1BD;
productRefGroup = 0CD4E2FC00D7DDB47BE9C1BD /* Products */;
projectDirPath = "";
Expand Down
3 changes: 2 additions & 1 deletion FScriptFramework/Array.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#import "FSNSArrayPrivate.h"
#import "FSArrayEnumerator.h"
#import "FSNSMutableArray.h"
#import "FSCollectionInspector.h"
#import "FSReplacementForCoderForNilInArray.h"

@interface Array(ArrayPrivateInternal)
Expand Down Expand Up @@ -331,13 +330,15 @@ - (id)replacementObjectForCoder:(NSCoder *)aCoder
assert(0);
}

#if !TARGET_OS_IPHONE
- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
// Overhide the NSArray behavior (which is to pass arrays by copy by default), with a by reference behavior by default.
// This is because passing an object by copy only works if the receiving process is linked with the class of the object.
// In our case, we want to support passing Arrays to applications that are not linked with the F-Script framework.
{
assert(0);
}
#endif

- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject
{
Expand Down
1 change: 0 additions & 1 deletion FScriptFramework/ArrayRepBoolean.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#import "ArrayRepBoolean.h"
#import "BlockPrivate.h"
#import "BlockRep.h"
#import "BlockInspector.h"
#import "string.h" // memcpy()
#import "ArrayPrivate.h"
#import "FSNumber.h"
Expand Down
1 change: 0 additions & 1 deletion FScriptFramework/ArrayRepDouble.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#import "BlockPrivate.h"
#import "BlockRep.h"
#import "BlockInspector.h"
#import "ArrayRepDouble.h"
#import <string.h> // memcpy()
#import "ArrayPrivate.h"
Expand Down
1 change: 0 additions & 1 deletion FScriptFramework/ArrayRepId.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#import "FSBlock.h"
#import "BlockRep.h"
#import "BlockPrivate.h"
#import "BlockInspector.h"
#import "FSExecEngine.h"
#import "FSPattern.h"
#import "FSExecEngine.h" // sendMsg
Expand Down
3 changes: 2 additions & 1 deletion FScriptFramework/Block.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import "ArrayPrivate.h"
#import <Foundation/Foundation.h>
#import "FSBooleanPrivate.h"
#import "BlockInspector.h"
#import "FScriptFunctions.h"
#import "Number.h"
#import "FSVoid.h"
Expand All @@ -26,7 +25,9 @@
void __attribute__ ((constructor)) initializeBlock(void)
{
[NSKeyedUnarchiver setClass:[Block class] forClassName:@"Block"];
#if !TARGET_OS_IPHONE
[NSUnarchiver decodeClassName:@"Block" asClassName:@"Block"];
#endif
}


Expand Down
1 change: 0 additions & 1 deletion FScriptFramework/BlockRep.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "FSArray.h"
#import <Foundation/Foundation.h>
#import "FSBoolean.h"
#import "BlockInspector.h"
#import "FScriptFunctions.h"
#import "FSUnarchiver.h"
#import "FSKeyedUnarchiver.h"
Expand Down
5 changes: 4 additions & 1 deletion FScriptFramework/FSArchiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@

#import <Foundation/Foundation.h>


#if TARGET_OS_IPHONE
@interface FSArchiver : NSKeyedArchiver
#else
@interface FSArchiver : NSArchiver
#endif
{}

- (void)encodeValueOfObjCType:(const char *)valueType at:(const void *)address;
Expand Down
5 changes: 4 additions & 1 deletion FScriptFramework/FSArray.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#import "FSNSArrayPrivate.h"
#import "FSArrayEnumerator.h"
#import "FSNSMutableArray.h"
#import "FSCollectionInspector.h"
#import "FSReplacementForCoderForNilInArray.h"

@interface FSArray(ArrayPrivateInternal)
Expand All @@ -35,7 +34,9 @@ - (enum ArrayRepType)type;
void __attribute__ ((constructor)) initializeFSArray(void)
{
[NSKeyedUnarchiver setClass:[FSArray class] forClassName:@"Array"];
#if !TARGET_OS_IPHONE
[NSUnarchiver decodeClassName:@"Array" asClassName:@"FSArray"];
#endif
}

/*static int comp_unsigned_int(const void *a,const void *b)
Expand Down Expand Up @@ -611,6 +612,7 @@ - (id)replacementObjectForCoder:(NSCoder *)aCoder
return self;
}

#if !TARGET_OS_IPHONE
- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
// Overhide the NSArray behavior (which is to pass arrays by copy by default), with a by reference behavior by default.
// This is because passing an object by copy only works if the receiving process is linked with the class of the object.
Expand All @@ -619,6 +621,7 @@ - (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
if ([encoder isBycopy]) return self;
else return [NSDistantObject proxyWithLocal:self connection:[encoder connection]];
}
#endif

- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject
{
Expand Down
2 changes: 1 addition & 1 deletion FScriptFramework/FSAssociation.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* FSAssociation.h Copyright (c) 2009 Philippe Mougin. */
/* This software is open source. See the license. */

#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>

@class FSBoolean;

Expand Down
17 changes: 16 additions & 1 deletion FScriptFramework/FSBlock.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import "ArrayPrivate.h"
#import <Foundation/Foundation.h>
#import "FSBooleanPrivate.h"
#import "BlockInspector.h"
#import "FScriptFunctions.h"
#import "FSNumber.h"
#import "FSVoid.h"
Expand All @@ -23,10 +22,16 @@
#import "FSReturnSignal.h"
#import "Block.h"

#if !TARGET_OS_IPHONE
# import "BlockInspector.h"
#endif

void __attribute__ ((constructor)) initializeFSBlock(void)
{
[NSKeyedUnarchiver setClass:[FSBlock class] forClassName:@"Block"];
#if !TARGET_OS_IPHONE
[NSUnarchiver decodeClassName:@"Block" asClassName:@"FSBlock"];
#endif
}


Expand Down Expand Up @@ -397,7 +402,9 @@ - (id) guardedValue:(id)arg1

- (void) inspect
{
#if !TARGET_OS_IPHONE
[[self inspector] activate];
#endif
}

- (id)onException:(FSBlock *)handler
Expand Down Expand Up @@ -807,11 +814,17 @@ - (void)evaluateWithDoubleFrom:(double)start to:(double)stop by:(double)step
}
}

#if TARGET_OS_IPHONE
- (id) inspector {
return nil;
}
#else
- (BlockInspector *)inspector
{
if (!inspector) inspector = [[BlockInspector alloc] initWithBlock:self];
return inspector;
}
#endif

- (SEL)messageToArgumentSelector
{
Expand Down Expand Up @@ -849,6 +862,7 @@ - (void) setNewRepAfterCompilation:(BlockRep*)newRep

- sync
{
#if !TARGET_OS_IPHONE
if ([inspector edited])
{
BlockRep * new = [blockRep copy];
Expand All @@ -859,6 +873,7 @@ - (void) setNewRepAfterCompilation:(BlockRep*)newRep
[blockRep useRetain];
[inspector setEdited:NO];
}
#endif
return self;
}

Expand Down
2 changes: 1 addition & 1 deletion FScriptFramework/FSBlockCompilationResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* This software is open source. See the license. */


#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>

enum FSBlockCompilationResultType {FSOKBlockCompilationResultType, FSErrorBlockCompilationResultType};

Expand Down
2 changes: 2 additions & 0 deletions FScriptFramework/FSBoolean.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ -(id)initWithCoder:(NSCoder *)coder {self = [super init]; return self;}

-(NSUInteger)hash {return self == fsTrue;}

#if !TARGET_OS_IPHONE
- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
{
if ([encoder isBycopy]) return self;
return [super replacementObjectForPortCoder:encoder];
}
#endif

-(void)release {}

Expand Down
2 changes: 1 addition & 1 deletion FScriptFramework/FSCNBase.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* FSCNBase.h Copyright (c) 2007-2009 Philippe Mougin. */
/* This software is open source. See the license. */

#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import "FSArray.h"
#import "FSMsgContext.h"

Expand Down
2 changes: 1 addition & 1 deletion FScriptFramework/FSClassDefinition.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* FSClassDefinition.h Copyright (c) 2008-2009 Philippe Mougin. */
/* This software is open source. See the license. */

#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>

@interface FSClassDefinition : NSObject
{
Expand Down
10 changes: 6 additions & 4 deletions FScriptFramework/FSCompiler.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#import "FSArray.h"
#import "FSBlock.h"
#import "MessagePatternCodeNode.h"
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import "FSSymbolTable.h"
#import <objc/objc.h> // sel_getName()
#import <objc/runtime.h>
Expand Down Expand Up @@ -1623,12 +1623,14 @@ - (NSString *)typeWithCompilationContext:(struct compilationContext)compilationC
else if ([typeBeforePointerMarks isEqualToString:@"double"]) encoded = @encode(double);
else if ([typeBeforePointerMarks isEqualToString:@"CGFloat"]) encoded = @encode(CGFloat);
else if ([typeBeforePointerMarks isEqualToString:@"NSRange"]) encoded = @encode(NSRange);
else if ([typeBeforePointerMarks isEqualToString:@"NSPoint"]) encoded = @encode(NSPoint);
else if ([typeBeforePointerMarks isEqualToString:@"CGPoint"]) encoded = @encode(CGPoint);
else if ([typeBeforePointerMarks isEqualToString:@"NSRect"]) encoded = @encode(NSRect);
else if ([typeBeforePointerMarks isEqualToString:@"CGRect"]) encoded = @encode(CGRect);
else if ([typeBeforePointerMarks isEqualToString:@"NSSize"]) encoded = @encode(NSSize);
else if ([typeBeforePointerMarks isEqualToString:@"CGSize"]) encoded = @encode(CGSize);
#if !TARGET_OS_IPHONE
else if ([typeBeforePointerMarks isEqualToString:@"NSPoint"]) encoded = @encode(NSPoint);
else if ([typeBeforePointerMarks isEqualToString:@"NSRect"]) encoded = @encode(NSRect);
else if ([typeBeforePointerMarks isEqualToString:@"NSSize"]) encoded = @encode(NSSize);
#endif
else if ([typeBeforePointerMarks isEqualToString:@"CGAffineTransform"]) encoded = @encode(CGAffineTransform);
else if (NSClassFromString(typeBeforePointerMarks) != nil || [typeBeforePointerMarks isEqualToString:compilationContext.className])
{
Expand Down
26 changes: 18 additions & 8 deletions FScriptFramework/FSConstantsInitialization.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
#import "FSConstantsInitialization.h"
#import "FSInterpreter.h"
#import "FSGenericPointerPrivate.h"
#import <CoreAudio/AudioHardware.h>
#import <IOBluetooth/OBEX.h>

#import <Cocoa/Cocoa.h>
#if !TARGET_OS_IPHONE
# import <AppKit/AppKit.h>
# import <CoreAudio/AudioHardware.h>
# import <IOBluetooth/OBEX.h>
#endif

#import <CoreData/CoreData.h>
#import <Foundation/Foundation.h>

void FSConstantsInitialization(NSMutableDictionary *d)
{
Expand All @@ -20,10 +25,6 @@ void FSConstantsInitialization(NSMutableDictionary *d)
[d addEntriesFromDictionary:[NSKeyedUnarchiver unarchiveObjectWithFile:path]];
}

if (NSMultipleValuesMarker) [d setObject:NSMultipleValuesMarker forKey:@"NSMultipleValuesMarker"];
if (NSNoSelectionMarker) [d setObject:NSNoSelectionMarker forKey:@"NSNoSelectionMarker"];
if (NSNotApplicableMarker) [d setObject:NSNotApplicableMarker forKey:@"NSNotApplicableMarker"];

if (NSErrorMergePolicy) [d setObject:NSErrorMergePolicy forKey:@"NSErrorMergePolicy"];
if (NSMergeByPropertyStoreTrumpMergePolicy) [d setObject:NSMergeByPropertyStoreTrumpMergePolicy forKey:@"NSMergeByPropertyStoreTrumpMergePolicy"];
if (NSMergeByPropertyObjectTrumpMergePolicy) [d setObject:NSMergeByPropertyObjectTrumpMergePolicy forKey:@"NSMergeByPropertyObjectTrumpMergePolicy"];
Expand All @@ -36,6 +37,11 @@ void FSConstantsInitialization(NSMutableDictionary *d)
[d setObject:[NSNumber numberWithUnsignedLong:NSUIntegerMax] forKey:@"NSUIntegerMax"];
[d setObject:[NSNumber numberWithLong:NSUndefinedDateComponent] forKey:@"NSUndefinedDateComponent"];

#if !TARGET_OS_IPHONE
if (NSMultipleValuesMarker) [d setObject:NSMultipleValuesMarker forKey:@"NSMultipleValuesMarker"];
if (NSNoSelectionMarker) [d setObject:NSNoSelectionMarker forKey:@"NSNoSelectionMarker"];
if (NSNotApplicableMarker) [d setObject:NSNotApplicableMarker forKey:@"NSNotApplicableMarker"];

#ifdef __LP64__
// 64-bit code
[d setObject:[[[FSGenericPointer alloc] initWithCPointer:(CGFloat *)NSFontIdentityMatrix freeWhenDone:NO type:"d"] autorelease] forKey:@"NSFontIdentityMatrix"];
Expand Down Expand Up @@ -74,6 +80,10 @@ void FSConstantsInitialization(NSMutableDictionary *d)
[d setObject:[NSValue valueWithPoint:NSZeroPoint] forKey:@"NSZeroPoint"];
[d setObject:[NSValue valueWithRect:NSZeroRect] forKey:@"NSZeroRect"];
[d setObject:[NSValue valueWithSize:NSZeroSize] forKey:@"NSZeroSize"];

#else
[d setObject:[NSValue valueWithCGPoint:CGPointZero] forKey:@"CGPointZero"];
[d setObject:[NSValue valueWithCGRect:CGRectZero] forKey:@"CGRectZero"];
[d setObject:[NSValue valueWithCGSize:CGSizeZero] forKey:@"CGSizeZero"];
#endif
// NSLog(@"constantsDictionary count = %lu", (unsigned long)[d count]);
}
8 changes: 5 additions & 3 deletions FScriptFramework/FSExecEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ union ObjCValue
float floatValue;
double doubleValue;
NSRange NSRangeValue;
NSSize NSSizeValue;
CGSize CGSizeValue;
NSPoint NSPointValue;
CGPoint CGPointValue;
NSRect NSRectValue;
CGRect CGRectValue;
#if !TARGET_OS_IPHONE
NSSize NSSizeValue;
NSPoint NSPointValue;
NSRect NSRectValue;
#endif
CGAffineTransform CGAffineTransformValue;
void * voidPtrValue;
};
Expand Down
Loading