2015-01-16 06:21:40 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
package tendra;
|
|
|
|
use parent '_c_base';
|
|
|
|
|
|
|
|
sub initialize {
|
|
|
|
my ($self, %conf) = @_;
|
|
|
|
|
|
|
|
$self->{sourcefile} = 'prog.c';
|
|
|
|
$self->{execfile} = 'prog';
|
2015-01-17 02:29:41 +01:00
|
|
|
$self->{default_options} = '-Xp -Yansi';
|
2015-01-16 06:21:40 +01:00
|
|
|
$self->{cmdline} = 'tcc -Wa,-32 -Wl,-melf_i386 -g $sourcefile $options -o $execfile';
|
|
|
|
|
|
|
|
$self->{prelude} = <<'END';
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
END
|
|
|
|
}
|
|
|
|
|
2015-01-17 02:29:41 +01:00
|
|
|
sub postprocess_output {
|
|
|
|
my $self = shift;
|
|
|
|
$self->SUPER::postprocess_output;
|
|
|
|
|
2015-01-17 07:24:54 +01:00
|
|
|
$self->{output} =~ s/^\n+//mg;
|
|
|
|
|
2015-01-17 02:29:41 +01:00
|
|
|
$self->{output} =~ s/^\[Warning: Directory 'c89' already defined.\]\s*//;
|
|
|
|
$self->{output} =~ s/\s*Warning: Directory 'c89' already defined.//g;
|
|
|
|
|
2015-01-17 07:24:54 +01:00
|
|
|
if ((not exists $self->{options}->{'-paste'}) and (not defined $self->{got_run} or $self->{got_run} ne 'paste')) {
|
2015-01-17 02:29:41 +01:00
|
|
|
$self->{output} =~ s/"$self->{sourcefile}", line \d+:\s*//g;
|
2015-01-17 07:24:54 +01:00
|
|
|
$self->{output} =~ s/Error:\s+\[/Error: [/g;
|
2015-01-17 02:29:41 +01:00
|
|
|
$self->{output} =~ s/Warning:\s+\[/Warning: [/g;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-16 06:21:40 +01:00
|
|
|
1;
|