-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
85 lines (56 loc) · 1.36 KB
/
main.c
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
/*
Copyright (C) 2007-2008, Parrot Foundation.
$Id$
=head1 NAME
src/main.c - the Entry Point to Parrot Programs
=head1 DESCRIPTION
Start Parrot
=head2 Functions
=over 4
=cut
*/
#include <stdio.h>
#include "parrot/parrot.h"
#include "parrot/embed.h"
#include "parrot/imcc.h"
/*
=item C<int main(int argc, char * argv[])>
The entry point from the command line into Parrot.
=cut
*/
int
main(int argc, char * argv[])
{
const char *sourcefile;
Interp *interp;
int status;
/* internationalization setup */
/* setlocale(LC_ALL, ""); */
PARROT_BINDTEXTDOMAIN(PACKAGE, LOCALEDIR);
PARROT_TEXTDOMAIN(PACKAGE);
Parrot_set_config_hash();
interp = Parrot_new(NULL);
imcc_initialize(interp);
/* We parse the arguments, but first store away the name of the Parrot
executable, since parsing destroys that and we want to make it
available. */
Parrot_set_executable_name(interp, Parrot_str_new(interp, argv[0], 0));
sourcefile = parseflags(interp, &argc, &argv);
status = imcc_run(interp, sourcefile, argc, argv);
UNUSED(status);
/* Clean-up after ourselves */
Parrot_destroy(interp);
Parrot_exit(interp, 0);
}
/*
=back
=head1 SEE ALSO
F<compilers/imcc/main.c>, unfortunately.
=cut
*/
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
*/