View source with raw comments or as raw
    1/*  Part of SWI-Prolog
    2
    3    Author:        Jan Wielemaker
    4    E-mail:        jan@swi-prolog.org
    5    WWW:           https://www.swi-prolog.org
    6    Copyright (c)  2011-2026, 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		       unicode_atoms(oneof([accept,nfc,error,reject]))
   58		     ]).   59:- predicate_options(system:write_term/3, 3,
   60		     [ attributes(oneof([ignore,dots,write,portray])),
   61		       backquoted_string(boolean),
   62		       blobs(oneof([portray])),
   63                       brace_terms(boolean),
   64		       character_escapes(boolean),
   65                       character_escapes_unicode(boolean),
   66		       cycles(boolean),
   67		       fullstop(boolean),
   68		       nl(boolean),
   69                       no_lists(boolean),
   70		       ignore_ops(boolean),
   71		       portable(boolean),
   72                       pattern_syntax_solo(boolean),
   73		       max_depth(nonneg),
   74		       max_text(nonneg),
   75                       truncated(-boolean),
   76		       module(atom),
   77		       numbervars(boolean),
   78		       partial(boolean),
   79		       portray(boolean),
   80		       portray_goal(callable+2), % as in meta_predicate
   81		       priority(between(0,1200)),
   82                       quote_non_ascii(boolean),
   83		       quoted(boolean),
   84		       spacing(oneof([standard,next_argument])),
   85		       variable_names(list),
   86		       dotlists(boolean),
   87		       portrayed(boolean),
   88		       back_quotes(oneof([codes,chars,string,symbol_char])),
   89		       integer_format(atom),
   90		       float_format(atom)
   91		     ]).   92:- predicate_options(system:write_term/2, 2,
   93		     [ pass_to(system:write_term/3, 3)
   94		     ]).   95:- predicate_options(system:write_size/4, 4,
   96		     [ max_width(nonneg),
   97		       max_height(nonneg),
   98		       pass_to(system:write_term/3, 3)
   99		     ]).  100:- predicate_options(system:read_clause/3, 3,
  101		     [ syntax_errors(oneof([error,fail,quiet,dec10])),
  102		       process_comment(boolean),
  103		       term_position(-any),
  104		       variable_names(-list),
  105		       subterm_positions(-any),
  106		       comments(-list),
  107		       unicode_atoms(oneof([accept,nfc,error,reject]))
  108		     ]).  109:- predicate_options(system:read_term/3, 3,
  110		     [ backquoted_string(boolean),
  111		       character_escapes(boolean),
  112		       comments(-any),
  113		       cycles(boolean),
  114		       double_quotes(boolean),
  115		       module(atom),
  116		       singletons(-list),
  117		       syntax_errors(oneof([error,fail,quiet,dec10])),
  118		       subterm_positions(-any),
  119		       term_position(-any),
  120		       variables(-list),
  121		       variable_names(-list),
  122		       var_prefix(boolean),
  123		       back_quotes(oneof([codes,chars,string,symbol_char])),
  124		       quasi_quotations(any),
  125		       dotlists(boolean),
  126		       unicode_atoms(oneof([accept,nfc,error,reject]))
  127		     ]).  128:- predicate_options(system:read_term/2, 2,
  129		     [ pass_to(system:read_term/3, 3)
  130		     ]).  131:- predicate_options(system:numbervars/4, 4,
  132		     [ functor_name(atom),
  133		       attvar(oneof([skip,bind,error])),
  134		       singletons(boolean)
  135		     ]).  136:- predicate_options(system:absolute_file_name/3, 3,
  137		     [ extensions(list(atom)),
  138		       relative_to(atom),
  139		       access(oneof([read,write,append,execute,exist,none])),
  140		       file_type(oneof([txt,prolog,source,qlf,executable,directory])),
  141		       file_errors(oneof([fail,error])),
  142		       solutions(oneof([first,all])),
  143		       expand(boolean),
  144                       wasm(boolean)
  145		     ]).  146:- predicate_options(system:load_files/2, 2,
  147		     [ autoload(boolean),
  148		       derived_from(atom),
  149                       dialect(atom),
  150		       encoding(encoding),
  151		       expand(boolean),
  152		       format(oneof([source,qlf])),
  153		       if(oneof([true,changed,not_loaded])),
  154		       imports(any),
  155		       modified(float),
  156		       module(atom),
  157                       check_script(boolean),
  158		       must_be_module(boolean),
  159		       qcompile(oneof([never,auto,large,part])),
  160                       optimise(boolean),
  161		       redefine_module(oneof([false,true,ask])),
  162		       reexport(boolean),
  163		       sandboxed(boolean),
  164		       scope_settings(boolean),
  165		       silent(boolean),
  166		       stream(any),
  167                       '$qlf'(atom)
  168		     ]).  169:- predicate_options(system:qcompile/2, 2,
  170		     [ pass_to(system:load_files/2, 2)
  171		     ]).  172:- predicate_options(system:close/2, 2,
  173		     [ force(boolean)
  174		     ]).  175:- predicate_options(system:create_prolog_flag/3, 3,
  176		     [ access(oneof([read_write,read_only])),
  177		       type(( oneof([boolean,atom,integer,float,term])
  178                            ; compound(oneof(list(atom)))
  179                            )),
  180		       keep(boolean),
  181                       warn_not_accessed(boolean),
  182                       local(boolean)
  183		     ]).  184:- predicate_options(system:qsave_program/2, 2,
  185		     [ local(nonneg),
  186		       global(nonneg),
  187		       trail(nonneg),
  188		       argument(nonneg),
  189		       goal(callable),
  190		       toplevel(callable),
  191		       init_file(atom),
  192		       class(oneof([runtime,kernel,development])),
  193		       autoload(boolean),
  194		       map(atom),
  195		       op(oneof([save,standard])),
  196		       stand_alone(boolean),
  197		       emulator(atom)
  198		     ]).  199:- if(current_prolog_flag(threads, true)).  200:- predicate_options(system:thread_create/3, 3,
  201		     [ affinity(list(integer)),
  202                       alias(atom),
  203                       class(atom),
  204		       at_exit(callable),
  205		       debug(boolean),
  206		       inherit_from(any),
  207		       detached(boolean),
  208                       stack_limit(nonneg),
  209		       c_stack(nonneg),
  210                       queue_max_size(nonneg)
  211		     ]).  212:- predicate_options(system:message_queue_create/2, 2,
  213		     [ alias(atom),
  214		       max_size(nonneg)
  215		     ]).  216:- predicate_options(system:mutex_create/2, 2,
  217		     [ alias(atom)
  218		     ]).  219:- predicate_options(system:thread_send_message/3, 3,
  220		     [ timeout(number),
  221		       deadline(number),
  222		       signals(any)
  223		     ]).  224:- predicate_options(system:thread_get_message/3, 3,
  225		     [ timeout(number),
  226		       deadline(number),
  227		       signals(any)
  228		     ]).  229:- endif.  230:- predicate_options(system:locale_create/3, 3,
  231		     [ alias(atom),
  232		       decimal_point(atom),
  233		       thousands_sep(atom),
  234		       grouping(list(any))
  235		     ]).  236:- predicate_options(system:term_string/3, 3,
  237		     [ pass_to(system:write_term/3, 3),
  238		       pass_to(system:read_term/3, 3)
  239		     ]).  240:- predicate_options(system:wildcard_match/3, 3,
  241		     [ case_sensitive(boolean)
  242		     ]).  243:- predicate_options('$syspreds':(dynamic)/2, 2,
  244		     [ incremental(boolean),
  245                       abstract(between(0,0)),
  246                       volatile(boolean),
  247                       discontiguous(boolean),
  248                       multifile(boolean),
  249                       thread(oneof([local,shared]))
  250		     ]).  251:- predicate_options(system:prolog_listen/3, 3,
  252                     [ as(oneof([first,last])),
  253                       name(atom)
  254                     ]).  255:- predicate_options(system:open_shared_object/3, 3,
  256                     [ resolve(oneof([lazy,now])),
  257                       visibility(oneof([local,global])),
  258                       now(bool),
  259                       global(bool),
  260		       delete(bool),
  261		       load(bool),
  262		       deepbind(bool)
  263                     ]).  264:- predicate_options('$pack':attach_packs/2, 2,
  265                     [ duplicate(oneof([warning,keep,replace])),
  266                       search(oneof([first,last])),
  267                       replace(boolean)
  268                     ]).  269:- if(current_prolog_flag(threads, true)).  270:- predicate_options(system:thread_wait/2, 2,
  271                     [ timeout(number),
  272                       deadline(number),
  273                       signals((bool;number)),
  274                       db(boolean),
  275                       wait_preds(any),
  276                       modified(-any),
  277                       retry_every(number),
  278                       module(atom)
  279                     ]).  280:- predicate_options(system:thread_update/2, 2,
  281                     [ notify(oneof([broadcast,signal])),
  282                       module(atom)
  283                     ]).  284:- endif.  285:- predicate_options('$syspreds':transaction/2, 2,
  286                     [ bulk(boolean)
  287                     ]).  288:- predicate_options('$engines':engine_create/4, 4,
  289                     [ stack_limit(nonneg),
  290                       alias(atom),
  291                       inherit_from(any)
  292                     ]).  293:- predicate_options(system:zip_open_stream/3, 3,
  294                     [ close_parent(boolean)
  295                     ]).  296:- predicate_options(system:zipper_open_new_file_in_zip/4, 4,
  297                     [ extra(string),
  298                       comment(string),
  299                       time(number),
  300                       method(atom),
  301                       level(integer),
  302                       zip64(boolean)
  303                     ]).  304:- predicate_options(system:zipper_open_current/3, 3,
  305                     [ type(oneof([text,binary])),
  306                       encoding(encoding),
  307                       bom(boolean),
  308                       release(boolean),
  309                       reposition(boolean)
  310                     ]).