File: main.c

package info (click to toggle)
swi-prolog-packages 5.0.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 50,688 kB
  • ctags: 25,904
  • sloc: ansic: 195,096; perl: 91,425; cpp: 7,660; sh: 3,046; makefile: 2,750; yacc: 843; awk: 14; sed: 12
file content (50 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*	main.c

	The new SWI-Prolog main for the MP library interface for SWI-Prolog,
	version 1.3
	Needs installation of GMP: the GNU Multiple Precision arithmetic library
	version 3.0.1

	Copyright (c) 1999 Robert A. van Engelen, Florida State University
	engelen@cs.fsu.edu. All rights reserved.
*/

#include <stdio.h>
#include "SWI-Prolog.h"
#include "pl-mp.h"
#define READLINE 1                      /* use readline interface */


#ifdef READLINE
static void
install_readline(int argc, char **argv)
{	PL_install_readline();
}
#endif

static void
install_mp(int argc, char **argv)
{	mp_install();
}

int main(int argc, char **argv)
{
#ifdef READLINE
	PL_initialise_hook(install_readline);
#endif
	PL_initialise_hook(install_mp);

	/* This is the only PL_ call allowed */
        /* before PL_initialise().  It */
        /* ensures the foreign predicates */
        /* are available before loading */
        /* Prolog code */

	if ( !PL_initialise(argc, argv) )
		PL_halt(1);

	PL_halt(PL_toplevel() ? 0 : 1);

	return 0;
}