Truly random idents to foil #haskell games
This commit is contained in:
parent
493be17566
commit
2ba550faa1
8
TODO
8
TODO
@ -1,6 +1,14 @@
|
|||||||
For 1.0
|
For 1.0
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
+ broken on mac.
|
||||||
|
symbols with suspiciously many _ chars
|
||||||
|
|
||||||
|
+ Add verbose versions of the load functions, to avoid -DDEBUG
|
||||||
|
|
||||||
|
+ mention that you need .o archives, not .a ones. Use Cabal, ghc-pkg -u
|
||||||
|
or ld -r --whole-archive
|
||||||
|
|
||||||
+ hs-plugins doesn't know to look for packages in the user packages,
|
+ hs-plugins doesn't know to look for packages in the user packages,
|
||||||
only in the global packages
|
only in the global packages
|
||||||
|
|
||||||
|
@ -53,9 +53,12 @@ import AltData.Typeable ( Typeable )
|
|||||||
|
|
||||||
import Data.Either
|
import Data.Either
|
||||||
import Data.Map as Map
|
import Data.Map as Map
|
||||||
|
import Data.Char
|
||||||
|
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Directory
|
import System.Directory
|
||||||
|
import System.Random
|
||||||
|
import System.IO.Unsafe
|
||||||
|
|
||||||
-- import Foreign.C
|
-- import Foreign.C
|
||||||
-- import Foreign
|
-- import Foreign
|
||||||
@ -235,8 +238,13 @@ dynwrap expr nm mods =
|
|||||||
"module "++nm++ "( resource ) where\n" ++
|
"module "++nm++ "( resource ) where\n" ++
|
||||||
concatMap (\m-> "import "++m++"\n") mods ++
|
concatMap (\m-> "import "++m++"\n") mods ++
|
||||||
"import AltData.Dynamic\n" ++
|
"import AltData.Dynamic\n" ++
|
||||||
"resource = let { yhjulwwiefzojcbxybbruweejw = \n" ++
|
"resource = let { "++x++" = \n" ++
|
||||||
"{-# LINE 1 \"<eval>\" #-}\n" ++ expr ++ ";} in toDyn yhjulwwiefzojcbxybbruweejw"
|
"{-# LINE 1 \"<eval>\" #-}\n" ++ expr ++ ";} in toDyn "++x
|
||||||
|
where
|
||||||
|
x = ident ()
|
||||||
|
|
||||||
|
ident () = unsafePerformIO $
|
||||||
|
sequence (take 3 (repeat $ getStdRandom (randomR (97,122)) >>= return . chr))
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- unsafe wrapper
|
-- unsafe wrapper
|
||||||
@ -245,8 +253,10 @@ wrap :: String -> String -> [Import] -> String
|
|||||||
wrap expr nm mods =
|
wrap expr nm mods =
|
||||||
"module "++nm++ "( resource ) where\n" ++
|
"module "++nm++ "( resource ) where\n" ++
|
||||||
concatMap (\m-> "import "++m++"\n") mods ++
|
concatMap (\m-> "import "++m++"\n") mods ++
|
||||||
"resource = let { yhjulwwiefzojcbxybbruweejw = \n" ++
|
"resource = let { "++x++" = \n" ++
|
||||||
"{-# LINE 1 \"<Plugins.Eval>\" #-}\n" ++ expr ++ ";} in yhjulwwiefzojcbxybbruweejw"
|
"{-# LINE 1 \"<Plugins.Eval>\" #-}\n" ++ expr ++ ";} in "++x
|
||||||
|
where
|
||||||
|
x = ident ()
|
||||||
|
|
||||||
-- what is this big variable name?
|
-- what is this big variable name?
|
||||||
-- its a random value, so that it won't clash if the accidently mistype
|
-- its a random value, so that it won't clash if the accidently mistype
|
||||||
|
Loading…
x
Reference in New Issue
Block a user