View source with formatted comments or as raw
    1/*  Part of XPCE --- The SWI-Prolog GUI toolkit
    2
    3    Author:        Jan Wielemaker and Anjo Anjewierden
    4    E-mail:        J.Wielemaker@cwi.nl
    5    WWW:           http://www.swi.psy.uva.nl/projects/xpce/
    6    Copyright (c)  2001-2020, 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:- module(pce_swi_hooks, []).   37:- autoload(swi_compatibility, [auto_call/1]).   38
   39/** <module> Hook XPCE based graphics tools into IDE
   40
   41Loading this file enables the graphical  frontends for the online manual
   42and profiler. This file is normally   loaded from swipl.rc (swipl-win.rc
   43on Windows); the file that makes XPCE known to Prolog.
   44
   45This file uses call/1 to call the real work to avoid undefined predicate
   46messages when using make/0 (calling list_undefined/0).
   47
   48Since  the  introduction   of   the    more   advanced   autoloader   in
   49library(prolog_autoload), using call/1 no longer   suffices to stop this
   50file from being loaded.
   51*/
   52
   53:- set_module(class(development)).   54
   55:- multifile
   56    prolog:debug_control_hook/1,
   57    prolog:show_profile_hook/1,             % new
   58    prolog:show_profile_hook/2.             % compatibility
   59
   60
   61                 /*******************************
   62                 *          DEBUG HOOKS         *
   63                 *******************************/
   64
   65prolog:debug_control_hook(spy(Method)) :-
   66    auto_call(spypce(Method)).
   67prolog:debug_control_hook(nospy(Method)) :-
   68    auto_call(nospypce(Method)).
   69
   70
   71                 /*******************************
   72                 *           PROFILING          *
   73                 *******************************/
   74
   75prolog:show_profile_hook(_Options) :-
   76    auto_call(pce_show_profile).
   77prolog:show_profile_hook(_Style, _Top) :-
   78    auto_call(pce_show_profile).
   79
   80
   81                 /*******************************
   82                 *             SOURCE           *
   83                 *******************************/
   84
   85%!  prolog:alternate_syntax(?Syntax, +Module, -Setup, -Restore)
   86%
   87%   Implements operator handling for reading   arbitrary  terms from
   88%   XPCE classes.
   89
   90:- multifile
   91    prolog:alternate_syntax/4.   92
   93prolog:alternate_syntax(pce_class, M, pce_expansion:push_compile_operators(M),
   94                                      pce_expansion:pop_compile_operators) :-
   95    current_prolog_flag(xpce, true)