View source with raw comments or as raw
    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)  2011-2025, VU University Amsterdam
    7                              CWI, Amsterdam
    8                              SWI-Prolog Solutions b.v.
    9    All rights reserved.
   10
   11    Redistribution and use in source and binary forms, with or without
   12    modification, are permitted provided that the following conditions
   13    are met:
   14
   15    1. Redistributions of source code must retain the above copyright
   16       notice, this list of conditions and the following disclaimer.
   17
   18    2. Redistributions in binary form must reproduce the above copyright
   19       notice, this list of conditions and the following disclaimer in
   20       the documentation and/or other materials provided with the
   21       distribution.
   22
   23    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   24    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   25    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   26    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   27    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   28    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   29    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   30    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   31    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   33    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   34    POSSIBILITY OF SUCH DAMAGE.
   35*/
   36
   37:- module(prolog_system_predicate_options, []).

Provide declarations for options to built-in predicates

*/

   42:- predicate_options(system:open/4, 4,
   43		     [ type(oneof([text,binary])),
   44		       alias(atom),
   45		       encoding(encoding),
   46                       newline(oneof([dos,posix,detect])),
   47		       bom(boolean),
   48		       create(list(atom)),
   49		       eof_action(oneof([eof_code,error,reset])),
   50		       buffer(oneof([full,line,false])),
   51		       close_on_abort(boolean),
   52		       close_on_exec(boolean),
   53		       lock(oneof([none,read,shared,write,exclusive])),
   54                       reposition(boolean),
   55		       wait(boolean),
   56		       locale(any)		% no type-check yet
   57		     ]).   58:- predicate_options(system:write_term/3, 3,
   59		     [ attributes(oneof([ignore,dots,write,portray])),
   60		       backquoted_string(boolean),
   61		       blobs(oneof([portray])),
   62                       brace_terms(boolean),
   63		       character_escapes(boolean),
   64                       character_escapes_unicode(boolean),
   65		       cycles(boolean),
   66		       fullstop(boolean),
   67		       nl(boolean),
   68                       no_lists(boolean),
   69		       ignore_ops(boolean),
   70		       max_depth(nonneg),
   71		       module(atom),
   72		       numbervars(boolean),
   73		       partial(boolean),
   74		       portray(boolean),
   75		       portray_goal(callable+2), % as in meta_predicate
   76		       priority(between(0,1200)),
   77                       quote_non_ascii(boolean),
   78		       quoted(boolean),
   79		       spacing(oneof([standard,next_argument])),
   80		       variable_names(list)
   81		     ]).   82:- predicate_options(system:write_term/2, 2,
   83		     [ pass_to(system:write_term/3, 3)
   84		     ]).   85:- predicate_options(system:write_length/3, 3,
   86		     [ max_length(nonneg),
   87		       pass_to(system:write_term/3, 3)
   88		     ]).   89:- predicate_options(system:read_clause/3, 3,
   90		     [ syntax_errors(oneof([error,fail,quiet,dec10])),
   91		       process_comment(boolean),
   92		       term_position(-any),
   93		       variable_names(-list),
   94		       subterm_positions(-any),
   95		       comments(-list)
   96		     ]).   97:- predicate_options(system:read_term/3, 3,
   98		     [ backquoted_string(boolean),
   99		       character_escapes(boolean),
  100		       comments(-any),
  101		       cycles(boolean),
  102		       double_quotes(boolean),
  103		       module(atom),
  104		       singletons(-list),
  105		       syntax_errors(oneof([error,fail,quiet,dec10])),
  106		       subterm_positions(-any),
  107		       term_position(-any),
  108		       variables(-list),
  109		       variable_names(-list)
  110		     ]).  111:- predicate_options(system:read_term/2, 2,
  112		     [ pass_to(system:read_term/3, 3)
  113		     ]).  114:- predicate_options(system:numbervars/4, 4,
  115		     [ functor_name(atom),
  116		       attvar(oneof([skip,bind,error])),
  117		       singletons(boolean)
  118		     ]).  119:- predicate_options(system:absolute_file_name/3, 3,
  120		     [ extensions(list(atom)),
  121		       relative_to(atom),
  122		       access(oneof([read,write,append,execute,exist,none])),
  123		       file_type(oneof([txt,prolog,source,qlf,executable,directory])),
  124		       file_errors(oneof([fail,error])),
  125		       solutions(oneof([first,all])),
  126		       expand(boolean)
  127		     ]).  128:- predicate_options(system:load_files/2, 2,
  129		     [ autoload(boolean),
  130		       derived_from(atom),
  131                       dialect(atom),
  132		       encoding(encoding),
  133		       expand(boolean),
  134		       format(oneof([source,qlf])),
  135		       if(oneof([true,changed,not_loaded])),
  136		       imports(any),
  137		       modified(float),
  138		       module(atom),
  139                       check_script(boolean),
  140		       must_be_module(boolean),
  141		       qcompile(oneof([never,auto,large,part])),
  142                       optimise(boolean),
  143		       redefine_module(oneof([false,true,ask])),
  144		       reexport(boolean),
  145		       sandboxed(boolean),
  146		       scope_settings(boolean),
  147		       silent(boolean),
  148		       stream(any),
  149                       '$qlf'(atom)
  150		     ]).  151:- predicate_options(system:qcompile/2, 2,
  152		     [ pass_to(system:load_files/2, 2)
  153		     ]).  154:- predicate_options(system:close/2, 2,
  155		     [ force(boolean)
  156		     ]).  157:- predicate_options(system:create_prolog_flag/3, 3,
  158		     [ access(oneof([read_write,read_only])),
  159		       type(( oneof([boolean,atom,integer,float,term])
  160                            ; compound(oneof(list(atom)))
  161                            )),
  162		       keep(boolean),
  163                       warn_not_accessed(boolean)
  164		     ]).  165:- predicate_options(system:qsave_program/2, 2,
  166		     [ local(nonneg),
  167		       global(nonneg),
  168		       trail(nonneg),
  169		       argument(nonneg),
  170		       goal(callable),
  171		       toplevel(callable),
  172		       init_file(atom),
  173		       class(oneof([runtime,kernel,development])),
  174		       autoload(boolean),
  175		       map(atom),
  176		       op(oneof([save,standard])),
  177		       stand_alone(boolean),
  178		       emulator(atom)
  179		     ]).  180:- predicate_options(system:thread_create/3, 3,
  181		     [ affinity(list(integer)),
  182                       alias(atom),
  183		       at_exit(callable),
  184		       debug(boolean),
  185		       inherit_from(any),
  186		       detached(boolean),
  187                       stack_limit(nonneg),
  188		       c_stack(nonneg),
  189                       queue_max_size(nonneg)
  190		     ]).  191:- predicate_options(system:message_queue_create/2, 2,
  192		     [ alias(atom),
  193		       max_size(nonneg)
  194		     ]).  195:- predicate_options(system:mutex_create/2, 2,
  196		     [ alias(atom)
  197		     ]).  198:- predicate_options(system:thread_send_message/3, 3,
  199		     [ timeout(number),
  200		       deadline(number),
  201		       signals(any)
  202		     ]).  203:- predicate_options(system:thread_get_message/3, 3,
  204		     [ timeout(number),
  205		       deadline(number),
  206		       signals(any)
  207		     ]).  208:- predicate_options(system:locale_create/3, 3,
  209		     [ alias(atom),
  210		       decimal_point(atom),
  211		       thousands_sep(atom),
  212		       grouping(list(any))
  213		     ]).  214:- predicate_options(system:term_string/3, 3,
  215		     [ pass_to(system:write_term/3, 3),
  216		       pass_to(system:read_term/3, 3)
  217		     ]).  218:- predicate_options(system:wildcard_match/3, 3,
  219		     [ case_sensitive(boolean)
  220		     ]).  221:- predicate_options('$syspreds':(dynamic)/2, 2,
  222		     [ incremental(boolean),
  223                       abstract(between(0,0)),
  224                       volatile(boolean),
  225                       discontiguous(boolean),
  226                       multifile(boolean),
  227                       thread(oneof([local,shared]))
  228		     ]).  229:- predicate_options(system:prolog_listen/3, 3,
  230                     [ as(oneof([first,last])),
  231                       name(atom)
  232                     ]).  233:- predicate_options(system:open_shared_object/3, 3,
  234                     [ resolve(oneof([lazy,now])),
  235                       visibility(oneof([local,global])),
  236                       now(bool),
  237                       global(bool),
  238		       delete(bool),
  239		       load(bool),
  240		       deepbind(bool)
  241                     ]).  242:- predicate_options('$pack':attach_packs/2, 2,
  243                     [ duplicate(oneof([warning,keep,replace])),
  244                       search(oneof([first,last])),
  245                       replace(boolean)
  246                     ]).