main_xsb.c

00001 /* File:      main_xsb.c
00002 ** Author(s): Warren
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 1993-1998
00006 ** 
00007 ** XSB is free software; you can redistribute it and/or modify it under the
00008 ** terms of the GNU Library General Public License as published by the Free
00009 ** Software Foundation; either version 2 of the License, or (at your option)
00010 ** any later version.
00011 ** 
00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00015 ** more details.
00016 ** 
00017 ** You should have received a copy of the GNU Library General Public License
00018 ** along with XSB; if not, write to the Free Software Foundation,
00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 **
00021 ** $Id: main_xsb.c,v 1.10 2005/12/22 23:33:56 tswift Exp $
00022 ** 
00023 */
00024 
00025 
00026 #include "xsb_config.h"
00027 
00028 
00029 #ifdef WIN_NT
00030 #include <direct.h>
00031 #include <io.h>
00032 #else
00033 #include <unistd.h>
00034 #endif
00035 
00036 #include <fcntl.h>
00037 #include <stdio.h>
00038 #include <stdlib.h>
00039 #include <string.h>
00040 #include <sys/types.h>
00041 #include <sys/stat.h>
00042 /* wind2unix.h must be included after sys/stat.h */
00043 #include "wind2unix.h"
00044 
00045 #include "context.h"
00046 #include "emuloop.h"
00047 
00048 #ifdef HAVE_SOCKET
00049 #ifdef WIN_NT
00050 #include <windows.h>
00051 #include <winsock.h>
00052 #endif
00053 #endif
00054 
00055 #include "orient_xsb.h"
00056 #include "basicdefs.h"
00057 
00058 int main(int argc, char *argv[])
00059 { 
00060 #ifdef MULTI_THREAD
00061    static th_context *th ;
00062 #endif
00063 
00064 #ifdef HAVE_SOCKET
00065 #ifdef WIN_NT
00066   INT err;
00067   WSADATA wsaData;
00068 #ifdef SILENT_NT
00069   FILE *stream_err, *stream_out;
00070   stream_err = freopen("errorlog", "w", stderr);
00071   stream_out = freopen("outlog", "w", stdout);
00072 #endif
00073   err = WSAStartup(0x0101, &wsaData);
00074   if (err == SOCKET_ERROR) {
00075     fprintf (stdout, "WSAStartup Failed\n");
00076     return FALSE;
00077   }
00078 #endif
00079 #endif
00080 
00081 #ifdef MULTI_THREAD
00082   th = malloc( sizeof( th_context ) ) ;  /* don't use mem_alloc */
00083 #endif
00084 
00085   xsb(CTXTc 0, argc, argv);  /* init xsb */
00086 
00087   xsb(CTXTc 1, 0, 0);        /* normal execution */
00088   xsb(CTXTc 2, 0, 0);        /* when halts, exit */
00089   return 0;
00090 }
00091 

Generated on Wed Jul 26 13:30:41 2006 for XSB by  doxygen 1.4.5