/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/


#include	<fcntl.h>
#include	<stdlib.h>
#include	"init.h"
#include	"long_char.h"
#include	"memory_routine.h"
#include	"xl.h"
#include	"utils.h"
#include	"favt.h"
#include	"gb.h"
#include	"resource.h"
#include	"pfc.h"
#include	"pmd.h"
#include	"gbpmd.h"
#include	"favt64.h"

int pid;

int
_main(int argc,char ** argv)
{
XL_INTERPRETER * xli;

pid = getpid();

 	init_xl(INI_DONTWAITCHI);
	init_favt();
	init_favt64();

	init_gbs();
	init_vector();


	init_gv_cpu(gblisp_top_env0);

	gc_push(0,0,"main(1)");
	xli = new_xl_interpreter();
	xli->a_type = XLA_SELF;
	setup_i(xli);
	gc_pop(0,0);

	init_function(gblisp_top_env0,gblisp_top_env1,argc,argv);
	init_resource();

	init_pcc();

	init_pmd_function();
	init_pmd_queue();

	gc_push(0,0,"main(2)");

	xl_setup_file(argc,argv);

	return 0;
}
