[TT #871] Add rand as a dynop, with tests
[parrot.git] / src / main.c
blobf14b9780ec52a11956f35b59a626136bfad2ce10
1 /*
2 Copyright (C) 2007-2008, Parrot Foundation.
3 $Id$
5 =head1 NAME
7 src/main.c - the Entry Point to Parrot Programs
9 =head1 DESCRIPTION
11 Start Parrot
13 =head2 Functions
15 =over 4
17 =cut
21 #include <stdio.h>
23 #include "parrot/parrot.h"
24 #include "parrot/embed.h"
25 #include "parrot/imcc.h"
29 =item C<int main(int argc, char * argv[])>
31 The entry point from the command line into Parrot.
33 =cut
37 int
38 main(int argc, char * argv[])
40 const char *sourcefile;
41 Interp *interp;
42 int status;
44 /* internationalization setup */
45 /* setlocale(LC_ALL, ""); */
46 PARROT_BINDTEXTDOMAIN(PACKAGE, LOCALEDIR);
47 PARROT_TEXTDOMAIN(PACKAGE);
49 Parrot_set_config_hash();
51 interp = Parrot_new(NULL);
52 imcc_initialize(interp);
54 /* We parse the arguments, but first store away the name of the Parrot
55 executable, since parsing destroys that and we want to make it
56 available. */
57 Parrot_set_executable_name(interp, Parrot_str_new(interp, argv[0], 0));
59 sourcefile = parseflags(interp, &argc, &argv);
60 status = imcc_run(interp, sourcefile, argc, argv);
61 UNUSED(status);
63 /* Clean-up after ourselves */
64 Parrot_destroy(interp);
65 Parrot_exit(interp, 0);
70 =back
72 =head1 SEE ALSO
74 F<compilers/imcc/main.c>, unfortunately.
76 =cut
81 * Local variables:
82 * c-file-style: "parrot"
83 * End:
84 * vim: expandtab shiftwidth=4: