Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
l4u committed Mar 23, 2012
0 parents commit ba2fd42
Show file tree
Hide file tree
Showing 42 changed files with 3,410 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Info.plist
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>Voronoi</string>
<key>CFBundleExecutable</key>
<string>Voronoi</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.psellos.Voronoi</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Voronoi</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string>Voronoi</string>
</dict>
</plist>
3 changes: 3 additions & 0 deletions MDepend
@@ -0,0 +1,3 @@
ViewDelegator.o: ViewDelegator.m ViewDelegator.h
main.o: main.m
wrap.o: wrap.m ViewDelegator.h wrap.h
47 changes: 47 additions & 0 deletions MLDepend
@@ -0,0 +1,47 @@
bzpdata.cmo: cocoa.cmi bzpdata.cmi
bzpdata.cmx: cocoa.cmx bzpdata.cmi
bzpdraw.cmo: uiBezierPath.cmi cocoa.cmi bzpdraw.cmi
bzpdraw.cmx: uiBezierPath.cmx cocoa.cmx bzpdraw.cmi
cocoa.cmo: cocoa.cmi
cocoa.cmx: cocoa.cmi
colorfield.cmo: uiKit.cmi uiBezierPath.cmi cocoa.cmi bzpdata.cmi \
colorfield.cmi
colorfield.cmx: uiKit.cmx uiBezierPath.cmx cocoa.cmx bzpdata.cmx \
colorfield.cmi
uiActionSheet.cmo: wrapper.cmi uiView.cmi uiActionSheet.cmi
uiActionSheet.cmx: wrapper.cmx uiView.cmx uiActionSheet.cmi
uiApplication.cmo: wrapper.cmi uiApplication.cmi
uiApplication.cmx: wrapper.cmx uiApplication.cmi
uiBezierPath.cmo: wrapper.cmi cocoa.cmi uiBezierPath.cmi
uiBezierPath.cmx: wrapper.cmx cocoa.cmx uiBezierPath.cmi
uiFont.cmo: wrapper.cmi uiFont.cmi
uiFont.cmx: wrapper.cmx uiFont.cmi
uiKit.cmo: uiFont.cmi cocoa.cmi uiKit.cmi
uiKit.cmx: uiFont.cmx cocoa.cmx uiKit.cmi
uiView.cmo: wrapper.cmi cocoa.cmi uiView.cmi
uiView.cmx: wrapper.cmx cocoa.cmx uiView.cmi
vorocells.cmo: cocoa.cmi vorocells.cmi
vorocells.cmx: cocoa.cmx vorocells.cmi
voronoictlr.cmo: wrappee.cmi vorocells.cmi uiView.cmi uiKit.cmi \
uiBezierPath.cmi uiApplication.cmi uiActionSheet.cmi colorfield.cmi \
cocoa.cmi bzpdraw.cmi bzpdata.cmi
voronoictlr.cmx: wrappee.cmx vorocells.cmx uiView.cmx uiKit.cmx \
uiBezierPath.cmx uiApplication.cmx uiActionSheet.cmx colorfield.cmx \
cocoa.cmx bzpdraw.cmx bzpdata.cmx
wrappee.cmo: wrappee.cmi
wrappee.cmx: wrappee.cmi
wrapper.cmo: wrapper.cmi
wrapper.cmx: wrapper.cmi
bzpdata.cmi: cocoa.cmi
bzpdraw.cmi: uiBezierPath.cmi cocoa.cmi
cocoa.cmi:
colorfield.cmi: uiKit.cmi cocoa.cmi
uiActionSheet.cmi: wrapper.cmi uiView.cmi
uiApplication.cmi: wrapper.cmi
uiBezierPath.cmi: wrapper.cmi cocoa.cmi
uiFont.cmi: wrapper.cmi
uiKit.cmi: uiFont.cmi cocoa.cmi
uiView.cmi: wrapper.cmi cocoa.cmi
vorocells.cmi: cocoa.cmi
wrappee.cmi:
wrapper.cmi:
59 changes: 59 additions & 0 deletions Makefile
@@ -0,0 +1,59 @@
PLAT = /Developer/Platforms/iPhoneSimulator.platform
SDK = /Developer/SDKs/iPhoneSimulator4.2.sdk
PLATAPPS = $(PLAT)/Developer/Applications
OCAMLDIR = /usr/local/ocamlxsim
OCAMLBINDIR = $(OCAMLDIR)/bin/
CC = $(PLAT)/Developer/usr/bin/gcc-4.2
CFLAGS = -arch i386 -isysroot $(PLAT)$(SDK) -gdwarf-2 \
-D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 \
-isystem $(OCAMLDIR)/lib/ocaml -DCAML_NAME_SPACE
MFLAGS = -fobjc-legacy-dispatch -fobjc-abi-version=2
LDFLAGS = -Xlinker -objc_abi_version -Xlinker 2

MOBS = ViewDelegator.o wrap.o main.o
MLOBS = wrapper.cmx wrappee.cmx cocoa.cmx uiKit.cmx uiFont.cmx \
uiBezierPath.cmx uiView.cmx uiActionSheet.cmx uiApplication.cmx \
bzpdata.cmx bzpdraw.cmx colorfield.cmx vorocells.cmx voronoictlr.cmx

all: Voronoi Voronoi.nib Info.plist PkgInfo

Voronoi: $(MOBS) $(MLOBS)
$(OCAMLBINDIR)ocamlopt -cc '$(CC)' -ccopt '$(CFLAGS)' \
-cclib '$(LDFLAGS)' \
-o Voronoi \
$(MOBS) $(MLOBS) \
-cclib '-framework UIKit' \
-cclib '-framework Foundation'

execute: all
$(PLATAPPS)/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator \
-SimulateApplication Voronoi &

Voronoi.nib: Voronoi.xib
ibtool --compile Voronoi.nib Voronoi.xib


PkgInfo:
echo -n 'APPL????' > PkgInfo

clean:
rm -rf Voronoi Voronoi.nib PkgInfo build *.o *.cm[iox]

%.o: %.m
$(CC) $(CFLAGS) $(MFLAGS) -c $<

%.cmi: %.mli
$(OCAMLBINDIR)ocamlc -c $<

%.cmo: %.ml
$(OCAMLBINDIR)ocamlc -c $<

%.cmx: %.ml
$(OCAMLBINDIR)ocamlopt -cc '$(CC)' -ccopt '$(CFLAGS)' -c $<

depend::
$(OCAMLBINDIR)ocamldep *.ml *.mli > MLDepend
$(CC) $(CFLAGS) -MM *.m > MDepend

-include MLDepend
-include MDepend
48 changes: 48 additions & 0 deletions ViewDelegator.h
@@ -0,0 +1,48 @@
/* ViewDelegator.h UIView subclass to delegate touches, motions, and
* drawRect:
*
* Copyright (c) 2011 Psellos http://psellos.com
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*/

/* Protocol for the delegate.
*/
@protocol ViewDelegate
@optional
- (BOOL) viewCanBecomeFirstResponder: (UIView *) view;

- (void) view: (UIView *) view
touchesBegan: (NSSet *) touches
withEvent: (UIEvent *) event;
- (void) view: (UIView *) view
touchesCancelled: (NSSet *) touches
withEvent: (UIEvent *) event;
- (void) view: (UIView *) view
touchesEnded: (NSSet *) touches
withEvent: (UIEvent *) event;
- (void) view: (UIView *) view
touchesMoved: (NSSet *) touches
withEvent: (UIEvent *) event;

- (void) view: (UIView *) view
motionBegan: (UIEventSubtype) motion
withEvent: (UIEvent *) event;
- (void) view: (UIView *) view
motionCancelled: (UIEventSubtype) motion
withEvent: (UIEvent *) event;
- (void) view: (UIView *) view
motionEnded: (UIEventSubtype) motion
withEvent: (UIEvent *) event;

- (void) view: (UIView *) view drawRect: (CGRect) rect;
@end

/* Interface for the delegator.
*/
@interface ViewDelegator : UIView
{
NSObject<ViewDelegate> *delegate;
}
@property(nonatomic, assign) IBOutlet NSObject<ViewDelegate> *delegate;
@end
93 changes: 93 additions & 0 deletions ViewDelegator.m
@@ -0,0 +1,93 @@
/* ViewDelegator.m UIView subclass to delegate touches, motions, and
* drawRect:
*
* Copyright (c) 2011 Psellos http://psellos.com
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* This code is logically a small extension of Cocoa Touch. It doesn't
* need to know anything about OCaml.
*/
#import <UIKit/UIKit.h>

#import "ViewDelegator.h"

@implementation ViewDelegator

@dynamic delegate;

- (NSObject<ViewDelegate> *) delegate
{
return delegate;
}


- (void) setDelegate: (NSObject<ViewDelegate> *) aDelegate
{
delegate = aDelegate;
}

- (BOOL) canBecomeFirstResponder
{
if([delegate respondsToSelector: @selector(viewCanBecomeFirstResponder:)])
return [delegate viewCanBecomeFirstResponder: self];
return [super canBecomeFirstResponder];
}

- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
if([delegate respondsToSelector: @selector(view:touchesBegan:withEvent:)])
[delegate view: self touchesBegan: touches withEvent: event];
}


- (void) touchesMoved: (NSSet *) touches withEvent: (UIEvent *) event
{
if([delegate respondsToSelector: @selector(view:touchesMoved:withEvent:)])
[delegate view: self touchesMoved: touches withEvent: event];
}


- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
if([delegate respondsToSelector: @selector(view:touchesEnded:withEvent:)])
[delegate view: self touchesEnded: touches withEvent: event];
}


- (void) touchesCancelled: (NSSet *) touches withEvent: (UIEvent *) event
{
if([delegate respondsToSelector:
@selector(view:touchesCancelled:withEvent:)])
[delegate view: self touchesCancelled: touches withEvent: event];
}


- (void) motionBegan: (UIEventSubtype) motion withEvent: (UIEvent *) event
{
if([delegate respondsToSelector: @selector(view:motionBegan:withEvent:)])
[delegate view: self motionBegan: motion withEvent: event];
}


- (void) motionCancelled: (UIEventSubtype) motion withEvent: (UIEvent *) event
{
if([delegate respondsToSelector:
@selector(view:motionCancelled:withEvent:)])
[delegate view: self motionCancelled: motion withEvent: event];
}


- (void) motionEnded: (UIEventSubtype) motion withEvent: (UIEvent *) event
{
if([delegate respondsToSelector: @selector(view:motionEnded:withEvent:)])
[delegate view: self motionEnded: motion withEvent: event];
}


- (void) drawRect: (CGRect) rect
{
if([delegate respondsToSelector: @selector(view:drawRect:)])
[delegate view: self drawRect: rect];
}
@end
80 changes: 80 additions & 0 deletions Voronoi.xcodeproj/project.pbxproj
@@ -0,0 +1,80 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {

/* Begin PBXFileReference section */
1AB4C0E813A81D82006FC1F5 /* Voronoi.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Voronoi.xib; sourceTree = "<group>"; };
1AB4C0E913A81F7A006FC1F5 /* ViewDelegator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewDelegator.h; sourceTree = "<group>"; };
1AB4C0EA13A81F7A006FC1F5 /* ViewDelegator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewDelegator.m; sourceTree = "<group>"; };
1AB4C0EB13A82441006FC1F5 /* wrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wrap.h; sourceTree = "<group>"; };
1AB4C0EC13A82441006FC1F5 /* wrap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = wrap.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXGroup section */
1AB4C0DF13A81B48006FC1F5 = {
isa = PBXGroup;
children = (
1AB4C0E813A81D82006FC1F5 /* Voronoi.xib */,
1AB4C0EB13A82441006FC1F5 /* wrap.h */,
1AB4C0EC13A82441006FC1F5 /* wrap.m */,
1AB4C0E913A81F7A006FC1F5 /* ViewDelegator.h */,
1AB4C0EA13A81F7A006FC1F5 /* ViewDelegator.m */,
);
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXProject section */
1AB4C0E113A81B48006FC1F5 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = 1AB4C0E413A81B48006FC1F5 /* Build configuration list for PBXProject "Voronoi" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 1AB4C0DF13A81B48006FC1F5;
projectDirPath = "";
projectRoot = "";
targets = (
);
};
/* End PBXProject section */

/* Begin XCBuildConfiguration section */
1AB4C0E613A81B48006FC1F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Debug;
};
1AB4C0E713A81B48006FC1F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
1AB4C0E413A81B48006FC1F5 /* Build configuration list for PBXProject "Voronoi" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1AB4C0E613A81B48006FC1F5 /* Debug */,
1AB4C0E713A81B48006FC1F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1AB4C0E113A81B48006FC1F5 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

0 comments on commit ba2fd42

Please sign in to comment.