Changeset 8900 for src/Pugs/Embed

Show
Ignore:
Timestamp:
02/01/06 13:28:50 (3 years ago)
Author:
audreyt
Message:

* embedded parrot lives again, thanks to leo++'s hints.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Embed/Parrot.hsc

    r8878 r8900  
    170170    interp <- readIORef _ParrotInterp  
    171171    if interp /= nullPtr then return interp else do 
     172    parrot_set_config_hash 
    172173    interp <- parrot_new nullPtr 
    173174    writeIORef _ParrotInterp interp 
     
    183184    -- parrot_set_debug interp 0x20 
    184185    parrot_imcc_init interp 
     186 
     187    pf      <- parrot_packfile_new interp 0 
     188    parrot_loadbc interp pf 
     189    seg     <- withCString "pugs" $ \p -> do 
     190        parrot_pf_create_default_segs interp p 1 
     191    set_pf_cur_cs pf seg 
     192    parrot_loadbc interp pf 
     193 
    185194    callback    <- mkCompileCallback compileToParrot 
    186195    pugsStr     <- withCString "Pugs" (const_string interp) 
    187196    parrot_compreg interp pugsStr callback 
    188197 
    189     pf      <- parrot_packfile_new interp 0 
    190     pf_dir  <- get_pf_directory pf 
    191     seg     <- withCString "pugs" $ \p -> do 
    192         parrot_packfile_segment_new_seg interp pf_dir 4 p 1 
    193     set_pf_cur_cs pf seg 
    194     parrot_loadbc interp pf 
    195198    modifyIORef _GlobalFinalizer (>> parrot_exit 0) 
    196199    return interp 
     
    206209    cwd     <- getCurrentDirectory 
    207210    setCurrentDirectory path 
    208     withCString "PGE.pbc" $ parrot_load_bytecode interp 
    209     withCString "PGE/Hs.pir" $ parrot_load_bytecode interp 
     211    pge_pbc <- withCString "PGE.pbc" $ const_string interp 
     212    pge_hs  <- withCString "PGE/Hs.pir" $ const_string interp 
     213    parrot_load_bytecode interp pge_pbc 
     214    parrot_load_bytecode interp pge_hs 
    210215    setCurrentDirectory cwd 
    211216    loadPGE interp path 
     
    252257    mkCompileCallback :: ParrotCompilerFunc -> IO (FunPtr ParrotCompilerFunc) 
    253258 
     259foreign import ccall "Parrot_set_config_hash" 
     260    parrot_set_config_hash :: IO () 
     261 
    254262foreign import ccall "Parrot_new" 
    255263    parrot_new :: ParrotInterp -> IO ParrotInterp 
     
    276284    parrot_packfile_segment_new_seg :: ParrotInterp -> ParrotPackFileDirectory -> CInt -> CString-> CInt -> IO ParrotPackFileByteCode 
    277285 
     286foreign import ccall "PF_create_default_segs" 
     287    parrot_pf_create_default_segs :: ParrotInterp -> CString -> CInt -> IO ParrotPackFileByteCode 
     288 
    278289foreign import ccall "dod_register_pmc" 
    279290    parrot_dod_register_pmc :: ParrotInterp -> ParrotPMC -> IO () 
     
    286297 
    287298foreign import ccall "Parrot_load_bytecode" 
    288     parrot_load_bytecode :: ParrotInterp -> CString -> IO () 
     299    parrot_load_bytecode :: ParrotInterp -> ParrotString -> IO () 
    289300 
    290301foreign import ccall "Parrot_call_sub"