guile.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* Copyright (C) 1996, 1997, 2000, 2001, 2006, 2008,
  2. * 2011 Free Software Foundation, Inc.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public License
  6. * as published by the Free Software Foundation; either version 3 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301 USA
  18. */
  19. /* This is the 'main' function for the `guile' executable. It is not
  20. included in libguile.a.
  21. Eventually, we hope this file will be automatically generated,
  22. based on the list of installed, statically linked libraries on the
  23. system. For now, please don't put interesting code in here. */
  24. #ifdef HAVE_CONFIG_H
  25. # include <config.h>
  26. #endif
  27. #ifdef __MINGW32__
  28. # define SCM_IMPORT 1
  29. #endif
  30. #include <libguile.h>
  31. #ifdef HAVE_CONFIG_H
  32. #include <libguile/scmconfig.h>
  33. #endif
  34. #include <ltdl.h>
  35. #include <locale.h>
  36. #ifdef HAVE_WINSOCK2_H
  37. #include <winsock2.h>
  38. #endif
  39. /* Debugger interface (don't change the order of the following lines) */
  40. #define GDB_TYPE SCM
  41. #include <libguile/gdb_interface.h>
  42. GDB_INTERFACE;
  43. static void
  44. inner_main (void *closure SCM_UNUSED, int argc, char **argv)
  45. {
  46. #ifdef __MINGW32__
  47. /* This is necessary to startup the Winsock API under Win32. */
  48. WSADATA WSAData;
  49. WSAStartup (0x0202, &WSAData);
  50. GDB_INTERFACE_INIT;
  51. #endif /* __MINGW32__ */
  52. /* module initializations would go here */
  53. scm_shell (argc, argv);
  54. #ifdef __MINGW32__
  55. WSACleanup ();
  56. #endif /* __MINGW32__ */
  57. }
  58. int
  59. main (int argc, char **argv)
  60. {
  61. /* Install the locale right at the beginning so that string conversion
  62. for command-line arguments, along with possible error messages, use
  63. the right locale. See
  64. <https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00041.html>
  65. for the rationale. */
  66. if (setlocale (LC_ALL, "") == NULL)
  67. fprintf (stderr, "guile: warning: failed to install locale\n");
  68. scm_install_gmp_memory_functions = 1;
  69. scm_boot_guile (argc, argv, inner_main, 0);
  70. return 0; /* never reached */
  71. }
  72. /*
  73. Local Variables:
  74. c-file-style: "gnu"
  75. End:
  76. */