This file is indexed.

/usr/share/Yap/charsio.yap is in yap 5.1.3-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*************************************************************************
*									 *
*	 YAP Prolog 							 *
*									 *
*	Yap Prolog was developed at NCCUP - Universidade do Porto	 *
*									 *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997	 *
*									 *
**************************************************************************
*									 *
* File:		charsio.yap						 *
* Last rev:	5/12/99							 *
* mods:									 *
* comments:	I/O on character strings				 *
*									 *
*************************************************************************/

:- module(charsio, [
	format_to_chars/3,
	format_to_chars/4,
	write_to_chars/3,
	write_to_chars/2,
	atom_to_chars/3,
	atom_to_chars/2,
	number_to_chars/3,
	number_to_chars/2,
	read_from_chars/2,
	open_chars_stream/2,
	with_output_to_chars/2,
	with_output_to_chars/3,
	with_output_to_chars/4
    ]).

format_to_chars(Form, Args, OUT) :-
	format_to_chars(Form, Args, [], OUT).

format_to_chars(Form, Args, L0, OUT) :-
	open_mem_write_stream(Stream),
	format(Stream,Form,Args),
	peek_mem_write_stream(Stream, L0, O),
	close(Stream),
	O = OUT.

write_to_chars(Term, OUT) :-
	write_to_chars(Term, [], OUT).

write_to_chars(Term, L0, OUT) :-
	open_mem_write_stream(Stream),
	write(Stream, Term),
	peek_mem_write_stream(Stream, L0, O),
	close(Stream),
	O = OUT.

atom_to_chars(Atom, OUT) :-
	atom_to_chars(Atom, [], OUT).

atom_to_chars(Atom, L0, OUT) :-
	var(Atom), !,
	throw(error(instantiation_error,atom_to_chars(Atom, L0, OUT))).
atom_to_chars(Atom, L0, OUT) :-
	atom(Atom), !,
	open_mem_write_stream(Stream),
	write(Stream, Atom),
	peek_mem_write_stream(Stream, L0, O),
	close(Stream),
	O = OUT.
atom_to_chars(Atom, L0, OUT) :-
	throw(error(type_error(atom,Atom),atom_to_chars(Atom, L0, OUT))).

number_to_chars(Number, OUT) :-
	number_to_chars(Number, [], OUT).

number_to_chars(Number, L0, OUT) :-
	var(Number), !,
	throw(error(instantiation_error,number_to_chars(Number, L0, OUT))).
number_to_chars(Number, L0, OUT) :-
	number(Number), !,
	open_mem_write_stream(Stream),
	write(Stream, Number),
	peek_mem_write_stream(Stream, L0, O),
	close(Stream),
	O = OUT.
number_to_chars(Number, L0, OUT) :-
	throw(error(type_error(number,Number),number_to_chars(Number, L0, OUT))).

read_from_chars(Chars, Term) :-
	open_mem_read_stream(Chars, Stream),
	read(Stream, T),
	close(Stream),
	T = Term.

open_chars_stream(Chars, Stream) :-
	open_mem_read_stream(Chars, Stream).

with_output_to_chars(Goal, Chars) :-
	with_output_to_chars(Goal, [], Chars).

with_output_to_chars(Goal, L0, Chars) :-
	with_output_to_chars(Goal, Stream, L0, Chars),
	close(Stream).

with_output_to_chars(Goal, Stream, L0, Chars) :-
	open_mem_write_stream(Stream),
	current_output(SO),
	set_output(Stream),
	do_output_to_chars(Goal, Stream, L0, Chars, SO).

do_output_to_chars(Goal, Stream, L0, Chars, SO) :-
	catch(Goal, Exception, handle_exception(Exception,Stream,SO)),
	!,
	set_output(SO),
	peek_mem_write_stream(Stream, L0, Chars).
do_output_to_chars(_Goal, Stream, _L0, _Chars, SO) :-
	set_output(SO),
	close(Stream),
	fail.

handle_exception(Exception, Stream, SO) :-
	close(Stream),
	current_output(SO),
	throw(Exception).