| 689 | | , text ".sub init @MAIN, @ANON" |
| 690 | | , text " new_pad 0" |
| 691 | | -- Eventually, we'll have to write our own find_name wrapper (or |
| 692 | | -- fix Parrot's find_name appropriately). See Pugs.Eval.Var. |
| 693 | | -- For now, we simply store $P0 twice. |
| 694 | | , text " $P0 = new .PerlEnv" |
| 695 | | , text " store_global '%*ENV', $P0" |
| 696 | | , text " store_global '%ENV', $P0" |
| 697 | | , text " $P0 = new .PerlArray" |
| 698 | | , text " store_global '@*END', $P0" |
| 699 | | , text " store_global '@END', $P0" |
| 700 | | , text " main()" |
| 701 | | , nest 4 $ emit $ InsFun [] (lit "&exit") [lit (0 :: Int)] |
| 702 | | , text ".end" |
| | 689 | , emit $ DeclSub "init" [SubMAIN, SubANON] $ map StmtIns |
| | 690 | -- Eventually, we'll have to write our own find_name wrapper (or |
| | 691 | -- fix Parrot's find_name appropriately). See Pugs.Eval.Var. |
| | 692 | -- For now, we simply store $P0 twice. |
| | 693 | [ "new_pad" .- [lit0] |
| | 694 | , InsNew tempPMC PerlEnv |
| | 695 | , "store_global" .- [lit "%*ENV", tempPMC] |
| | 696 | , "store_global" .- [lit "%ENV", tempPMC] |
| | 697 | , InsNew tempPMC PerlArray |
| | 698 | , "store_global" .- [lit "@*END", tempPMC] |
| | 699 | , "store_global" .- [lit "@END", tempPMC] |
| | 700 | , "getstdin" .- [tempPMC] |
| | 701 | , "store_global" .- [lit "$*IN", tempPMC] |
| | 702 | , "store_global" .- [lit "$IN", tempPMC] |
| | 703 | , "getstdout" .- [tempPMC] |
| | 704 | , "store_global" .- [lit "$*OUT", tempPMC] |
| | 705 | , "store_global" .- [lit "$OUT", tempPMC] |
| | 706 | , "getstderr" .- [tempPMC] |
| | 707 | , "store_global" .- [lit "$*ERR", tempPMC] |
| | 708 | , "store_global" .- [lit "$ERR", tempPMC] |
| | 709 | , "getinterp" .- [tempPMC] |
| | 710 | , tempPMC <:= ExpLV (KEYED tempPMC (bare ".IGLOBALS_ARGV_LIST")) |
| | 711 | , tempPMC2 <-- "shift" $ [tempPMC] |
| | 712 | , "store_global" .- [lit "@*ARGS", tempPMC] |
| | 713 | , "store_global" .- [lit "@ARGS", tempPMC] |
| | 714 | , "store_global" .- [lit "$*PROGRAM_NAME", tempPMC2] |
| | 715 | , "store_global" .- [lit "$PROGRAM_NAME", tempPMC2] |
| | 716 | ] ++ [ StmtRaw (text "main()"), StmtIns (lit "&exit" .& [lit0]) ] |