Mercurial > repo
view interps/clc-intercal/CLC-INTERCAL-ICALC-1.-94.-2/t/run-calculator @ 1463:9253d6f901b5
<Bike> echo "shachaf, elliot" > the_list
author | HackBot |
---|---|
date | Sat, 12 Jan 2013 01:30:21 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
# run the calculator # Copyright (c) 2006-2008 Claudio Calvelli, all rights reserved. # CLC-INTERCAL is copyrighted software. However, permission to use, modify, # and distribute it is granted provided that the conditions set out in the # licence agreement are met. See files README and COPYING in the distribution. use IPC::Open3 qw(open3); my @libs = map { "-I$_" } @INC; #my $rcfile = undef; #for my $inc (@INC) { # my $f = "$inc/Language/INTERCAL/Include/system.sickrc"; # -f $f or next; # $rcfile = $f; # last; #} #defined $rcfile or die "Could not find default system.sickrc?\n"; sub run_calculator { my ($mode, $language, @options) = @_; my ($rfh, $wfh); my @language = defined $language ? ("-l$language") : (); push @language, map { "-o$_" } @options; my $pid = open3($rfh, $wfh, $wfh, $^X, @libs, 'bin/intercalc', '--batch', "-m$mode", @language, '--bug=0', '--ubug=0', '--nouserrc'); my $so = select $rfh; $| = 1; select $so; ($pid, $rfh, $wfh); } 1