Skip to content
Browse files

clean up old examples & scripts, add rvmrc

  • Loading branch information...
1 parent 3dd1e4a commit 872dc4d74a09873a4189351dd6db784487eb4b37 @mwotton committed Sep 1, 2010
View
2 .rvmrc
@@ -0,0 +1,2 @@
+rvm_install_on_use_flag=1
+rvm 1.9.1
View
3 Gemfile
@@ -1,3 +0,0 @@
-source 'http://rubygems.org'
-
-gemspec
View
29 bin-scripts/ghc_builder
@@ -1,29 +0,0 @@
-
-
-warn "Have ARGV #{ARGV.inspect}"
-
-sh = %~
-#!/bin/sh
-
-# $1 is our source haskell
-rm -rf tmp.old
-mv tmp tmp.old
-mkdir tmp
-tmp="tmp/$1"
-cat $1 >> $tmp
-echo "main :: IO ()" >> $tmp
-echo "main = return ()" >> $tmp
-
-cd tmp
-jhc -dc "$1"
-sed -i 's/^main(/disregard_main(/' hs.out_code.c
-
-# for linux
-gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math\
- -Wshadow -Wextra -Wall -Wno-unused-parameter -o libdynhs.so\
- hs.out_code.c -DNDEBUG -O3 -fPIC -shared '-D_JHC_STANDALONE=0'
-# for mac
-#gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math\
-# -Wshadow -Wextra -Wall -Wno-unused-parameter -o libdynhs.so\
-# hs.out_code.c -DNDEBUG -O3 -fPIC -shared '-D_JHC_STANDALONE=0' -dynamiclib
-#mv libdynhs.so ..
View
24 bin-scripts/jhc_builder
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-# $1 is our source haskell
-rm -rf tmp.old
-mv tmp tmp.old
-mkdir tmp
-tmp="tmp/$1"
-cat $1 >> $tmp
-echo "main :: IO ()" >> $tmp
-echo "main = return ()" >> $tmp
-
-cd tmp
-jhc -dc "$1"
-sed -i 's/^main(/disregard_main(/' hs.out_code.c
-
-# for linux
-gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math\
- -Wshadow -Wextra -Wall -Wno-unused-parameter -o libdynhs.so\
- hs.out_code.c -DNDEBUG -O3 -fPIC -shared '-D_JHC_STANDALONE=0'
- for mac
-#gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math\
-# -Wshadow -Wextra -Wall -Wno-unused-parameter -o libdynhs.so\
-# hs.out_code.c -DNDEBUG -O3 -fPIC -shared '-D_JHC_STANDALONE=0' -dynamiclib
-#mv libdynhs.so ..
View
5 examples/simple_inline/clean_and_run.sh
@@ -1,5 +0,0 @@
-#!/usr/bin/env sh
-# Delete existing binaries to see that the lib correctly recreates them
-clear;
-rm -rf ~/.hubris_cache/*; rm -rf *.o; rm -rf *.hi; rm -rf *.c;
-ruby haskell_math.rb
View
29 examples/simple_inline/haskell_math.rb
@@ -1,29 +0,0 @@
-#!/usr/local/bin/ruby
-
-here = File.expand_path( File.dirname(__FILE__))
-$:.unshift here + '/../../lib'
-require 'hubris'
-
-#Hubris.ruby_header = '/home/james/data/vendor/ruby-1.8.6-p383/'
-#Hubris.ghc_cmd = 'ghc'
-#Hubris.ghc_version = '6.11.20090913'
-
-class Target
-
- include Hubris
-
- def negate(i)
- return -i
- end
-end
-
-t = Target.new
-
-t.inline "mydouble (T_FIXNUM i) = T_FIXNUM (i + i)
-my_double _ = T_NIL", :no_strict => true
-
-#t.inline "mytriple (T_FIXNUM i) = T_FIXNUM (i * 3)
-# mytriple _ = T_NIL", :no_strict => true
-puts t.negate(3)
-puts t.mydouble(2)
-# puts t.mytriple(8)
View
28 examples/simple_rack_app/Test.hs
@@ -1,28 +0,0 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
-
--- module Test where
-
-import Foreign.C.Types
--- import Data.Map
-import Maybe
-
--- main = putStrLn "11"
-
-fibonacci :: Int -> Int
-fibonacci n = fibs !! n
- where fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
-
--- local_map = Data.Map.fromList [(1,2), (3,4)]
-
-
-
--- lookup_hs ::CInt -> CInt
--- lookup_hs = fromIntegral . Maybe.fromJust . ((flip Data.Map.lookup) local_map) . fromIntegral
--- foreign export ccall lookup_hs :: CInt -> CInt
-
-fibonacci_hs :: CInt -> CInt
-fibonacci_hs = fromIntegral . fibonacci . fromIntegral
-
-foreign export ccall fibonacci_hs :: CInt -> CInt
-
--- main = putStrLn "foo"
View
24 examples/simple_rack_app/config.ru
@@ -1,24 +0,0 @@
-#\ -w -p 8765
-use Rack::Reloader, 0
-use Rack::ContentLength
-
-require 'pp'
-require 'dl/import'
-
-module HaskyPants
- extend DL::Importable
- dlload "./libdynhs.so"
- extern "int fibonacci_hs(int)"
-end
-
-
-def arg_from env
- env['REQUEST_URI'] ? env['REQUEST_URI'].to_s.sub(/^\//, '').to_i : 0
-end
-
-app = proc do |env|
- value = HaskyPants.fibonacci_hs( arg_from env )
- [ 200, {'Content-Type' => 'text/plain'}, "The fib number is #{value }" ]
-end
-
-run app
View
16 examples/simple_rack_app/hsload.rb
@@ -1,16 +0,0 @@
-require 'dl/import'
-
-module HaskyPants
- if /^1\.8/ =~ RUBY_VERSION
- extend DL::Importable
- else
- extend DL::Importer
- end
-
- dlload "./libdynhs.so"
- ["int fibonacci_hs(int)"].each do |f|
- extern f
- end
-end
-
-puts HaskyPants.fibonacci_hs(12)

0 comments on commit 872dc4d

Please sign in to comment.
Something went wrong with that request. Please try again.