Update examples

This commit is contained in:
Don Stewart
2005-09-03 04:45:14 +00:00
parent 5321754614
commit dff0363224
421 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,30 @@
module ArithmeticExpressionParser where
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Expr
resource :: String -> IO String
resource text = do
parsedText <- mapM parseString (lines text)
return (unlines parsedText)
parseString s = do
case (parse expr "" s) of
Left err -> return ("Error " ++ show err)
Right num -> return (show num)
expr :: Parser Integer
expr = buildExpressionParser table factor <?> "expression"
table = [ [op "*" (*) AssocLeft, op "/" div AssocLeft]
, [op "+" (+) AssocLeft, op "-" (-) AssocLeft] ]
where
op s f assoc = Infix (do { string s; return f }) assoc
factor = do { char '('; x <- expr; char ')'; return x }
<|> number
<?> "simple expression"
number :: Parser Integer
number = do { ds <- many1 digit; return (read ds) } <?> "number"

View File

@ -0,0 +1,29 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}

View File

@ -0,0 +1,4 @@
{
IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; });
IBVersion = 1;
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>116 123 356 240 0 0 1600 1178 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>117 405 318 44 0 0 1600 1178 </string>
</dict>
<key>IBFramework Version</key>
<string>328.0</string>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>7B8</string>
</dict>
</plist>

View File

@ -0,0 +1,13 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {chooseParser = id; evaluateExpression = id; };
CLASS = MyDocument;
LANGUAGE = ObjC;
OUTLETS = {evaluation = id; expressionEntry = id; parser = id; };
SUPERCLASS = NSDocument;
}
);
IBVersion = 1;
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>79 43 356 240 0 0 1280 832 </string>
<key>IBFramework Version</key>
<string>349.0</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>7F44</string>
</dict>
</plist>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>????</string>
</array>
<key>CFBundleTypeIconFile</key>
<string></string>
<key>CFBundleTypeName</key>
<string>DocumentType</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>????</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>MyDocument</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>PluginExpressionParser</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.apple.yourCocoaDocApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.1</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,33 @@
module KeyValueParser where
import Text.ParserCombinators.Parsec
parseKeyValue = do
key <- parseKey
char '='
value <- parseValue
return (key, value)
parseKey = many1 letter
parseValue =
do
openQuote <- char '"' <|> char '\''
value <- many1 letter
char openQuote
return value
<|>
do
value <- many1 letter
return value
parseString s = do
case (parse parseKeyValue "" s) of
Left err -> return ("Error " ++ show err)
Right (key, value) -> return ("Key: " ++ key ++ ", Value: " ++ value)
resource :: String -> IO String
resource text = do
parsedText <- mapM parseString (lines text)
return (unlines parsedText)

View File

@ -0,0 +1,67 @@
APP_DIR = build/PluginExpressionParser.app
APP_CONTENTS_DIR = $(APP_DIR)/Contents
APP_ARCH_EXEC_DIR = $(APP_CONTENTS_DIR)/MacOS
APP_RESOURCES_DIR = $(APP_CONTENTS_DIR)/Resources
EXECUTABLE = $(APP_ARCH_EXEC_DIR)/PluginExpressionParser
OBJECT_FILES = main.o MyDocument.o PluginEvalAux.o
BUILD_OBJECT_FILES = $(addprefix build/,$(OBJECT_FILES)) \
build/PluginEvalAux_stub.o
HOST = $(shell uname)
ifeq ($(HOST),Darwin)
default: app
else
default: no_app
endif
app: $(APP_CONTENTS_DIR) $(APP_RESOURCES_DIR) $(EXECUTABLE)
#
$(EXECUTABLE): $(APP_ARCH_EXEC_DIR) $(BUILD_OBJECT_FILES)
ghc \
-o "$(EXECUTABLE)" \
-framework Cocoa \
-package-conf ../../../plugins.conf.inplace \
-package plugins \
-no-hs-main \
$(BUILD_OBJECT_FILES)
build/MyDocument.o: MyDocument.m MyDocument.h
gcc -c -o "$@" -Wall -I`ghc --print-libdir`/include "$<"
build/main.o: main.m
gcc -c -o "$@" -Wall -I`ghc --print-libdir`/include "$<"
build/PluginEvalAux.o: PluginEvalAux.hs
ghc --make \
-package-conf ../../../plugins.conf.inplace \
-package plugins \
-odir build/ \
-hidir build/ \
"$<"
#
$(APP_DIR):
mkdir -p "$@"
$(APP_ARCH_EXEC_DIR): $(APP_DIR)
mkdir -p "$@"
$(APP_CONTENTS_DIR): $(APP_DIR) Info.plist
mkdir -p "$(APP_CONTENTS_DIR)"
cp Info.plist "$@"
echo -n 'APPL????' > "$@"/PkgInfo
$(APP_RESOURCES_DIR): $(APP_DIR) English.lproj
mkdir -p "$(APP_RESOURCES_DIR)"
cp -R English.lproj "$@"
#
clean:
-rm -rf build *_stub.?

View File

@ -0,0 +1,16 @@
/* MyDocument */
#import <Cocoa/Cocoa.h>
#include "RunHaskell.h"
@interface MyDocument : NSDocument
{
IBOutlet id evaluation;
IBOutlet id expressionEntry;
IBOutlet id parser;
}
- (IBAction)chooseParser:(id)sender;
- (IBAction)evaluateExpression:(id)sender;
@end

View File

@ -0,0 +1,52 @@
#import "MyDocument.h"
@implementation MyDocument
- (NSString *)windowNibName {
return @"MyDocument";
}
- (NSData *)dataRepresentationOfType:(NSString *)type {
return nil;
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type {
return NO;
}
- (IBAction)chooseParser:(id)sender
{
int result;
NSArray *fileTypes = [NSArray arrayWithObject:@"hs"];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
result = [oPanel runModalForDirectory:nil file:nil types:fileTypes];
if (result == NSOKButton)
{
NSArray *filesToOpen = [oPanel filenames];
[parser setStringValue:[filesToOpen objectAtIndex:0]];
}
}
- (IBAction)evaluateExpression:(id)sender
{
NSLog(@"evaluateExpression");
NSString *filePathNSS = [parser stringValue];
char *filePath = [filePathNSS cString];
NSString *expressionNSS = [[expressionEntry textStorage] string];
char *expression = [expressionNSS cString];
NSLog (@"filePath:%s expression:%s", filePath, expression);
char *result = evalhaskell_CString(filePath, expression);
NSString *resultNSS = [NSString stringWithCString:result];
NSAttributedString *resultNSAS = [[NSAttributedString alloc]
initWithString:resultNSS
attributes:nil];
[[evaluation textStorage] setAttributedString:resultNSAS];
}
@end

View File

@ -0,0 +1,43 @@
{-# OPTIONS -fglasgow-exts -fffi #-}
module PluginEvalAux where
import System.Plugins.Make
import System.Plugins.Load
import System.Plugins.Utils
import Foreign.C
import Control.Exception ( evaluate )
import System.IO
import System.Directory ( renameFile, removeFile )
symbol = "resource"
evalWithStringResult :: FilePath -> String -> IO String
evalWithStringResult srcFile s = do
status <- make srcFile ["-Onot"]
case status of
MakeFailure err -> putStrLn "error occured" >> return (show err)
MakeSuccess _ obj -> load' obj
where
load' obj = do
loadResult <- load obj [] [] symbol
case loadResult of
LoadFailure errs -> putStrLn "load error" >> return (show errs)
LoadSuccess m (rsrc :: String -> IO String) -> do
v' <- rsrc s
unload m
mapM_ removeFile [ obj, replaceSuffix obj ".hi" ]
return v'
foreign export ccall evalhaskell_CString :: CString -> CString -> IO CString
evalhaskell_CString :: CString -> CString -> IO CString
evalhaskell_CString filePathCS sCS = do
s <- peekCString sCS
filePath <- peekCString filePathCS
retval <- evalWithStringResult filePath s
newCString retval
-- vi:sw=2 sts=2

View File

@ -0,0 +1,602 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 39;
objects = {
089C165FFE840EACC02AAC07 = {
children = (
089C1660FE840EACC02AAC07,
);
isa = PBXVariantGroup;
name = InfoPlist.strings;
refType = 4;
sourceTree = "<group>";
};
089C1660FE840EACC02AAC07 = {
fileEncoding = 10;
isa = PBXFileReference;
lastKnownFileType = text.plist.strings;
name = English;
path = English.lproj/InfoPlist.strings;
refType = 4;
sourceTree = "<group>";
};
//080
//081
//082
//083
//084
//100
//101
//102
//103
//104
1058C7A6FEA54F5311CA2CBB = {
children = (
1058C7A7FEA54F5311CA2CBB,
);
isa = PBXGroup;
name = "Linked Frameworks";
refType = 4;
sourceTree = "<group>";
};
1058C7A7FEA54F5311CA2CBB = {
fallbackIsa = PBXFileReference;
isa = PBXFrameworkReference;
lastKnownFileType = wrapper.framework;
name = Cocoa.framework;
path = /System/Library/Frameworks/Cocoa.framework;
refType = 0;
sourceTree = "<absolute>";
};
1058C7A8FEA54F5311CA2CBB = {
children = (
2A37F4C5FDCFA73011CA2CEA,
2A37F4C4FDCFA73011CA2CEA,
);
isa = PBXGroup;
name = "Other Frameworks";
refType = 4;
sourceTree = "<group>";
};
//100
//101
//102
//103
//104
//190
//191
//192
//193
//194
19C28FB0FE9D524F11CA2CBB = {
children = (
8D15AC370486D014006FF6A4,
);
isa = PBXGroup;
name = Products;
refType = 4;
sourceTree = "<group>";
};
//190
//191
//192
//193
//194
//2A0
//2A1
//2A2
//2A3
//2A4
2A37F4A9FDCFA73011CA2CEA = {
buildSettings = {
};
buildStyles = (
4A9504D0FFE6A4CB11CA0CBA,
4A9504D1FFE6A4CB11CA0CBA,
);
hasScannedForEncodings = 1;
isa = PBXProject;
mainGroup = 2A37F4AAFDCFA73011CA2CEA;
projectDirPath = "";
targets = (
8D15AC270486D014006FF6A4,
7B5F81A4067389B000AC9FA4,
);
};
2A37F4AAFDCFA73011CA2CEA = {
children = (
7B5F81A1067383A700AC9FA4,
7B5F81980673839D00AC9FA4,
2A37F4ABFDCFA73011CA2CEA,
2A37F4AFFDCFA73011CA2CEA,
2A37F4B8FDCFA73011CA2CEA,
2A37F4C3FDCFA73011CA2CEA,
19C28FB0FE9D524F11CA2CBB,
);
isa = PBXGroup;
name = PluginExpressionParser;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4ABFDCFA73011CA2CEA = {
children = (
2A37F4AEFDCFA73011CA2CEA,
2A37F4ACFDCFA73011CA2CEA,
);
isa = PBXGroup;
name = Classes;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4ACFDCFA73011CA2CEA = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
path = MyDocument.m;
refType = 4;
sourceTree = "<group>";
};
2A37F4AEFDCFA73011CA2CEA = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
path = MyDocument.h;
refType = 4;
sourceTree = "<group>";
};
2A37F4AFFDCFA73011CA2CEA = {
children = (
7B5F81990673839D00AC9FA4,
32DBCF750370BD2300C91783,
7B5F819506737AAC00AC9FA4,
2A37F4B0FDCFA73011CA2CEA,
);
isa = PBXGroup;
name = "Other Sources";
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4B0FDCFA73011CA2CEA = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
path = main.m;
refType = 4;
sourceTree = "<group>";
};
2A37F4B4FDCFA73011CA2CEA = {
children = (
2A37F4B5FDCFA73011CA2CEA,
);
isa = PBXVariantGroup;
name = MyDocument.nib;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4B5FDCFA73011CA2CEA = {
isa = PBXFileReference;
lastKnownFileType = wrapper.nib;
name = English;
path = English.lproj/MyDocument.nib;
refType = 4;
sourceTree = "<group>";
};
2A37F4B6FDCFA73011CA2CEA = {
children = (
2A37F4B7FDCFA73011CA2CEA,
);
isa = PBXVariantGroup;
name = MainMenu.nib;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4B7FDCFA73011CA2CEA = {
isa = PBXFileReference;
lastKnownFileType = wrapper.nib;
name = English;
path = English.lproj/MainMenu.nib;
refType = 4;
sourceTree = "<group>";
};
2A37F4B8FDCFA73011CA2CEA = {
children = (
2A37F4B9FDCFA73011CA2CEA,
2A37F4B6FDCFA73011CA2CEA,
2A37F4B4FDCFA73011CA2CEA,
8D15AC360486D014006FF6A4,
089C165FFE840EACC02AAC07,
);
isa = PBXGroup;
name = Resources;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4B9FDCFA73011CA2CEA = {
children = (
2A37F4BAFDCFA73011CA2CEA,
);
isa = PBXVariantGroup;
name = Credits.rtf;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4BAFDCFA73011CA2CEA = {
isa = PBXFileReference;
lastKnownFileType = text.rtf;
name = English;
path = English.lproj/Credits.rtf;
refType = 4;
sourceTree = "<group>";
};
2A37F4C3FDCFA73011CA2CEA = {
children = (
1058C7A6FEA54F5311CA2CBB,
1058C7A8FEA54F5311CA2CBB,
);
isa = PBXGroup;
name = Frameworks;
path = "";
refType = 4;
sourceTree = "<group>";
};
2A37F4C4FDCFA73011CA2CEA = {
fallbackIsa = PBXFileReference;
isa = PBXFrameworkReference;
lastKnownFileType = wrapper.framework;
name = AppKit.framework;
path = /System/Library/Frameworks/AppKit.framework;
refType = 0;
sourceTree = "<absolute>";
};
2A37F4C5FDCFA73011CA2CEA = {
fallbackIsa = PBXFileReference;
isa = PBXFrameworkReference;
lastKnownFileType = wrapper.framework;
name = Foundation.framework;
path = /System/Library/Frameworks/Foundation.framework;
refType = 0;
sourceTree = "<absolute>";
};
//2A0
//2A1
//2A2
//2A3
//2A4
//320
//321
//322
//323
//324
32DBCF750370BD2300C91783 = {
fileEncoding = 4;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
path = PluginExpressionParser_Prefix.pch;
refType = 4;
sourceTree = "<group>";
};
//320
//321
//322
//323
//324
//4A0
//4A1
//4A2
//4A3
//4A4
4A9504D0FFE6A4CB11CA0CBA = {
buildRules = (
);
buildSettings = {
COPY_PHASE_STRIP = NO;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
OPTIMIZATION_CFLAGS = "-O0";
ZERO_LINK = YES;
};
isa = PBXBuildStyle;
name = Development;
};
4A9504D1FFE6A4CB11CA0CBA = {
buildRules = (
);
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
ZERO_LINK = NO;
};
isa = PBXBuildStyle;
name = Deployment;
};
//4A0
//4A1
//4A2
//4A3
//4A4
//7B0
//7B1
//7B2
//7B3
//7B4
7B5F819506737AAC00AC9FA4 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
path = RunHaskell.h;
refType = 4;
sourceTree = "<group>";
};
7B5F819606737AAC00AC9FA4 = {
fileRef = 7B5F819506737AAC00AC9FA4;
isa = PBXBuildFile;
settings = {
};
};
7B5F81970673839D00AC9FA4 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.haskell;
path = KeyValueParser.hs;
refType = 4;
sourceTree = "<group>";
};
7B5F81980673839D00AC9FA4 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.make;
path = Makefile;
refType = 4;
sourceTree = "<group>";
};
7B5F81990673839D00AC9FA4 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.haskell;
path = PluginEvalAux.hs;
refType = 4;
sourceTree = "<group>";
};
7B5F819A0673839D00AC9FA4 = {
fileRef = 7B5F81970673839D00AC9FA4;
isa = PBXBuildFile;
settings = {
};
};
7B5F819B0673839D00AC9FA4 = {
fileRef = 7B5F81980673839D00AC9FA4;
isa = PBXBuildFile;
settings = {
};
};
7B5F819C0673839D00AC9FA4 = {
fileRef = 7B5F81990673839D00AC9FA4;
isa = PBXBuildFile;
settings = {
};
};
7B5F819D067383A400AC9FA4 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.haskell;
path = ArithmeticExpressionParser.hs;
refType = 4;
sourceTree = "<group>";
};
7B5F819E067383A400AC9FA4 = {
fileRef = 7B5F819D067383A400AC9FA4;
isa = PBXBuildFile;
settings = {
};
};
7B5F81A1067383A700AC9FA4 = {
children = (
7B5F819D067383A400AC9FA4,
7B5F81970673839D00AC9FA4,
);
isa = PBXGroup;
name = Parsers;
refType = 4;
sourceTree = "<group>";
};
7B5F81A4067389B000AC9FA4 = {
buildArgumentsString = "$(ACTION)";
buildPhases = (
);
buildSettings = {
OPTIMIZATION_CFLAGS = "";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = "PluginExpressionParser (GNU make)";
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
};
buildToolPath = /usr/bin/make;
dependencies = (
);
isa = PBXLegacyTarget;
name = "PluginExpressionParser (GNU make)";
passBuildSettingsInEnvironment = 1;
productName = "PluginExpressionParser (GNU make)";
};
//7B0
//7B1
//7B2
//7B3
//7B4
//8D0
//8D1
//8D2
//8D3
//8D4
8D15AC270486D014006FF6A4 = {
buildPhases = (
8D15AC280486D014006FF6A4,
8D15AC2B0486D014006FF6A4,
8D15AC300486D014006FF6A4,
8D15AC330486D014006FF6A4,
);
buildRules = (
);
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "";
GCC_ENABLE_TRIGRAPHS = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = PluginExpressionParser_Prefix.pch;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = PluginExpressionParser;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
WRAPPER_EXTENSION = app;
};
dependencies = (
);
isa = PBXNativeTarget;
name = PluginExpressionParser;
productInstallPath = "$(HOME)/Applications";
productName = PluginExpressionParser;
productReference = 8D15AC370486D014006FF6A4;
productType = "com.apple.product-type.application";
};
8D15AC280486D014006FF6A4 = {
buildActionMask = 2147483647;
files = (
8D15AC290486D014006FF6A4,
8D15AC2A0486D014006FF6A4,
7B5F819606737AAC00AC9FA4,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
8D15AC290486D014006FF6A4 = {
fileRef = 32DBCF750370BD2300C91783;
isa = PBXBuildFile;
settings = {
};
};
8D15AC2A0486D014006FF6A4 = {
fileRef = 2A37F4AEFDCFA73011CA2CEA;
isa = PBXBuildFile;
settings = {
};
};
8D15AC2B0486D014006FF6A4 = {
buildActionMask = 2147483647;
files = (
8D15AC2C0486D014006FF6A4,
8D15AC2D0486D014006FF6A4,
8D15AC2E0486D014006FF6A4,
8D15AC2F0486D014006FF6A4,
7B5F819A0673839D00AC9FA4,
7B5F819B0673839D00AC9FA4,
7B5F819C0673839D00AC9FA4,
7B5F819E067383A400AC9FA4,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
8D15AC2C0486D014006FF6A4 = {
fileRef = 2A37F4B9FDCFA73011CA2CEA;
isa = PBXBuildFile;
settings = {
};
};
8D15AC2D0486D014006FF6A4 = {
fileRef = 2A37F4B6FDCFA73011CA2CEA;
isa = PBXBuildFile;
settings = {
};
};
8D15AC2E0486D014006FF6A4 = {
fileRef = 2A37F4B4FDCFA73011CA2CEA;
isa = PBXBuildFile;
settings = {
};
};
8D15AC2F0486D014006FF6A4 = {
fileRef = 089C165FFE840EACC02AAC07;
isa = PBXBuildFile;
settings = {
};
};
8D15AC300486D014006FF6A4 = {
buildActionMask = 2147483647;
files = (
8D15AC310486D014006FF6A4,
8D15AC320486D014006FF6A4,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
8D15AC310486D014006FF6A4 = {
fileRef = 2A37F4ACFDCFA73011CA2CEA;
isa = PBXBuildFile;
settings = {
ATTRIBUTES = (
);
};
};
8D15AC320486D014006FF6A4 = {
fileRef = 2A37F4B0FDCFA73011CA2CEA;
isa = PBXBuildFile;
settings = {
ATTRIBUTES = (
);
};
};
8D15AC330486D014006FF6A4 = {
buildActionMask = 2147483647;
files = (
8D15AC340486D014006FF6A4,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
8D15AC340486D014006FF6A4 = {
fileRef = 1058C7A7FEA54F5311CA2CBB;
isa = PBXBuildFile;
settings = {
};
};
8D15AC360486D014006FF6A4 = {
fileEncoding = 4;
isa = PBXFileReference;
lastKnownFileType = text.plist;
path = Info.plist;
refType = 4;
sourceTree = "<group>";
};
8D15AC370486D014006FF6A4 = {
explicitFileType = wrapper.application;
includeInIndex = 0;
isa = PBXFileReference;
path = PluginExpressionParser.app;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
};
rootObject = 2A37F4A9FDCFA73011CA2CEA;
}

View File

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'PluginExpressionParser' target in the 'PluginExpressionParser' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -0,0 +1,6 @@
This little application is an example of using hs-plugins to embed a Haskell
'interpreter' inside an Objective-C, Cocoa-based program. You will need Mac OS
X for this to be of any use!
To build it, type 'make', which will build a .app bundle in the build/ directory. Or, 'open *.xcode', and hit the build button in there.

View File

@ -0,0 +1,4 @@
#include "HsFFI.h"
extern HsPtr evalhaskell_CString(HsPtr a1, HsPtr a2);

View File

@ -0,0 +1,26 @@
//
// main.m
// PluginExpressionParser
//
// Created by Andr<EFBFBD> Pang on Mon Jun 07 2004.
// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#include "HsFFI.h"
extern void __stginit_PluginEvalAux (void);
int main(int argc, char *argv[])
{
hs_init(&argc, &argv);
hs_add_root(__stginit_PluginEvalAux);
const char *c_argv = (const char *) argv;
int retval = NSApplicationMain(argc, &c_argv);
hs_exit();
return retval;
}
/* vi:sw=4 */

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildVersion</key>
<string>17</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleVersion</key>
<string>0.1</string>
<key>ProjectName</key>
<string>NibPBTemplates</string>
<key>SourceVersion</key>
<string>1150000</string>
</dict>
</plist>