packages feed

language-c-inline 0.3.0.0 → 0.3.0.1

raw patch · 4 files changed

+50/−4 lines, 4 files

Files

README.md view
@@ -6,7 +6,14 @@ Building -------- -To build the library, just use `cabal install` as usual. To build the proof of concept example, do the following+To build the library, just use `cabal install` as usual from the source code directory or by installing from Hackage.++You may like to have a look at a [minimal example](blob/master/tests/objc/minimal/Main.hs) of its use, which you can build as follows:++* Execute `cd tests/objc/minimal; make`.+* Now run the demo executable with `./Minimal`.++To build the proof of concept example, do the following:  * Execute `cd tests/objc/concept; make`. * Now run the demo executable with `./InlineObjC`.
language-c-inline.cabal view
@@ -1,5 +1,5 @@ Name:                   language-c-inline-Version:                0.3.0.0+Version:                0.3.0.1 Cabal-version:          >= 1.9.2 Tested-with:            GHC == 7.6.3 Build-type:             Simple@@ -9,8 +9,8 @@                         quasi-quotation. In particular, it enables the use of foreign libraries                         without a dedicated bridge or binding. Here is a tiny example:                         .-                        > log :: String -> IO ()-                        > log msg = $(objc 'msg [cexp| NSLog (@"Here is a message from Haskell: %@", msg) |])+                        > nslog :: String -> IO ()+                        > nslog msg = $(objc ['msg] ''() [cexp| NSLog(@"Here is a message from Haskell: %@", msg) |])                         .                         For more information, see <https://github.com/mchakravarty/language-c-inline/wiki>.                         .@@ -47,6 +47,8 @@                         tests/objc/app/HSApp.app/Contents/Resources/en.lproj/Credits.rtf                         tests/objc/app/HSApp.app/Contents/Resources/en.lproj/InfoPlist.strings                         tests/objc/app/HSApp.app/Contents/Resources/en.lproj/MainMenu.nib+                        tests/objc/minimal/Makefile+                        tests/objc/minimal/Main.hs  Source-repository head   Type:                 git
+ tests/objc/minimal/Main.hs view
@@ -0,0 +1,15 @@+{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}++import Language.C.Quote.ObjC+import Language.C.Inline.ObjC+++objc_import ["<Foundation/Foundation.h>"]++nslog :: String -> IO ()+nslog msg = $(objc ['msg] ''() [cexp| NSLog(@"Here is a message from Haskell: %@", msg) |])++objc_emit+++main = objc_initialise >> nslog "I like Objective-C!"
+ tests/objc/minimal/Makefile view
@@ -0,0 +1,22 @@+HC      = ghc+HCFLAGS = +LDFLAGS = -package template-haskell -package language-c-quote -package language-c-inline -framework Foundation++OBJS = Main.o Main_objc.o++default: Minimal++%.o: %.hs+	$(HC) -c $< $(HCFLAGS)++Main.o:++Main_objc.m: Main.o++Minimal: $(OBJS)+	$(HC) -o $@ $^ $(LDFLAGS)++.PHONY: clean++clean:+	rm -f *.o *.hi Main_objc.[hm] Minimal