2014-01-17 06:58:31 -05:00
|
|
|
/**
|
|
|
|
* See Copyright Notice in picrin.h
|
|
|
|
*/
|
|
|
|
|
2013-10-10 03:15:41 -04:00
|
|
|
#include "picrin.h"
|
|
|
|
|
2014-09-08 07:20:08 -04:00
|
|
|
void
|
|
|
|
pic_init_picrin(pic_state *pic)
|
|
|
|
{
|
2016-02-18 02:29:13 -05:00
|
|
|
void pic_init_contrib(pic_state *);
|
|
|
|
void pic_load_piclib(pic_state *);
|
2014-09-08 07:20:08 -04:00
|
|
|
|
2015-01-22 04:06:10 -05:00
|
|
|
pic_init_contrib(pic);
|
|
|
|
pic_load_piclib(pic);
|
2014-09-08 07:20:08 -04:00
|
|
|
}
|
|
|
|
|
2016-02-09 11:38:05 -05:00
|
|
|
int picrin_argc;
|
|
|
|
char **picrin_argv;
|
|
|
|
char **picrin_envp;
|
|
|
|
|
2013-10-28 09:08:03 -04:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[], char **envp)
|
|
|
|
{
|
|
|
|
pic_state *pic;
|
2014-09-16 03:20:03 -04:00
|
|
|
struct pic_lib *PICRIN_MAIN;
|
2015-08-26 04:50:28 -04:00
|
|
|
int status;
|
2013-10-28 09:08:03 -04:00
|
|
|
|
2015-06-25 13:09:06 -04:00
|
|
|
pic = pic_open(pic_default_allocf, NULL);
|
2016-02-09 11:38:05 -05:00
|
|
|
|
|
|
|
picrin_argc = argc;
|
|
|
|
picrin_argv = argv;
|
|
|
|
picrin_envp = envp;
|
2013-10-28 09:08:03 -04:00
|
|
|
|
2015-06-26 00:20:49 -04:00
|
|
|
pic_try {
|
|
|
|
pic_init_picrin(pic);
|
2014-08-31 20:53:19 -04:00
|
|
|
|
2015-06-26 00:20:49 -04:00
|
|
|
PICRIN_MAIN = pic_find_library(pic, pic_read_cstr(pic, "(picrin main)"));
|
2014-09-16 03:20:03 -04:00
|
|
|
|
2016-02-14 10:51:22 -05:00
|
|
|
pic_funcall(pic, PICRIN_MAIN, "main", 0);
|
2015-08-26 04:50:28 -04:00
|
|
|
|
|
|
|
status = 0;
|
2014-01-08 01:38:47 -05:00
|
|
|
}
|
2014-07-27 22:43:52 -04:00
|
|
|
pic_catch {
|
2015-05-27 11:14:10 -04:00
|
|
|
pic_print_backtrace(pic, xstderr);
|
2014-07-29 02:43:59 -04:00
|
|
|
status = 1;
|
2013-10-28 09:08:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
pic_close(pic);
|
|
|
|
|
2014-07-29 02:43:59 -04:00
|
|
|
return status;
|
2013-10-28 09:08:03 -04:00
|
|
|
}
|