1/* BEGIN LICENSE BLOCK
2 * Version: CMPL 1.1
3 *
4 * The contents of this file are subject to the Cisco-style Mozilla Public
5 * License Version 1.1 (the "License"); you may not use this file except
6 * in compliance with the License.  You may obtain a copy of the License
7 * at www.eclipse-clp.org/license.
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11 * the License for the specific language governing rights and limitations
12 * under the License.
13 *
14 * The Original Code is  The ECLiPSe Constraint Logic Programming System.
15 * The Initial Developer of the Original Code is  Cisco Systems, Inc.
16 * Portions created by the Initial Developer are
17 * Copyright (C) 1997-2006 Cisco Systems, Inc.  All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * END LICENSE BLOCK */
22
23/*
24 * ECLiPSe LIBRARY MODULE
25 *
26 * $Id: eg_c_basic.c,v 1.1 2008/06/30 17:43:53 jschimpf Exp $
27 *
28 *
29 * IDENTIFICATION:	eg_c_basic.c
30 *
31 * AUTHOR:		Joachim Schimpf
32 * AUTHOR:		Stefano Novello
33 *
34 * CONTENTS:		name/arity
35 *
36 * DESCRIPTION:
37 *	Example of minimal main using string-based embed interface.
38 */
39
40#include	"eclipse.h"
41
42
43main(argc, argv)
44int             argc;
45char          **argv;
46{
47    char	buf[1024];
48    int		n;
49
50    ec_set_option_int(EC_OPTION_IO, MEMORY_IO);
51    ec_init();
52
53    ec_post_string("write(hello)");
54    ec_resume();
55
56    n = ec_queue_read(1, buf, 1024);
57    buf[n] = 0;
58    printf("eclipse returned: %s.\n", buf);
59
60    n = ec_queue_read(2, buf, 1024);
61    buf[n] = 0;
62    printf("eclipse error returned: %s.\n", buf);
63
64    ec_cleanup();
65    exit(0);
66}
67
68