/*
 * The Spar Library - modular math parser
 * Copyright (C) 2000,2001 Davide Angelocola <davide178@inwind.it>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License.
 *
 * This library 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.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 *
 */

#ifndef _sl_application_h
#define _sl_application_h

#include <spar/sl.h>

/*
 *  Flags understood by sl_application->options
 */
#define	SL_APP_GETOPT 		0x0001
#define	SL_APP_MODULES 		0x0002
#define	SL_APP_PRECISION 	0x0004

#define SL_APP_COMPLETE		(SL_APP_GETOPT | SL_APP_MODULES | SL_APP_PRECISION)

#define SL_APP_DEFAULTS		SL_APP_COMPLETE

struct application_s
{
  const char *name;
  const char *version;
  const char *author;
  const char *description;
  const char *welcome;

  int options;
  char modules_config_file[255];

  int (*main) (int argc, char **argv);
  int (*init) (void);
  int (*de_init) (void);
};

typedef struct application_s sl_application;

__BEGIN_DECLS
  int sl_application_run (sl_application * app, int argc, char **argv);
void sl_application_exit (int _exit_code);
__END_DECLS
/*
 *  Call this to RUN your sl applications
 *  
 *  As you can is a very simple macro. 
 */
#define SL_APPLICATION(x)				\
	int main (int argc, char **argv) { 		\
		return sl_application_run (&(x), argc, argv);	\
	}
#endif /* _sl_application_h */


syntax highlighted by Code2HTML, v. 0.9.1