This file is indexed.

/usr/share/perl5/Language/INTERCAL/Object.pm is in clc-intercal 1:1.0~4pre1.-94.-2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
package Language::INTERCAL::Object;

# Object file library

# This file is part of CLC-INTERCAL

# 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 strict;
use vars qw($VERSION $PERVERSION);
($VERSION) = ($PERVERSION = "CLC-INTERCAL/Base INTERCAL/Object.pm 1.-94.-2") =~ /\s(\S+)$/;

use Carp;
use Config;
use POSIX 'strftime';
use Language::INTERCAL::Exporter '1.-94.-2',
	qw(import is_intercal_number compare_version require_version);
use Language::INTERCAL::GenericIO '1.-94.-2',
	qw($stdwrite $stdread $stdsplat $devnull);
use Language::INTERCAL::Optimiser '1.-94.-2';
use Language::INTERCAL::Parser '1.-94.-2';
use Language::INTERCAL::Splats '1.-94.-2', qw(:SP);
use Language::INTERCAL::ByteCode '1.-94.-2',
	qw(BC_STS BC_CRE BC_DES BC_NOT BC_DSX BC_LAB BC_QUA BC_BUG
	   BC_FLA BC_STR BC_USG
	   BC bc_skip BCget is_constant);
use vars qw(@EXPORT_OK);
@EXPORT_OK = qw(find_code forall_code make_code);

# oldest objects we can read and understand
use constant MIN_VERSION => '1.-94.-4';

sub new {
    @_ == 1 or croak "Usage: new Language::INTERCAL::Object";
    my ($class) = @_;
    my $s = Language::INTERCAL::SymbolTable->new();
    my @p = (
	Language::INTERCAL::Parser->new($s),
	Language::INTERCAL::Parser->new($s),
    );
    my $o = Language::INTERCAL::Optimiser->new();
    my @now = gmtime(time);
    my @ts = map { strftime($_, @now) } qw(%Y %m %d %H %M %S);
    _new($class, $s, \@p, $o, \@ts, $VERSION);
}

sub _new {
    my ($class, $s, $p, $o, $ts, $perv) = @_;
    bless {
	'read_fh' => $stdread,
	'write_fh' => $stdwrite,
	'splat_fh' => $stdsplat,
	'trace_fh' => $stdsplat,
	'rs_fh' => $devnull,
	'optimiser' => $o,
	'thread' => [],
	'flags' => {},
	'code' => ['', {}],
	'source' => '',
	'symbols' => $s,
	'parsers' => $p,
	'bug' => [0, 1],
	'timestamp' => $ts,
	'perversion' => $perv,
    }, $class;
}

sub perversion {
    @_ == 1 or croak "Usage: OBJECT->perversion";
    my ($object) = @_;
    $object->{perversion};
}

sub setbug {
    @_ == 3 or croak "Usage: OBJECT->setbug(TYPE, VALUE)";
    my ($object, $type, $value) = @_;
    $value < 0 || $value > 100 and croak "Invalid BUG value";
    $object->{bug} = [$type ? 1 : 0, $value];
    $object;
}

sub add_flag {
    @_ == 3 or croak "Usage: OBJECT->add_flag(NAME, VALUE)";
    my ($object, $flag, $value) = @_;
    $object->{flags}{$flag} = $value;
    $object;
}

sub has_flag {
    @_ == 2 or croak "Usage: OBJECT->has_flag(NAME)";
    my ($object, $flag) = @_;
    exists $object->{flags}{$flag};
}

sub flag_value {
    @_ == 2 or croak "Usage: OBJECT->flag_value(NAME)";
    my ($object, $flag) = @_;
    $object->{flags}{$flag};
}

sub delete_flag {
    @_ == 2 or croak "Usage: OBJECT->delete_flag(NAME)";
    my ($object, $flag) = @_;
    delete $object->{flags}{$flag};
    $object;
}

sub all_flags {
    @_ == 1 or croak "Usage: OBJECT->all_flags";
    my ($object) = @_;
    keys %{$object->{flags}};
}

sub symboltable {
    @_ == 1 or croak "Usage: OBJECT->symboltable";
    my ($object) = @_;
    $object->{symbols};
}

sub num_parsers {
    @_ == 1 or croak "Usage: OBJECT->num_parsers";
    my ($object) = @_;
    scalar @{$object->{parsers}};
}

sub parser {
    @_ == 2 or croak "Usage: OBJECT->parser(NUMBER)";
    my ($object, $number) = @_;
    $number < 1 || $number > @{$object->{parsers}}
	and croak "Invalid NUMBER";
    $object->{parsers}[$number - 1];
}

sub shift_parsers {
    @_ == 1 or croak "Usage: OBJECT->shift_parsers";
    my ($object) = @_;
    shift @{$object->{parsers}};
    my $p = Language::INTERCAL::Parser->new($object->{symbols});
    push @{$object->{parsers}}, $p;
}

sub write {
    @_ == 2 || @_ == 3 || @_ == 4
	or croak "Usage: write Language::INTERCAL::Object"
	       . "(FILEHANDLE [, JUST_FLAGS [, AVOID_SKIP?]])";
    my ($class, $fh, $fonly, $ask) = @_;
    unless ($ask) {
	while (1) {
	    my $line = $fh->write_text();
	    croak "Invalid Object Format (no __END__)"
		if ! defined $line || $line eq '';
	    last if $line =~ /__END__/ || $line =~ /__DATA__/;
	}
    }
    my $line = $fh->write_text();
    $line =~ /^CLC-INTERCAL (\S+) Object File\n$/
	or croak "Invalid Object Format ($line)";
    my $perversion = $1;
    is_intercal_number($perversion)
	or croak "Invalid Object Perversion ($perversion)";
    compare_version($perversion, MIN_VERSION) >= 0
	or croak "Object too old to load with this perversion of sick";
    require_version Language::INTERCAL::Object $perversion;
    my @timestamp = unpack('vCCCCC', $fh->write_binary(7));
    my $fcount = unpack('v', $fh->write_binary(2));
    my %flags = ();
    while ($fcount-- > 0) {
	my $flen = unpack('v', $fh->write_binary(2));
	my $fname = $fh->write_binary($flen);
	my $fvalue = '';
	$fvalue = $1 if $fname =~ s/=(.*)$//;
	$flags{$fname} = $fvalue;
    }
    my ($o, @p, $code, %code, $syms, $source);
    unless ($fonly) {
	my ($fmask, $fsize);
	if (exists $flags{__object_format}) {
	    $fmask = 'vvvvvvvCCvvv';
	    $fsize = 22;
	} else {
	    $fmask = 'vvvvvvCCCvvv';
	    $fsize = 21;
	}
	my $clen = unpack('v', $fh->write_binary(2));
	$code = $fh->write_binary($clen);
	my $ns = unpack('v', $fh->write_binary(2));
	%code = ();
	while ($ns-- > 0) {
	    my ($sval, $nr) = unpack('vv', $fh->write_binary(4));
	    my @r = ();
	    while (@r < $nr) {
		my ($ju, $sl, $ls, $ll, $ds, $dl, $ge, $ab, $qu, $xs, $xl, $rl) =
		    unpack($fmask, $fh->write_binary($fsize));
		my $ru = $fh->write_binary($rl);
		if ($ge == 255) {
		    $ge = unpack('v', $fh->write_binary(2));
		}
		my @rb = split(//, unpack('b*', $ru));
		my @ru = grep { $rb[$_] } (0..$#rb);
		push @r,
		    [$ju, $sl, $ls, $ll, $ds, $dl, $ge, $ab, $qu, $xs, $xl, @ru];
	    }
	    $code{$sval} = \@r;
	}
	my $slen = unpack('v', $fh->write_binary(2)) || 0;
	$source = $fh->write_binary($slen);
	$syms = Language::INTERCAL::SymbolTable->write($fh);
	my $psize = unpack('v', $fh->write_binary(2)) || 0;
	@p = ();
	while (@p < $psize) {
	    push @p, Language::INTERCAL::Parser->write($fh, $syms);
	}
	$o = Language::INTERCAL::Optimiser->write($fh);
    }
    my $obj = _new($class, $syms, \@p, $o, \@timestamp, $perversion);
    $obj->{code} = [$code, \%code];
    $obj->{source} = $source;
    $obj->{flags} = \%flags;
    $obj;
}

sub read {
    @_ == 2 or croak "Usage: read Language::INTERCAL::Object(FILEHANDLE)";
    my ($obj, $fh) = @_;
    $fh->read_text($Config{startperl} . "\n");
    $fh->read_text('eval \'exec /usr/bin/perl -w -S $0 ${1+"$@"}\'' . "\n");
    $fh->read_text("    if 0; # not running under some shell\n");
    $fh->read_text("# GENERATED BY CLC-INTERCAL $VERSION\n");
    $fh->read_text("# TO MODIFY, EDIT SOURCE AND REPACKAGE\n");
    $fh->read_text("\n");
    $fh->read_text("use Getopt::Long;\n");
    $fh->read_text("use Language::INTERCAL::GenericIO '$VERSION';\n");
    $fh->read_text("use Language::INTERCAL::Interpreter '$VERSION';\n");
    $fh->read_text("use Language::INTERCAL::Server '$VERSION';\n");
    $fh->read_text("use Language::INTERCAL::Rcfile '$VERSION';\n");
    $fh->read_text("\n");
    $fh->read_text("my \$rc = Language::INTERCAL::Rcfile->new();\n");
    $fh->read_text("if (defined &Getopt::Long::Configure) {\n");
    $fh->read_text("    Getopt::Long::Configure qw(no_ignore_case auto_abbrev permute bundling pass_through);\n");
    $fh->read_text("} else {\n");
    $fh->read_text("    \$Getopt::Long::ignorecase = 0;\n");
    $fh->read_text("    \$Getopt::Long::autoabbrev = 1;\n");
    $fh->read_text("    \$Getopt::Long::order = \$Getopt::Long::PERMUTE;\n");
    $fh->read_text("    \$Getopt::Long::bundling = 1;\n");
    $fh->read_text("}\n");
    $fh->read_text("my \$wimp = 0;\n");
    $fh->read_text("my \$trace = 0;\n");
    $fh->read_text("my \$stdtrace = undef;\n");
    $fh->read_text("GetOptions(\n");
    $fh->read_text("    'wimp!'      => \\\$wimp,\n");
    $fh->read_text("    'trace!'     => \\\$trace,\n");
    $fh->read_text("    'stdtrace=s' => \\\$stdtrace,\n");
    $fh->read_text("    'nouserrc'   => sub { \$rc->setoption('nouserrc', 1) },\n");
    $fh->read_text("    'rcfile=s'   => sub { \$rc->setoption(\@_) },\n");
    $fh->read_text(");\n");
    $fh->read_text("\$rc->load();\n");
    $fh->read_text("my \$fh = Language::INTERCAL::GenericIO->new('FILE', 'w', \\*DATA);\n");
    $fh->read_text("my \$int = Language::INTERCAL::Interpreter->write(\$rc, \$fh, 1);\n");
    $fh->read_text("if (defined \$stdtrace) {\n");
    $fh->read_text("    \$trace = 1;\n");
    $fh->read_text("    my \$mode = \$stdtrace =~ s/^([ra]),//i ? lc(\$1) : 'r';\n");
    $fh->read_text("    my \$th = Language::INTERCAL::GenericIO->new('FILE', \$mode, \$stdtrace);\n");
    $fh->read_text("    \$int->setreg('\@TRFH', \$th);\n");
    $fh->read_text("}\n");
    $fh->read_text("\$int->setreg('\%WT', \$wimp);\n");
    $fh->read_text("\$int->setreg('\%TM', \$trace);\n");
    $fh->read_text("\$int->setreg('^AV', \\\@ARGV);\n");
    $fh->read_text("\$int->setreg('^EV', [map { \"\$_=\$ENV{\$_}\" } keys \%ENV]);\n");
    $fh->read_text("\$int->start()->run()->stop();\n");
    $fh->read_text("\n");
    $fh->read_text("__DATA__\n");
    $fh->read_text("CLC-INTERCAL $VERSION Object File\n");
    $fh->read_binary(pack('vCCCCC', @{$obj->{timestamp}}));
    $obj->{flags}{__object_format} = 1;
    my @flags = keys %{$obj->{flags}};
    $fh->read_binary(pack('v', scalar @flags));
    for my $fname (@flags) {
	my $fvalue = $obj->{flags}{$fname};
	my $flag = "$fname=$fvalue";
	$fh->read_binary(pack('v/a*', $flag));
    }
    my ($cs, $cp) = @{$obj->{code}};
    my @cp = keys %$cp;
    $fh->read_binary(pack('v/a* v', $cs, scalar @cp));
    for my $s (@cp) {
	my $p = $cp->{$s};
	$fh->read_binary(pack('vv', $s, scalar @$p));
	for my $q (@$p) {
	    my ($ju, $sl, $ls, $ll, $ds, $dl, $ge, $ab, $qu, $xs, $xl, @ru) =
		@$q;
	    my $ru = '';
	    vec($ru, $_, 1) = 1 for @ru;
	    $fh->read_binary(pack('vvvvvvvCCvv v/a*', $ju, $sl, $ls, $ll,
						      $ds, $dl, $ge, $ab,
						      $qu, $xs, $xl, $ru));
	}
    }
    my $source = defined $obj->{source} ? $obj->{source} : '';
    $fh->read_binary(pack('v/a*', $source));
    $obj->{symbols}->read($fh);
    $fh->read_binary(pack('v', scalar @{$obj->{parsers}}));
    for my $p (@{$obj->{parsers}}) {
	$p->read($fh);
    }
    $obj->{optimiser}->read($fh);
    $obj;
}

sub make_code {
    @_ == 2 or croak "Usage: OBJECT->make_code(NEWCODE)";
    my ($obj, $newcode) = @_;
    my %obj = (bug => [0, 0]);
    _setcode($obj, \%obj, $newcode);
    wantarray ? @{$obj{code}} : $obj{code}[0];
}

sub setcode {
    @_ == 3 or croak "Usage: OBJECT->set_code(CODE, CPTR)";
    my ($obj, $code, $cptr) = @_;
    $obj->{code} = [$code, $cptr];
    $obj;
}

sub code {
    @_ == 1 || @_ == 2 or croak "Usage: OBJECT->code [(NEWCODE)]";
    my $obj = shift;
    my @oldcode = @{$obj->{code}};
    if (@_) {
	my $newcode = shift;
	_setcode($obj, $obj, $newcode);
    }
    wantarray ? @oldcode : $oldcode[0];
}

sub source {
    @_ == 1 || @_ == 2 or croak "Usage: OBJECT->source [(NEWSOURCE)]";
    my $obj = shift;
    if (@_) {
	my $oldsource = $obj->{source};
	$obj->{source} = shift;
	length $obj->{source} > 0xffff
	    and faint(SP_INDIGESTION);
	return $oldsource;
    }
    $obj->{source};
}

sub forall_code {
    @_ == 3 or croak "Usage: forall_code(CPTR, RULES, CODE)";
    my ($cptr, $rules, $co) = @_;
    for my $sptr (sort { $a <=> $b } keys %$cptr) {
	for my $p (@{$cptr->{$sptr}}) {
	    my ($ju, $sl, $ls, $ll, $ds, $dl, $ge,
		$ab, $qu, $xs, $xl, @ru) = @$p;
	    $co->($xs, $xl, $sptr, $sl, $ab,
		  $ls, $ll, $ds, $dl, $ge, $qu);
	}
    }
}

sub find_code {
    @_ == 3 or croak "Usage: find_code(CPTR, SPTR, RULES)";
    my ($cptr, $sptr, $rules) = @_;
    # if possible, find a valid statement
    if (exists $cptr->{$sptr}) {
	TRY:
	for my $p (@{$cptr->{$sptr}}) {
	    my ($ju, $sl, $ls, $ll, $ds, $dl, $ge,
		$ab, $qu, $xs, $xl, @ru) = @$p;
	    if ($rules) {
		for my $rn (@ru) {
		    next TRY if ! $rules->[$rn];
		    next TRY if ! ${$rules->[$rn]};
		}
	    }
	    # the first one found is the best as we have already sorted the
	    # list in _setcode
	    return ($xs, $xl, $sl, $ab, $ls, $ll, $ds, $dl, $ge, $qu);
	}
    }
    # no valid statement; determine the length of the comment
    my @later = grep { $_ > $sptr } keys %$cptr;
    my $len = undef;
    if (@later) {
	my ($next) = sort { $a <=> $b } @later;
	$len = $next - $sptr;
    }
    return (undef, $sptr, $len, 0);
}

sub _addcode {
    my ($js, $cf) = @_;
    my $fp = index($$js, $cf);
    return $fp if $fp >= 0;
    $fp = length($$js);
    $$js .= $cf;
    return $fp;
}

sub _optimise {
    my ($obj, $code, $seen) = @_;
    return $code if ! exists $obj->{optimiser};
    return $seen->{$code} if exists $seen->{$code};
    $seen->{$code} = $obj->{optimiser}->optimise($code);
    return $seen->{$code};
}

sub _setcode {
    my ($pobj, $obj, $code) = @_;
    my %optimise = ();
    my %code = ();
    my $joincode = '';
    my $sts = pack('C', BC_STS);
    my @code = @{ref $code ? $code : [$code]};
    if (@code && $obj->{bug}[1] > rand(100)) {
	my $bpos = int(rand scalar @code);
	$code[$bpos] .= pack('C*', BC_BUG, BC($obj->{bug}[0] ? 1 : 0));
    }
    STATEMENT:
    for my $cv (@code) {
	next if $cv eq '';
	my $ep = length $cv;
	unless (substr($cv, 0, 1) eq $sts) {
	    my $bc = sprintf("%02X", ord(substr($cv, 0, 1)));
	    faint(SP_INVALID, $bc, "_setcode");
	}
	my $ncp = 1;
	my $start = BCget($cv, \$ncp, $ep);
	my $len = BCget($cv, \$ncp, $ep);
	my $junk = BCget($cv, \$ncp, $ep);
	my $count = BCget($cv, \$ncp, $ep);
	my @rules = ();
	while (@rules < $count) {
	    push @rules, BCget($cv, \$ncp, $ep);
	}
	@rules = sort { $a <=> $b } @rules;
	my $gerund = 0;
	my $abstain = 0;
	my $quantum = 0;
	my @label = (0, 0);
	my @dsx = (0, 0);
	while ($ncp < $ep) {
	    my $byte = ord(substr($cv, $ncp++, 1));
	    if ($byte == BC_NOT) {
		$abstain = 1;
		next;
	    }
	    if ($byte == BC_QUA) {
		$quantum = 1;
		next;
	    }
	    if ($byte == BC_LAB) {
		$ncp < $ep or faint(SP_INVALID, '(end of statement)', 'LAB');
		if (is_constant(ord(substr($cv, $ncp, 1)))) {
		    $label[0] = BCget($cv, \$ncp, $ep);
		    $label[1] = 0;
		} else {
		    my $diff = bc_skip($cv, $ncp, $ep);
		    $label[0] = _addcode(\$joincode, substr($cv, $ncp, $diff));
		    $label[1] = $diff;
		    $ncp += $diff;
		}
		next;
	    }
	    if ($byte == BC_DSX) {
		$ncp < $ep or faint(SP_INVALID, '(end of statement)', 'DSX');
		if (is_constant(ord(substr($cv, $ncp, 1)))) {
		    $dsx[0] = 1 + BCget($cv, \$ncp, $ep);
		    $dsx[1] = 0;
		} else {
		    my $diff = bc_skip($cv, $ncp, $ep);
		    $dsx[0] = _addcode(\$joincode, substr($cv, $ncp, $diff));
		    $dsx[1] = $diff;
		    $ncp += $diff;
		}
		next;
	    }
	    if ($byte == BC_USG) {
		my $vcp = $ncp;
		$gerund = BCget($cv, \$vcp, $ep);
		$ncp--;
		last;
	    }
	    $gerund = $byte;
	    $ncp--;
	    last;
	}
	my $addcode = substr($cv, $ncp, $ep - $ncp);
	if ($gerund == BC_FLA) {
	    # try executing this now...
	    my $fb = $ncp + 1;
	    my ($flag, $value);
	    if (substr($cv, $fb, 1) eq chr(BC_STR)) {
		$fb++;
		my $length = BCget($cv, \$fb, $ep);
		faint(SP_INVALID, 'flag name has wrong length', '_setcode')
		    if $length + $fb > $ep;
		$flag = substr($cv, $fb, $length);
		$fb += $length;
	    } else {
		my $length = BCget($cv, \$fb, $ep);
		$flag = '';
		while (length $flag < $length) {
		    $flag .= chr(BCget($cv, \$fb, $ep));
		}
	    }
	    if (substr($cv, $fb, 1) eq chr(BC_STR)) {
		$fb++;
		my $length = BCget($cv, \$fb, $ep);
		faint(SP_INVALID, 'flag name has wrong length', '_setcode')
		    if $length + $fb > $ep;
		$value = substr($cv, $fb, $length);
		$fb += $length;
	    } else {
		my $length = BCget($cv, \$fb, $ep);
		$value = '';
		while (length $value < $length) {
		    $value .= chr(BCget($cv, \$fb, $ep));
		}
	    }
	    faint(SP_INVALID, 'extra code after flag', '_setcode')
		if $fb != $ep;
	    $pobj->{flags}{$flag} = $value unless $abstain;
	    $addcode = chr(BC_FLA);
	    $abstain = 1;
	}
	my @objcode = (
	    _addcode(\$joincode, $addcode),
	    length($addcode),
	);
	# look for the very same thing...
	my @addit = (
	    $junk, $len,
	    $label[0], $label[1],
	    $dsx[0], $dsx[1],
	    $gerund, $abstain, $quantum,
	    $objcode[0], $objcode[1],
	    @rules,
	);
	if (exists $code{$start}{$junk}{$len}) {
	    TRY:
	    for my $p (@{$code{$start}{$junk}{$len}}) {
		next TRY if @addit != @$p;
		# the following works because @rules are sorted
		for (my $i = 0; $i < @addit; $i++) {
		    next TRY if $p->[$i] != $addit[$i];
		}
		# yup, it's the very same - no need to add it then
		next STATEMENT;
	    }
	}
	# we'll have to add this one
	push @{$code{$start}{$junk}{$len}}, \@addit;
    }
    length $joincode > 0xffff
	and faint(SP_INDIGESTION);
    # now go and transform each value of %code... note that we sort the
    # array so that noncomments are always before comments, and shorter
    # comments are preferred over longer; however within the same comment
    # length (or within the noncomment group) we prefer longer source
    # code; all else being equal, we prefer things which use more grammar
    # rules
    for my $sp (keys %code) {
	my @elems = ();
	for my $j (sort { $a <=> $b } keys %{$code{$sp}}) {
	    for my $l (sort { $b <=> $a } keys %{$code{$sp}{$j}}) {
		push @elems, sort {
		    scalar @$a <=> scalar @$b
		} @{$code{$sp}{$j}{$l}};
	    }
	}
	$code{$sp} = \@elems;
    }
    $obj->{code} = [$joincode, \%code];
}

1;