Mercurial > repo
view interps/clc-intercal/CLC-INTERCAL-ICALC-1.-94.-2/t/run-calculator @ 12512:9b31bb5d9ee1 draft default tip
<int-e> learn The password of the month is a matter of ongoing investigations
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Wed, 25 Sep 2024 19:54:44 +0100 |
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