.. index:: single: wrapper
.. _wrapper/0:

.. rst-class:: right

**object**

``wrapper``
===========

Adviser tool for porting and wrapping plain Prolog applications.

| **Availability:** 
|    ``logtalk_load(wrapper(loader))``

| **Author:** Paulo Moura
| **Version:** 0:12:3
| **Date:** 2025-10-28

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Implements:**
|    ``public`` :ref:`expanding <expanding/0>`
| **Provides:**
|    :ref:`logtalk::message_hook/4 <logtalk/0::message_hook/4>`
|    :ref:`logtalk::message_prefix_stream/4 <logtalk/0::message_prefix_stream/4>`
|    :ref:`logtalk::message_tokens//2 <logtalk/0::message_tokens//2>`
| **Uses:**
|    :ref:`logtalk <logtalk/0>`
|    :ref:`os <os/0>`

| **Remarks:**

   - ``prolog_extensions(Extensions)`` option: List of file name extensions used to recognize Prolog source files (default is ``['.pl','.pro','.prolog']``).
   - ``logtalk_extension(Extension)`` option: Logtalk file name extension to be used for the generated wrapper files (default is ``'.lgt'``).
   - ``exclude_files(Files)`` option: List of Prolog source files names to exclude (default is ``[]``).
   - ``exclude_directories(Files)`` option: List of sub-directory names to exclude (default is ``[]``).
   - ``include_wrapped_files(Boolean)``: Generate ``include/1`` directives for the wrapped Prolog source files (default is ``true``).

| **Inherited public predicates:**
|     :ref:`expanding/0::goal_expansion/2`  :ref:`expanding/0::term_expansion/2`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: rdirectory/2
.. _wrapper/0::rdirectory/2:

``rdirectory/2``
^^^^^^^^^^^^^^^^

Advises the user on missing directives for converting all plain Prolog files in a directory and its sub-directories to Logtalk objects using the specified options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``rdirectory(Directory,Options)``
| **Mode and number of proofs:**
|    ``rdirectory(+atom,+list(compound))`` - ``one``


------------

.. index:: rdirectory/1
.. _wrapper/0::rdirectory/1:

``rdirectory/1``
^^^^^^^^^^^^^^^^

Advises the user on missing directives for converting all plain Prolog files in a directory and its sub-directories to Logtalk objects using default options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``rdirectory(Directory)``
| **Mode and number of proofs:**
|    ``rdirectory(+atom)`` - ``one``


------------

.. index:: directory/2
.. _wrapper/0::directory/2:

``directory/2``
^^^^^^^^^^^^^^^

Advises the user on missing directives for converting all plain Prolog files in a directory to Logtalk objects using the specified options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``directory(Directory,Options)``
| **Mode and number of proofs:**
|    ``directory(+atom,+list(compound))`` - ``one``


------------

.. index:: directory/1
.. _wrapper/0::directory/1:

``directory/1``
^^^^^^^^^^^^^^^

Advises the user on missing directives for converting all plain Prolog files in a directory to Logtalk objects using default options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``directory(Directory)``
| **Mode and number of proofs:**
|    ``directory(+atom)`` - ``one``


------------

.. index:: directories/2
.. _wrapper/0::directories/2:

``directories/2``
^^^^^^^^^^^^^^^^^

Advises the user on missing directives for converting all Prolog files in a set of directories to Logtalk objects using the specified options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``directories(Directories,Options)``
| **Mode and number of proofs:**
|    ``directories(+list(atom),+list(compound))`` - ``one``


------------

.. index:: directories/1
.. _wrapper/0::directories/1:

``directories/1``
^^^^^^^^^^^^^^^^^

Advises the user on missing directives for converting all Prolog files in a set of directories to Logtalk objects using default options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``directories(Directories)``
| **Mode and number of proofs:**
|    ``directories(+list(atom))`` - ``one``


------------

.. index:: files/2
.. _wrapper/0::files/2:

``files/2``
^^^^^^^^^^^

Advises the user on missing directives for converting a list of plain Prolog files to Logtalk objects using the specified options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``files(Files,Options)``
| **Mode and number of proofs:**
|    ``files(+list(atom),+list(compound))`` - ``one``


------------

.. index:: files/1
.. _wrapper/0::files/1:

``files/1``
^^^^^^^^^^^

Advises the user on missing directives for converting a list of plain Prolog files to Logtalk objects using default options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``files(Files)``
| **Mode and number of proofs:**
|    ``files(+list(atom))`` - ``one``


------------

.. index:: file/2
.. _wrapper/0::file/2:

``file/2``
^^^^^^^^^^

Advises the user on missing directives for converting a plain Prolog file to Logtalk objects using the specified options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``file(File,Options)``
| **Mode and number of proofs:**
|    ``file(+atom,+list(compound))`` - ``one``


------------

.. index:: file/1
.. _wrapper/0::file/1:

``file/1``
^^^^^^^^^^

Advises the user on missing directives for converting a plain Prolog file to Logtalk objects using default options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``file(File)``
| **Mode and number of proofs:**
|    ``file(+atom)`` - ``one``


------------

.. index:: save/1
.. _wrapper/0::save/1:

``save/1``
^^^^^^^^^^

Saves the generated wrapper objects (plus a loader file per directory) for all advised files using the specified options. The wrapper objects are saved to the same directories that contain the wrapped Prolog files.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``save(Options)``
| **Mode and number of proofs:**
|    ``save(+list(compound))`` - ``one``


------------

.. index:: save/0
.. _wrapper/0::save/0:

``save/0``
^^^^^^^^^^

Saves the generated wrapper objects (plus a loader file per directory) for all advised files using default options. The wrapper objects are saved to the same directories that contain the wrapped Prolog files.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``save`` - ``one``


------------

.. index:: default_option/1
.. _wrapper/0::default_option/1:

``default_option/1``
^^^^^^^^^^^^^^^^^^^^

Enumerates by backtracking the default options used when generating the wrapper objects.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``default_option(DefaultOption)``
| **Mode and number of proofs:**
|    ``default_option(?compound)`` - ``zero_or_more``


------------

.. index:: default_options/1
.. _wrapper/0::default_options/1:

``default_options/1``
^^^^^^^^^^^^^^^^^^^^^

Returns a list of the default options used when generating the wrapper objects.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``default_options(DefaultOptions)``
| **Mode and number of proofs:**
|    ``default_options(-list(compound))`` - ``one``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

.. index:: merge_options/2
.. _wrapper/0::merge_options/2:

``merge_options/2``
^^^^^^^^^^^^^^^^^^^

Merges the user options with the default options, returning the list of options used when generating the wrapper objects.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``merge_options(UserOptions,Options)``
| **Mode and number of proofs:**
|    ``merge_options(+list(compound),-list(compound))`` - ``one``


------------

.. index:: predicate_called_but_not_defined_/2
.. _wrapper/0::predicate_called_but_not_defined_/2:

``predicate_called_but_not_defined_/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of called object predicates that are not locally defined.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``predicate_called_but_not_defined_(Object,Predicate)``
| **Mode and number of proofs:**
|    ``predicate_called_but_not_defined_(?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: object_predicate_called_/3
.. _wrapper/0::object_predicate_called_/3:

``object_predicate_called_/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of called object predicates.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``object_predicate_called_(Object,Other,Predicate)``
| **Mode and number of proofs:**
|    ``object_predicate_called_(?atom,?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: module_predicate_called_/3
.. _wrapper/0::module_predicate_called_/3:

``module_predicate_called_/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of called module predicates.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``module_predicate_called_(Object,Module,Predicate)``
| **Mode and number of proofs:**
|    ``module_predicate_called_(?atom,?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: unknown_predicate_called_/2
.. _wrapper/0::unknown_predicate_called_/2:

``unknown_predicate_called_/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of predicates called but not defined.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``unknown_predicate_called_(Object,Predicate)``
| **Mode and number of proofs:**
|    ``unknown_predicate_called_(?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: missing_predicate_directive_/3
.. _wrapper/0::missing_predicate_directive_/3:

``missing_predicate_directive_/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of missing predicate directives.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``missing_predicate_directive_(Object,Directive,Predicate)``
| **Mode and number of proofs:**
|    ``missing_predicate_directive_(?atom,?predicate_indicator,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: non_standard_predicate_call_/2
.. _wrapper/0::non_standard_predicate_call_/2:

``non_standard_predicate_call_/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of called non-standard predicates.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``non_standard_predicate_call_(Object,Predicate)``
| **Mode and number of proofs:**
|    ``non_standard_predicate_call_(?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: dynamic_directive_/3
.. _wrapper/0::dynamic_directive_/3:

``dynamic_directive_/3``
^^^^^^^^^^^^^^^^^^^^^^^^

Table of declared dynamic predicates.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``dynamic_directive_(Object,Line,Predicate)``
| **Mode and number of proofs:**
|    ``dynamic_directive_(?atom,?integer,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: multifile_directive_/3
.. _wrapper/0::multifile_directive_/3:

``multifile_directive_/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of declared multifile predicates.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``multifile_directive_(Object,Line,Predicate)``
| **Mode and number of proofs:**
|    ``multifile_directive_(?atom,?integer,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: add_directive_before_entity_/2
.. _wrapper/0::add_directive_before_entity_/2:

``add_directive_before_entity_/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Table of directives to be added before the entity opening directive.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``add_directive_before_entity_(Object,Directive)``
| **Mode and number of proofs:**
|    ``add_directive_before_entity_(?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: add_directive_/2
.. _wrapper/0::add_directive_/2:

``add_directive_/2``
^^^^^^^^^^^^^^^^^^^^

Table of directives to be added.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``add_directive_(Object,Directive)``
| **Mode and number of proofs:**
|    ``add_directive_(?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: add_directive_/3
.. _wrapper/0::add_directive_/3:

``add_directive_/3``
^^^^^^^^^^^^^^^^^^^^

Table of directives to be added to complement existing directives.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``add_directive_(Object,Directive,NewDirective)``
| **Mode and number of proofs:**
|    ``add_directive_(?atom,?predicate_indicator,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: remove_directive_/2
.. _wrapper/0::remove_directive_/2:

``remove_directive_/2``
^^^^^^^^^^^^^^^^^^^^^^^

Table of directives to be removed.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``remove_directive_(Object,Directive)``
| **Mode and number of proofs:**
|    ``remove_directive_(?atom,?predicate_indicator)`` - ``zero_or_more``


------------

.. index:: file_being_advised_/4
.. _wrapper/0::file_being_advised_/4:

``file_being_advised_/4``
^^^^^^^^^^^^^^^^^^^^^^^^^

Table of files being advised are respective directories and names (basename without extension).

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``file_being_advised_(File,Path,Directory,Name)``
| **Mode and number of proofs:**
|    ``file_being_advised_(?atom,?atom,?atom,?atom)`` - ``zero_or_more``


------------

Operators
---------

(none)

