1/* 2 * BEGIN LICENSE BLOCK 3 * Version: CMPL 1.1 4 * 5 * The contents of this file are subject to the Cisco-style Mozilla Public 6 * License Version 1.1 (the "License"); you may not use this file except 7 * in compliance with the License. You may obtain a copy of the License 8 * at www.eclipse-clp.org/license. 9 * 10 * Software distributed under the License is distributed on an "AS IS" 11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 12 * the License for the specific language governing rights and limitations 13 * under the License. 14 * 15 * The Original Code is The ECLiPSe Constraint Logic Programming System. 16 * The Initial Developer of the Original Code is Cisco Systems, Inc. 17 * Portions created by the Initial Developer are 18 * Copyright (C) 1990,2006 Cisco Systems, Inc. All Rights Reserved. 19 * 20 * Contributor(s): Mireille Ducasse, ECRC. 21 * 22 * END LICENSE BLOCK 23 * 24 * $Id: loadopium.pl,v 1.1 2006/09/23 01:54:33 snovello Exp $ 25 * 26 */ 27 28/* 29 * boot file for Opium 30 */ 31 32/* to avoid seeing the singleton variable checkings */ 33:- set_flag(variable_names, on). 34 35:- import set_opium_level/1 from sepia_kernel. 36 37:- get_flag(prolog_suffix, S), set_flag(prolog_suffix, [".op" | S]). 38 39/* to initialize module opium_kernel (not quite the same as opium_module.pl) */ 40:- op(400, xfy, ':'). 41:- op(500, fx, =). 42:- op(500, fx, <). 43:- op(500, fx, =<). 44:- op(500, fx, >). 45:- op(500, fx, >=). 46 47:- dynamic 48 opium_command/10, 49 opium_parameter/8, 50 opium_primitive/7, 51 opium_procedure/6, 52 opium_scenario/6, 53 opium_type/4, 54 opium_demo/5, 55 autoload_command/2, 56 autoload_scenario/4. 57 58opium_module. 59 60 61/* mandatory for bootstrapping */ 62 63/* to avoid that file is dumped in compiled query 64 */ 65mycompile(F) :- 66 compile(F). 67 68:- get_opium_file("opium", F), mycompile(F). 69:- get_opium_file("error", F), mycompile(F). 70:- get_opium_file("interface", F), mycompile(F). 71:- get_flag(extension,kegi_xview) -> 72 get_opium_file("interface_pce", F), mycompile(F) ; true. 73:- get_opium_file("kernel", F), mycompile(F). 74:- get_opium_file("scenario_handler", F), mycompile(F). 75:- get_opium_file("make", F), mycompile(F). 76:- get_opium_file("parameter", F), mycompile(F). 77:- get_opium_file("scenario", F), mycompile(F). 78:- get_opium_file("translate", F), mycompile(F). 79:- get_opium_file("types", F), mycompile(F). 80 81 82/* 83 * link commands/procedures to implementations to enable the bootstrapping 84 * before the scenario handler links together commands/procedures and their 85 * implementations 86 */ 87 88make(S, MOD, OL, SD, OD) :- make_scenario_Op(S, MOD, OL, SD, OD). 89opium_scenario_in_module(S, M) :- opium_scenario_in_module_Op(S, M). 90set_default_parameters_in_module(S, Mod) :- set_default_parameters_in_module_Op(S, Mod). 91check_arg_type(X, Y, Z, T, M) :- check_arg_type_Op(X, Y, Z, T, M). 92check_arg(X, Y, Z, T, M) :- check_arg_Op(X, Y, Z, T, M). 93modify_time(F, T) :- modify_time_Op(F, T). 94 95is_list(X) :- is_list_Op(X). 96is_list_of_atoms(X) :- is_list_of_atoms_Op(X). 97is_list_of_atoms_or_empty_list(X) :- is_list_of_atoms_or_empty_list_Op(X). 98is_list_of_vars_or_empty_list(X) :- is_list_of_vars_or_empty_list_Op(X). 99is_list_of_ports(X) :- is_list_of_ports_Op(X). 100is_opium_declaration(P/A) :- is_opium_declaration_Op(P/A). 101is_opium_module(M) :- is_opium_module_Op(M). 102opium_module(M) :- opium_module_Op(M). 103 104interface_status(X) :- interface_status_Op(X). 105 106opium_write(V, M) :- opium_write_Op(V, M). 107opium_printf(V, F, A) :- opium_printf_Op(V, F, A). 108opium_printf(V, F, A, S) :- opium_printf_Op(V, F, A, S). 109opium_nl(V) :- opium_nl_Op(V). 110 111 112/* -------------------------------------------------------- 113 * boot opium 114 * make all the scenarios which should be loaded in Opium 115 * -------------------------------------------------------- 116 */ 117 118boot_opium(WUI) :- 119 get_opiumdir(SDS), 120 append_strings(SDS, "opiumfiles/", ODS), 121 atom_string(SD, SDS), 122 atom_string(OD, ODS), 123 TracGlobal = [active, traceable, global], 124 UntrGlobal = [active, untraceable, global], 125 TracLocal = [active, traceable, local], 126 UntrLocal = [active, untraceable, local], 127 /* scenario_handler has to be laoded first */ 128 make(scenario_handler, opium_kernel, UntrGlobal, SD, OD), 129 make(kernel, opium_kernel, UntrGlobal, SD, OD), 130 make(source, opium_kernel, UntrGlobal, SD, OD), 131 make(display, opium_kernel, UntrGlobal, SD, OD), 132 /* interface scenario requires help scenario */ 133 make(help, opium, UntrGlobal, SD, OD), 134 make(interface, opium_kernel, UntrGlobal, SD, OD), 135 ( WUI == pce 136 -> /* libraries required to compile the pce files */ 137 ( get_flag(extension, development) 138 -> lib(kegi, kegi), 139 lib(k_pce, kegi) 140 ; true), 141 compile(pce_new, kegi), 142 make(interface_pce, opium_kernel, UntrGlobal, SD, OD) 143 ; 144 true 145 ), 146 make(step_by_step, opium, UntrGlobal, SD, OD), 147 make(zooming, opium, UntrGlobal, SD, OD), 148 make(ancestor, opium, UntrGlobal, SD, OD), 149 make(conditional_spypoints, opium, UntrGlobal, SD, OD), 150 make(lint, opium, UntrGlobal, SD, OD), 151 make(loop, loop, UntrGlobal, SD, OD), 152 make(abstracts, abstracts, UntrGlobal, SD, OD), 153 make(failure, abstracts, UntrGlobal, SD, OD), 154 make(lo, lo, UntrGlobal, SD, OD). 155 156:- get_flag(extension,kegi_xview) -> boot_opium(pce) ; boot_opium(tty). 157