object

# `wrapper`

Adviser tool for porting and wrapping plain Prolog applications.

Availability:
`logtalk_load(wrapper(loader))`
Author: Paulo Moura
Version: 0:12:1
Date: 2023-11-29
Compilation flags:
`static, context_switching_calls`
Implements:
`public` expanding
Provides:
logtalk::message_hook/4
logtalk::message_prefix_stream/4
logtalk::message_tokens//2
Uses:
logtalk
os
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:
goal_expansion/2 term_expansion/2

## Public predicates

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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`

### `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)