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) 2006 Cisco Systems, Inc. All Rights Reserved. 18% 19% Contributor(s): 20% 21% END LICENSE BLOCK 22 23\chapter{Parameters for Initialising an {\eclipse} engine} 24%HEVEA\cutdef[1]{section} 25 26\label{chapecoptions} 27It is possible to parametrise the initialisation of the \eclipse 28engine by calling the functions ec_set_option_long() and ec_set_option_ptr(). 29This must be done before initialisation. 30 31\begin{description} 32\item[Installation directory]\ \\ 33\begin{verbatim} 34 ec_set_option_ptr(EC_OPTION_ECLIPSEDIR, "/usr/tom/eclipse"); 35\end{verbatim} 36This can be used to tell an embedded {\eclipse} where to find it support files. 37The default setting is NULL, which means that the location is 38taken from the registry entry or from the ECLIPSEDIR environment variable. 39 40 41\item[Stack Memory Allocation]\ \\ 42\begin{verbatim} 43 ec_set_option_long(EC_OPTION_LOCALSIZE, 128*1024*1024); 44 ec_set_option_long(EC_OPTION_GLOBALSIZE, 128*1024*1024); 45\end{verbatim} 46The sizes in bytes of the stacks can be varied. They will be rounded to 47system specific pagesizes. On machines where initially only virtual memory 48is reserved rather than allocating real memory (WindowsNT/95, Solaris) they 49default to very large sizes (128MB), where real memory or space in the 50operating system swap file is taken immediately (SunOS), their default 51is very small (750KB,250KB). 52 53 54\item[Heap Memory Allocation]\ \\ 55\begin{verbatim} 56 ec_set_option_long(EC_OPTION_PRIVATESIZE, 32*1024*1024); 57 ec_set_option_long(EC_OPTION_SHAREDSIZE, 64*1024*1024); 58\end{verbatim} 59The sizes in bytes of the private and shared heaps. Normally these are 60ignored as the heaps grow as required. 61 62They are used in the parallel {\eclipse}, since there allocation is done 63at fixed addresses and in that case these sizes determine the maximum 64amount of memory per heap. 65 66 67\item[Panic Function]\ \\ 68\begin{verbatim} 69 void my_panic(char * what, char * where); 70 ... 71 ec_set_option_ptr(EC_OPTION_PANIC, my_panic); 72\end{verbatim} 73When {\eclipse} experiences an unrecoverable error, this function 74is called. By default a function that prints the panic message 75and exits is called. After such an error, one should not call any 76of the functions in this interface. 77 78 79\item[Startup Arguments]\ \\ 80\begin{verbatim} 81 char *args[] = {"a","b","c"} 82 ... 83 ec_set_option_long(EC_OPTION_ARGC, 3); 84 ec_set_option_ptr(EC_OPTION_ARGV, args); 85\end{verbatim} 86These setting are used to simulate a command line for an embedded 87{\eclipse}, or to pass command line information to an embedded 88{\eclipse}. The {\eclipse} built-in predicates (\verb.argc/1. 89and \verb.argv/2.) can access this information. This provides 90a way of passing some initial data to the {\eclipse} engine. 91 92 93\item[Default Module]\ \\ 94\begin{verbatim} 95 ec_set_option_ptr(EC_OPTION_DEFAULT_MODULE, "my_module"); 96\end{verbatim} 97The default module is the module in which goals called from the 98top-level execute. It is also the module that goals called from C 99or C++ execute in. The default setting is "eclipse". 100 101 102\item[I/O Initialisation]\ \\ 103\begin{verbatim} 104 ec_set_option_long(EC_OPTION_IO, MEMORY_IO); 105\end{verbatim} 106This option controls whether the default I/O streams of {\eclipse} are 107connected to stdin/stdout/stderr or to memory queues. 108The default setting of this option is SHARED_IO, which means the 109{\eclipse} streams 0,1,2 are connected to stdin/stdout/stderr. 110In an embedded application, stdin/stdout/stderr may not be available, 111or the host application may want to capture all I/O from {\eclipse}. 112In this case, use the MEMORY_IO setting, which creates queue streams 113for streams 0,1 and 2. These can then be read and written using 114ec_queue_read() and ec_queue_write(). 115 116 117\item[Parallel system parameters]\ \\ 118\begin{verbatim} 119 ec_set_option_long(EC_OPTION_PARALLEL_WORKER, 0); 120 ec_set_option_long(EC_OPTION_ALLOCATION, ALLOC_PRE); 121 ec_set_option_ptr(EC_OPTION_MAPFILE, NULL); 122\end{verbatim} 123The above options are set differently in {\eclipse} when it is a 124worker in a parallel system. They should not be altered. 125\end{description} 126 127%HEVEA\cutend 128