mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 20:39:26 +01:00
33e13fd993
This is expected to take three commits to complete. This first initial commit does the following: - Begin initial rough-draft of doc/VirtualMachine.md - Begin initial refactoring of scripts The next commit will polish up the initial rough-draft and refactoring. The final commit will quality-check everything and fix anything overlooked.
66 lines
1.6 KiB
Perl
Executable File
66 lines
1.6 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
package Languages::tendra;
|
|
use parent 'Languages::_c_base';
|
|
|
|
sub initialize {
|
|
my ($self, %conf) = @_;
|
|
|
|
$self->{sourcefile} = 'prog.c';
|
|
$self->{execfile} = 'prog';
|
|
$self->{default_options} = '-Xp -Yansi';
|
|
$self->{cmdline} = 'tcc $sourcefile $options -o $execfile';
|
|
|
|
$self->{no_gdb_extensions} = 1;
|
|
|
|
$self->{prelude} = <<'END';
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <float.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>
|
|
#include <time.h>
|
|
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
|
|
#define print_last_statement(s) s
|
|
|
|
END
|
|
}
|
|
|
|
sub postprocess_output {
|
|
my $self = shift;
|
|
$self->SUPER::postprocess_output;
|
|
|
|
$self->{output} =~ s/^\n+//mg;
|
|
|
|
$self->{output} =~ s/^\[Warning: Directory 'c89' already defined.\]\s*//;
|
|
$self->{output} =~ s/\s*Warning: Directory 'c89' already defined.//g;
|
|
|
|
if ((not exists $self->{options}->{'-paste'}) and (not defined $self->{got_run} or $self->{got_run} ne 'paste')) {
|
|
$self->{output} =~ s/"$self->{sourcefile}", line \d+:\s*//g;
|
|
$self->{output} =~ s/Error:\s+\[/Error: [/g;
|
|
$self->{output} =~ s/Warning:\s+\[/Warning: [/g;
|
|
$self->{output} =~ s/^\[\s+(Warning|Error)/[$1/;
|
|
}
|
|
|
|
if ($self->{channel} =~ m/^#/) {
|
|
$self->{output} =~ s/^/[Notice: TenDRA is missing support for candide extensions; use `cc` or `clang` instead.]\n/ unless $self->{output} =~ m/^tcc: Version/;
|
|
}
|
|
}
|
|
|
|
1;
|