Skip to content

Commit

Permalink
Merge pull request #159 from mknos/bc-cleanup
Browse files Browse the repository at this point in the history
bc: delete unused code
  • Loading branch information
briandfoy committed May 10, 2023
2 parents a4e9051 + d2a3733 commit 1b65b5b
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions bin/bc
Expand Up @@ -11,8 +11,6 @@ License: gpl
=cut


$yysccsid = "@(#)yaccpar 1.8 (Berkeley) 01/20/91 (Perl 2.0 12/31/92)";
#define YYBYACC 1
#line 49 "bc.y"

Expand Down Expand Up @@ -710,11 +708,6 @@ if ($yyn == 5) {
start_stmt();
&yyerrok;

last switch;
} }
if ($yyn == 6) {
#line 144 "bc.y"
{ exit(0);
last switch;
} }
if ($yyn == 7) {
Expand Down Expand Up @@ -1245,9 +1238,6 @@ last switch;
} # yyparse
#line 479 "bc.y"

# Prompt the user on STDERR, but only prompt if STDERR and the input
# file are both terminals.

@file_list=();
$mathlib=0;
sub command_line()
Expand Down Expand Up @@ -1300,7 +1290,6 @@ sub next_file
$input = IN;
}
$cur_file = $file;
$prompt = '';
return 1;

}
Expand All @@ -1310,12 +1299,6 @@ sub next_file
return 0;
}

# print the prompt
sub prompt
{
print STDERR $prompt if $prompt;
}

# print an error message
sub yyerror
{
Expand All @@ -1335,7 +1318,6 @@ sub yylex
# get a line of input, if we need it.
if ($line eq '')
{
&prompt;
while(! ($line = <$input>)) {
&next_file || do {
return(0); };
Expand Down Expand Up @@ -1495,15 +1477,6 @@ sub yylex
}
}

# factorial
sub fact
{
local($n) = @_;
local($f) = 1;
$f *= $n-- while ($n > 1) ;
$f;
}

sub bi_length
{
my $stack = shift;
Expand Down Expand Up @@ -1598,29 +1571,16 @@ sub finish_stmt
return $stmt;
}


#
# Execution time
#

my ($res, $val);
my $code;

sub exec_print
{
my $res = exec_stmt(@_);
print "$res\n" if(defined $res);
}

#
# exec_stmt
# Really executes a statement. Calls itself recursively when it
# encounters sub-statements (in block, loops, functions...)
#
my $count = 0;
sub exec_stmt
{
$count++;
my $stmt = shift;

my $return = 0; # 1 if a "return" statement is encountered
Expand Down Expand Up @@ -1785,7 +1745,6 @@ $count++;
# IF statement

my $cond = pop @ope_stack;
my $res = $cond;
$val = 0;
if($cond) {
($return, $val) = exec_stmt($instr->[1]);
Expand Down Expand Up @@ -2098,8 +2057,6 @@ start_stmt();

main();

print "count=$count\n";

__END__
/* libmath.b for GNU bc. */
Expand Down

0 comments on commit 1b65b5b

Please sign in to comment.