Execute CopyPasta Language: Difference between revisions

Content added Content deleted
Line 768: Line 768:


=={{header|Phix}}==
=={{header|Phix}}==
Fakes five files so it can be run w/o any fiddly setup, but will handle (differently-named!) real files as well.<br>
Fakes four files so it can be run w/o any fiddly setup, but will handle (differently-named!) real files as well.<br>
If run without command-line parameters it fakes five runs.<br>
If run without command-line parameters it fakes four runs.<br>
Assumes if clipboard is "hello\n", Duplicate 2 should leave it as "hello\nhello\nhello\n", ie original & original*2.
Assumes if clipboard is "hello ", Duplicate 2 should leave it as "hello hello hello ".
<lang Phix>constant prog1_cp = """
<lang Phix>constant prog1_cp = """
Copy
Copy
Line 794: Line 794:
Goto
Goto
3
3
Pasta!
""",
prog4_cp = """
CopyFile
TheF*ckingCode
Duplicate
2
Pasta!
Pasta!
""",
""",
Line 806: Line 799:
I'm the pasta.txt file.
I'm the pasta.txt file.
""",
""",
fake_files = {"prog1.cp","prog2.cp","prog3.cp","prog4.cp","pasta.txt"},
fake_files = {"prog1.cp","prog2.cp","prog3.cp","pasta.txt"},
fake_texts = { prog1_cp , prog2_cp , prog3_cp , prog4_cp , pasta_txt }
fake_texts = { prog1_cp , prog2_cp , prog3_cp , pasta_txt }


function get_file_lines(string filename)
function get_file_lines(string filename)
Line 845: Line 838:
sequence cl = command_line()
sequence cl = command_line()
if length(cl)=2 then
if length(cl)=2 then
for i=1 to 5 do
for i=1 to 4 do
try
try
interpret(sprintf("prog%d.cp",i))
interpret(sprintf("prog%d.cp",i))
Line 874: Line 867:


interpret(prog4.cp):
interpret(prog4.cp):
"crash(file not found:prog4.cp)"
CopyFile
TheF*ckingCode
Duplicate
2
Pasta!
CopyFile
TheF*ckingCode
Duplicate
2
Pasta!
CopyFile
TheF*ckingCode
Duplicate
2
Pasta!

interpret(prog5.cp):
"crash(file not found:prog5.cp)"
</pre>
</pre>