Mercurial > repo
view interps/clc-intercal/CLC-INTERCAL-ICALC-1.-94.-2/t/run-calculator @ 12508:335a2a849232 draft default tip
<wib_jonas> `` f=/hackenv/bin/dateu; >$f echo $\'#!/bin/bash\\nset -e\\nif (( 1 < $# )); then echo "dateu error: too many command-line arguments. Usage: dateu datetimestring"; exit 2; fi\\nexec date -u ${1:+-d "$1"} "+%Y-%m-%d %H:%M:%S.%3N %z %Z %B %-e %A %G-W%V-%u"\'; chmod a+x "$f"
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Wed, 03 Jul 2024 18:15:24 +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