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

XL_SEXP *
setup_info_cmd(WF_ID wfid,RESOURCE * r,int code,XL_SEXP * info);

XL_SEXP *
dgb_information(XLISP_ENV * e,XL_SEXP * s,
	XLISP_ENV * a,XL_SYM_FIELD * sf)
{
OBJ * obj;
RESOURCE * r;
XL_SEXP * ret;
int code;
	r = get_resource_ptr(&ret,e,s->h.file,s->h.line);
	if ( r == 0 )
		return ret;
	if ( r->h.type != RT_DRAW_GB )
		er_panic("dgb_polygon2d(2)");
	code = 0;
	for ( ; sf ; sf = sf->next ) {
		if ( l_strcmp(sf->name,l_string(std_cm,"code")) == 0 ) {
			sscanf(n_string(std_cm,sf->data),"%i",&code);
		}
	}
	r->draw_gb.flags |= DGF_INFO;

	return setup_info_cmd(search_wf(r),r,code,s);
no_obj:
	return get_error(
		s->h.file,
		s->h.line,
		XLE_PROTO_UNDEF_NAME,
		l_string(std_cm,"set-color-palette"),
		list(n_get_string("no object"),0));
}
