| 1 | /* |
| 2 | * Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
| 3 | * Copyright (C) 2000 Dr.-Ing. Martin Froehlich <MartinFroehlich@ACM.org> |
| 4 | * |
| 5 | * PURPOSE OF THIS FILE: The main functions for a user augmented guile |
| 6 | * version that can handle wrapped calls as generated by the Simplified |
| 7 | * Wrapper and Interface Generator (SWIG 1.1) |
| 8 | * |
| 9 | * - Automatic Version Information via RCS/CVS: |
| 10 | * $Id: guilemain.i,v 1.6 2002/11/30 22:10:07 beazley Exp $ |
| 11 | * $Source: /cvsroot/swig/SWIG/Lib/guile/guilemain.i,v $ |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program; if not, write to the Free Software |
| 25 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 26 | */ |
| 27 | %{ |
| 28 | #include <libguile.h> |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | /* Debugger interface (don't change the order of the following lines) */ |
| 35 | #define GDB_TYPE SCM |
| 36 | #include <libguile/gdb_interface.h> |
| 37 | GDB_INTERFACE; |
| 38 | |
| 39 | static void |
| 40 | inner_main(void *closure, int argc, char **argv) |
| 41 | { |
| 42 | #ifdef SWIGINIT |
| 43 | SWIGINIT |
| 44 | #else |
| 45 | SWIG_init(); /* SWIG init function */ |
| 46 | #endif |
| 47 | scm_shell(argc, argv); /* scheme interpreter */ |
| 48 | /* never reached: scm_shell will perform an exit */ |
| 49 | } |
| 50 | |
| 51 | #ifdef __cplusplus |
| 52 | } |
| 53 | #endif |
| 54 | |
| 55 | int |
| 56 | main(int argc, char **argv) |
| 57 | { |
| 58 | /* put any default initialisation code here: e.g. exit handlers */ |
| 59 | scm_boot_guile(argc, argv, inner_main, 0); /* make a stack entry for the |
| 60 | garbage collector */ |
| 61 | return 0; /* never reached, but avoids a warning */ |
| 62 | } |
| 63 | %} |