1 /* Part of SWI-Prolog 2 3 Author: Jan Wielemaker 4 E-mail: J.Wielemaker@vu.nl 5 WWW: http://www.swi-prolog.org 6 Copyright (c) 2012-2019, University of Amsterdam 7 CWI, Amsterdam 8 All rights reserved. 9 10 Redistribution and use in source and binary forms, with or without 11 modification, are permitted provided that the following conditions 12 are met: 13 14 1. Redistributions of source code must retain the above copyright 15 notice, this list of conditions and the following disclaimer. 16 17 2. Redistributions in binary form must reproduce the above copyright 18 notice, this list of conditions and the following disclaimer in 19 the documentation and/or other materials provided with the 20 distribution. 21 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 /******************************** 37 * STRUCTURES * 38 ********************************/ 39 40 typedef struct 41 { char *state; /* system's boot file */ 42 char *startup; /* default user startup file */ 43 size_t stack_limit; /* default stack limit (bytes) */ 44 size_t table_space; /* default table space (bytes) */ 45 #ifdef O_PLMT 46 size_t shared_table_space; /* default space for shared tables */ 47 #endif 48 char *goal; /* default initialisation goal */ 49 char *toplevel; /* default top level goal */ 50 bool notty; /* use tty? */ 51 char *arch; /* machine/OS we are using */ 52 char *home; /* systems home directory */ 53 } pl_defaults_t; 54 55 typedef struct opt_list 56 { struct opt_list *next; 57 char *opt_val; 58 } opt_list; 59 60 typedef struct 61 { size_t stackLimit; /* Total stack limit */ 62 size_t tableSpace; /* table space */ 63 #ifdef O_PLMT 64 size_t sharedTableSpace; /* table space for shared tables */ 65 #endif 66 opt_list *goals; /* initialization goals */ 67 char * topLevel; /* toplevel goal */ 68 char * initFile; /* -f initialisation file */ 69 char * systemInitFile; /* -F initialisation file */ 70 char * config; /* Show config info */ 71 opt_list *scriptFiles; 72 opt_list *search_paths; /* -p path */ 73 char * pldoc_server; /* --pldoc=Server */ 74 char * compileOut; /* file to store compiler output */ 75 char * saveclass; /* Type of saved state */ 76 bool silent; /* -q: quiet operation */ 77 bool traditional; /* --traditional: no version 7 exts */ 78 bool nothreads; /* --no-threads */ 79 int xpce; /* --no-pce */ 80 #ifdef __WINDOWS__ 81 bool win_app; /* --win_app: be Windows application */ 82 #endif 83 } pl_options_t; 84 85 COMMON(int) opt_append(opt_list **l, const char *s); 86 87 88 /******************************** 89 * PARAMETERS * 90 ********************************/ 91 92 #ifndef DEFSTARTUP 93 #define DEFSTARTUP "init.pl" 94 #endif 95 #ifndef SYSTEMHOME 96 #define SYSTEMHOME "/usr/lib/swipl" 97 #endif 98 #ifndef NOTTYCONTROL 99 #define NOTTYCONTROL FALSE 100 #endif 101 102 #ifndef PLARCH 103 #define PLARCH "unknown" 104 #endif 105 #ifndef OS 106 #define OS "unknown" 107 #endif 108 109 110 #define DEF_DEFDEFSTACKLIMIT (((size_t)1024/8)*1024*1024*SIZEOF_VOIDP) 111 #define DEF_DEFTABLE (((size_t)1024/8)*1024*1024*SIZEOF_VOIDP) 112 113 #ifndef DEFSTACKLIMIT 114 #define DEFSTACKLIMIT DEF_DEFDEFSTACKLIMIT 115 #endif 116 #ifndef DEFTABLE 117 #define DEFTABLE DEF_DEFTABLE 118 #endif 119 120 /* Parameters that control findHome() */ 121 122 #define PLHOMEVAR_1 "SWI_HOME_DIR" 123 #define PLHOMEVAR_2 "SWIPL" 124 #define PLHOMEFILE "swipl.home" 125