2016-09-17 22:02:16 +00:00
|
|
|
#include "mcg.h"
|
2016-09-17 20:21:47 +00:00
|
|
|
|
2016-09-17 22:02:16 +00:00
|
|
|
void fatal(const char* msg, ...)
|
2016-09-17 20:21:47 +00:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, msg);
|
|
|
|
|
|
|
|
vfprintf(stderr, msg, ap);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
|
|
|
|
va_end(ap);
|
2016-09-17 22:02:16 +00:00
|
|
|
abort();
|
2016-09-17 20:21:47 +00:00
|
|
|
}
|
|
|
|
|
2016-09-18 21:24:54 +00:00
|
|
|
const char* aprintf(const char* fmt, ...)
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
char* p;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
n = vsnprintf(NULL, 0, fmt, ap) + 1;
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
p = malloc(n);
|
|
|
|
if (!p)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vsnprintf(p, n, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2016-09-17 22:02:16 +00:00
|
|
|
int main(int argc, char* argv[])
|
2016-09-17 20:21:47 +00:00
|
|
|
{
|
2016-09-18 21:24:54 +00:00
|
|
|
symbol_init();
|
|
|
|
|
2016-09-17 20:21:47 +00:00
|
|
|
if (!EM_open(argv[1]))
|
|
|
|
fatal("Couldn't open input file: %s", EM_error);
|
|
|
|
|
2016-09-17 22:02:16 +00:00
|
|
|
parse_em();
|
2016-09-17 20:21:47 +00:00
|
|
|
|
|
|
|
EM_close();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set sw=4 ts=4 expandtab : */
|