<commit_before>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  This file is part of Logtalk <http://logtalk.org/>  
%  Copyright (c) 1998-2014 <NAME> <<EMAIL>>
%
%  This program is free software: you can redistribute it and/or modify
%  it under the terms of the GNU General Public License as published by
%  the Free Software Foundation, either version 3 of the License, or
%  (at your option) any later version.
%  
%  This program is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%  GNU General Public License for more details.
%  
%  You should have received a copy of the GNU General Public License
%  along with this program.  If not, see <http://www.gnu.org/licenses/>.
%  
%  Additional licensing terms apply per Section 7 of the GNU General
%  Public License 3. Consult the `LICENSE.txt` file for details.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


:- category(diagram(_Format)).

	:- info([
		version is 2.0,
		author is '<NAME>',
		date is 2014/01/06,
		comment is 'Predicates for generating diagrams.',
		parnames is ['Format']
	]).

	:- public(libraries/3).
	:- mode(libraries(+atom, +list(atom), +list(compound)), one).
	:- info(libraries/3, [
		comment is 'Creates a diagram for a set of libraries using the specified options.',
		argnames is ['Project', 'Libraries', 'Options']
	]).

	libraries(Project, Libraries, UserOptions) :-
		format_object(Format),
		merge_options(UserOptions, Options),
		::reset,
		::output_file_path(Project, Options, Format, OutputPath),
		open(OutputPath, write, Stream, [alias(output_file)]),
		Format::file_header(output_file, Project, Options),
		atom_concat(libraries_, Project, Identifier),
		Format::graph_header(output_file, Identifier, Project, libraries, [tooltip(Project)| Options]),
		output_libraries(Libraries, Format, Options),
		::output_externals(Options),
		::output_edges(Options),
		Format::graph_footer(output_file, Identifier, Project, libraries, [tooltip(Project)| Options]),
		Format::file_footer(output_file, Project, Options),
		close(Stream).

	output_libraries([], _Format, _Options).
	output_libraries([Library| Libraries], Format, Options) :-
		logtalk_library_path(Library, _),
		logtalk::expand_library_path(Library, Directory),
		atom_concat(library_, Library, Identifier),
		linking_options(Directory, Options, GraphOptions),
		Format::graph_header(output_file, Identifier, Library, library, GraphOptions),
		::output_library(Library, Directory, Options),
		Format::graph_footer(output_file, Identifier, Library, library, GraphOptions),
		output_libraries(Libraries, Format, Options).

	:- public(libraries/2).
	:- mode(libraries(+atom, +list(atom)), one).
	:- info(libraries/2, [
		comment is 'Creates a diagram for a set of libraries using the default options.',
		argnames is ['Project', 'Libraries']
	]).

	libraries(Project, Libraries) :-
		::libraries(Project, Libraries, []).

	:- public(libraries/1).
	:- mode(libraries(+list(compound)), one).
	:- info(libraries/1, [
		comment is 'Creates a diagram for all loaded libraries using the specified options.',
		argnames is ['Options']
	]).

	libraries(UserOptions) :-
		format_object(Format),
		merge_options(UserOptions, Options),
		::output_file_path(all_libraries, Options, Format, OutputPath),
		open(OutputPath, write, Stream, [alias(output_file)]),
		Format::file_header(output_file, libraries, Options),
		output_all_libraries(Options),
		::output_edges(Options),
		Format::file_footer(output_file, libraries, Options),
		close(Stream).

	output_all_libraries(Options) :-
		format_object(Format),
		logtalk_library_path(Library, _),
		logtalk::expand_library_path(Library, Directory),
		\+ \+ logtalk::loaded_file_property(_, directory(Directory)),
		atom_concat(library_, Library, Identifier),
		linking_options(Directory, Options, GraphOptions),
		Format::graph_header(output_file, Identifier, Library, library, GraphOptions),
		::output_library(Library, Directory, Options),
		Format::graph_footer(output_file, Identifier, Library, library, GraphOptions),
		fail.
	output_all_libraries(_).

	:- public(libraries/0).
	:- mode(libraries, one).
	:- info(libraries/0, [<commit_msg>Don’t ignore the `exclude_libraries/1` option when using the `diagram(_)::libraries/0-1` predicates<commit_after>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  This file is part of Logtalk <http://logtalk.org/>  
%  Copyright (c) 1998-2014 <NAME> <<EMAIL>>
%
%  This program is free software: you can redistribute it and/or modify
%  it under the terms of the GNU General Public License as published by
%  the Free Software Foundation, either version 3 of the License, or
%  (at your option) any later version.
%  
%  This program is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%  GNU General Public License for more details.
%  
%  You should have received a copy of the GNU General Public License
%  along with this program.  If not, see <http://www.gnu.org/licenses/>.
%  
%  Additional licensing terms apply per Section 7 of the GNU General
%  Public License 3. Consult the `LICENSE.txt` file for details.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


:- category(diagram(_Format)).

	:- info([
		version is 2.0,
		author is '<NAME>',
		date is 2014/01/06,
		comment is 'Predicates for generating diagrams.',
		parnames is ['Format']
	]).

	:- public(libraries/3).
	:- mode(libraries(+atom, +list(atom), +list(compound)), one).
	:- info(libraries/3, [
		comment is 'Creates a diagram for a set of libraries using the specified options.',
		argnames is ['Project', 'Libraries', 'Options']
	]).

	libraries(Project, Libraries, UserOptions) :-
		format_object(Format),
		merge_options(UserOptions, Options),
		::reset,
		::output_file_path(Project, Options, Format, OutputPath),
		open(OutputPath, write, Stream, [alias(output_file)]),
		Format::file_header(output_file, Project, Options),
		atom_concat(libraries_, Project, Identifier),
		Format::graph_header(output_file, Identifier, Project, libraries, [tooltip(Project)| Options]),
		output_libraries(Libraries, Format, Options),
		::output_externals(Options),
		::output_edges(Options),
		Format::graph_footer(output_file, Identifier, Project, libraries, [tooltip(Project)| Options]),
		Format::file_footer(output_file, Project, Options),
		close(Stream).

	output_libraries([], _Format, _Options).
	output_libraries([Library| Libraries], Format, Options) :-
		logtalk_library_path(Library, _),
		logtalk::expand_library_path(Library, Directory),
		atom_concat(library_, Library, Identifier),
		linking_options(Directory, Options, GraphOptions),
		Format::graph_header(output_file, Identifier, Library, library, GraphOptions),
		::output_library(Library, Directory, Options),
		Format::graph_footer(output_file, Identifier, Library, library, GraphOptions),
		output_libraries(Libraries, Format, Options).

	:- public(libraries/2).
	:- mode(libraries(+atom, +list(atom)), one).
	:- info(libraries/2, [
		comment is 'Creates a diagram for a set of libraries using the default options.',
		argnames is ['Project', 'Libraries']
	]).

	libraries(Project, Libraries) :-
		::libraries(Project, Libraries, []).

	:- public(libraries/1).
	:- mode(libraries(+list(compound)), one).
	:- info(libraries/1, [
		comment is 'Creates a diagram for all loaded libraries using the specified options.',
		argnames is ['Options']
	]).

	libraries(UserOptions) :-
		format_object(Format),
		merge_options(UserOptions, Options),
		::output_file_path(all_libraries, Options, Format, OutputPath),
		open(OutputPath, write, Stream, [alias(output_file)]),
		Format::file_header(output_file, libraries, Options),
		output_all_libraries(Options),
		::output_edges(Options),
		Format::file_footer(output_file, libraries, Options),
		close(Stream).

	output_all_libraries(Options) :-
		format_object(Format),
		member(exclude_libraries(ExcludedLibraries), Options),
		logtalk_library_path(Library, _),
		\+ member(Library, ExcludedLibraries),
		logtalk::expand_library_path(Library, Directory),
		\+ \+ logtalk::loaded_file_property(_, directory(Directory)),
		atom_concat(library_, Library, Identifier),
		linking_options(Directory, Options, GraphOptions),
		Format::graph_header(output_file, Identifier, Library, library, GraphOptions),
		::output_library(Library, Directory, Options),
		Format::graph_footer(output_file, Identifier, Library, library, GraphOptions),
		fail.
	output_all_libraries(_).

	:- public(libraries/0).
	:- mode(libraries, one).
	:- info(libraries/0, [
{'fraction_non_alphanumeric': 0.15870500339597013, 'fraction_numerical': 0.006905139234774734, 'mean_word_length': 5.728865194211729, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '894443', 'n_tokens_mistral': 2784, 'n_tokens_neox': 2564, 'n_words': 715}