/**********************************************************************
 
	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	"xlerror.h"
#include	"xl.h"

extern void gc_gb_sexp();
XL_SEXP * xl_svg();
XLISP_ENV * svg_env;

void
gc_svg()
{
	gc_gblisp_env(svg_env);
}

void
init_svg(XLISP_ENV * env)
{
	set_env(env,l_string(std_cm,"svg"),
		get_func_prim(xl_svg,FO_NORMAL,0,2,-1));
	svg_env = new_env(env);
	init_svg_path(svg_env);
}

XL_SEXP *
xl_svg(XLISP_ENV * env,XL_SEXP * s,
	XLISP_ENV * a,XL_SYM_FIELD * sf)
{
XL_SEXP * ret;
	for ( s = cdr(s) ; get_type(s) == XLT_PAIR ; s = cdr(s) ) {
		gc_push(0,0,"svg");
		ret = eval(svg_env,car(s));
		gc_pop(ret,gc_gb_sexp);
		if ( get_type(ret) == XLT_ERROR )
			break;
	}
	return ret;
}


