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_cc_basic.cc,v 1.2 2012/02/25 13:47:56 jschimpf Exp $ 27 * 28 * 29 * IDENTIFICATION: eg_cc_basic.cc 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 "eclipseclass.h" 41#include <iostream> 42 43int 44main() 45{ 46 char buf[1024]; 47 int n; 48 49 ec_set_option_int(EC_OPTION_IO, MEMORY_IO); 50 ec_init(); 51 52 ec_post_string("write(hello)"); 53 ec_resume(); 54 55 n = ec_queue_read(1, buf, 1024); 56 buf[n] = 0; 57 std::cout << "eclipse returned: " << buf << ".\n"; 58 59 n = ec_queue_read(2, buf, 1024); 60 buf[n] = 0; 61 std::cout << "eclipse error returned: " << buf << ".\n"; 62 63 ec_cleanup(); 64 exit(0); 65} 66 67