/* libsizzle/capi.h - C API function declarations
 
  Copyright (C) 2000 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
 
  This is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.
  
  This software 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 General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with this package; see the file COPYING.  If not, write to the
  Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  MA 02111-1307, USA.  */

#ifndef __SIZZLE_CAPI_H__
#define __SIZZLE_CAPI_H__

#if HAVE_CONFIG_H
# include <config.h>
#endif 

#if __SIZZLE_IMPORT__
# define SIZZLE_API __declspec (dllimport)
#elif __SIZZLE_EXPORT__ 
# define SIZZLE_API __declspec (dllexport)
#else
# define SIZZLE_API
#endif

#include "node.h"

/* Get the value of the variable called @var{sym} and return the value
   in the variable pointed to by @var{result}.  On success,
   @code{RESULT_SUCCESS} is returned; on error an error code is
   returned and an error object is stored in the location pointed to
   by @var{result}.  */
SIZZLE_API result_t zzz_get_variable (zzz_scm_t sym, zzz_scm_t * result);

/* Store the value @var{value} into the variable called.  On success,
   @code{RESULT_SUCCESS} is returned; on error, an error code is
   returned and an error object is stored in the location pointed to
   by @var{result}.  */
SIZZLE_API result_t zzz_set_variable (zzz_scm_t sym, zzz_scm_t value,
				      zzz_scm_t * result);

/* Create a variable named @var{name} with @var{value} as its value
   and return the symbol to which @var{value} will get bound. */
SIZZLE_API zzz_scm_t zzz_define_variable (char * name, zzz_scm_t value);

/* Create a read-only variable (a constant) named @var{name} with
   @var{value} as its value and return the symbol to which @var{VALUE}
   will get bound.  */
SIZZLE_API zzz_scm_t zzz_define_constant (char * name, zzz_scm_t value);

/* The same as @code{zzz_define_constant}, but defines the read-only
   variable only in the module @var{module}.  */
SIZZLE_API zzz_scm_t zzz_c_define_constant (zzz_scm_t module, char * name,
					    zzz_scm_t value);

/* Define a function called @var{name} which refers to the builtin
   function @var{func} and takes parameters as specified by
   @var{param_format}.  */
SIZZLE_API zzz_scm_t zzz_define_function (char * name, zzz_prim_t,
					  int param_format);

/* Same as @code{zzz_define_function}, but defines the function only
   in the module @var{module}.  */
SIZZLE_API zzz_scm_t zzz_c_define_function (zzz_scm_t module,
					    char * name, zzz_prim_t,
					    int param_format);

/* Define a special form called @var{name} which refers to the builtin
   function @var{func}.  If @var{preprocessing} is true, the function
   @var{func} does not perform any operation besides rewriting the
   evaluation tree for further processing.  */
SIZZLE_API zzz_scm_t zzz_define_form (char * name, zzz_prim_t func,
				      int prepocessing);

/* Same as @code{zzz_define_form}, but defines the syntactic form only
   in the module @var{module}.  */
SIZZLE_API zzz_scm_t zzz_c_define_form (zzz_scm_t module, char * name,
					zzz_prim_t func, int prepocessing);

/* Loads successive expressions from the string @var{str} and
  evaluates them one after the other in the environment @var{env}.
  Returns 0 on success, -2 if an error occured during evaluation and
  error code @var{x} if @code{(exit @var{x})} was evaluated in the
  code.  */
SIZZLE_API int zzz_evaluate_string (zzz_scm_t env, char * str);

/* Loads successive expressions from the file @var{file_name} and
  evaluates them one after the other in the environment @var{env}.
  Returns 0 on success, -1 if the file was not found, -2 if an error
  occured during evaluation and error code @var{x} if @code{(exit
  @var{x})} was evaluated in the code.  */
SIZZLE_API int zzz_evaluate_file (zzz_scm_t env, char * filename);

#endif /* not __SIZZLE_CAPI_H__ */
