/*
 *
 * u s e r i n i t . c			-- The place where user put his/her
 *					   initialization
 *
 * Copyright (C) 1993,1994,1995 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
 * 
 *
 * Permission to use, copy, and/or distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that both the above copyright notice and this permission notice appear in
 * all copies and derived works.  Fees for distribution or use of this
 * software or derived works may only be charged with express written
 * permission of the copyright holder.  
 * This software is provided ``as is'' without express or implied warranty.
 *
 * This software is a derivative work of other copyrighted softwares; the
 * copyright notices of these softwares are placed in the file COPYRIGHTS
 *
 *
 *           Author: Erick Gallesio [eg@kaolin.unice.fr]
 *    Creation date: 23-Jan-1994 19:09
 * Last file update: 26-Sep-1996 (berryj@dimacs.rutgers.edu)
 */
#include <stk.h>
/* #ifdef _cplusplus
 * extern "C" {
 * #endif
 */
#include <LINK/stkWrapper/LINK_STk.h>
#include <LINK/wrappers/basicSTkInit.h>
#include <LINK/wrappers/graphSTkInit.h>
#include <LINK/wrappers/algorithmSTkInit.h>
#include <LINK/wrappers/generatorSTkInit.h>
#include <LINK/wrappers/layoutSTkInit.h>
#include <LINK/wrappers/userobjSTkInit.h>

void STk_LINK_extension_init();
void STk_LINK_extension_cleanup();

#include <iostream.h>
void STk_user_init(void)
{
  /* Put here the code you want to be run at init time */
	Link_initRand();
	STk_eval_C_string("(require \"hash\")", NIL);
	STk_eval_C_string("(require \"Tk-classes\")", NIL);
	cout << "defining Link methods......." << endl;
	STk_init_CXXwrapper();
	STk_basic_init();
	STk_graph_init();
	STk_algorithm_init();
	STk_generator_init();
	STk_layout_init();
	STk_userobj_init();
	STk_LINK_extension_init();
	cout << "loading Link interface......" << endl;
        STk_eval_C_string("(let ((ss (getenv \"STK_LOAD_PATH\")))"
                            "(cond ((equal? ss \"\") "
	"(display \"error: STK_LOAD_PATH must contain $LINK_BASE/stklos\n\"))"
					"))", NIL);
	STk_eval_C_string("(require \"main-window\")", NIL);
	STk_eval_C_string("(define gv (make <graph-view> :graph (mubingraph)))",
					NIL);
	//cout << "loading Link tutorial......" << endl;
	//STk_eval_C_string("(require \"link-wtour\")", NIL);
}
void STk_user_cleanup(void)
{
  /* Put here the code you want to be run when the interpreter dies */
	STk_basic_cleanup();
	STk_graph_cleanup();
	STk_algorithm_cleanup();
	STk_generator_cleanup();
	STk_layout_cleanup();
	STk_userobj_cleanup();
	STk_LINK_extension_cleanup();
}
/*#ifdef _cplusplus
}
#endif*/
