Prolog "text"
Admin User, created Apr 07. 2025
/**
* Warranty & Liability
* To the extent permitted by applicable law and unless explicitly
* otherwise agreed upon, XLOG Technologies AG makes no warranties
* regarding the provided information. XLOG Technologies AG assumes
* no liability that any problems might be solved with the information
* provided by XLOG Technologies AG.
*
* Rights & License
* All industrial property rights regarding the information - copyright
* and patent rights in particular - are the sole property of XLOG
* Technologies AG. If the company was not the originator of some
* excerpts, XLOG Technologies AG has at least obtained the right to
* reproduce, change and translate the information.
*
* Reproduction is restricted to the whole unaltered document. Reproduction
* of the information is only allowed for non-commercial uses. Selling,
* giving away or letting of the execution of the library is prohibited.
* The library can be distributed as part of your applications and libraries
* for execution provided this comment remains unchanged.
*
* Restrictions
* Only to be distributed with programs that add significant and primary
* functionality to the library. Not to be distributed with additional
* software intended to replace any components of the library.
*
* Trademarks
* Jekejeke is a registered trademark of XLOG Technologies AG.
*/
/**
* Source of test cases is the following standard:
* - Prolog General Core ISO/IEC 13211-1
*/
runner_file(stream, text, 'ISO 8.12 texts').
/****************************************************************/
/* Character Input / Output */
/****************************************************************/
/* nl */
runner_pred(nl,0, stream, text, 'ISO 8.12.3.4').
runner_case(nl,0, stream, text, 'ISO 8.12.3.4, ISO 5') :-
with_text_to(X, nl), (X=='\r'; X=='\r\n'; X=='\n').
/* put_code(C) */
runner_pred(put_code,1, stream, text, 'ISO 8.12.3.4').
runner_case(put_code,1, stream, text, 'ISO 8.12.3.4, ISO 3') :-
with_text_to(X, (current_output(S), put_code(S, 116))), X=='t'.
runner_case(put_code,1, stream, text, 'ISO 8.12.3.4, ISO 10') :-
catch((current_output(S), put_code(S, _)), error(E,_), true), E==instantiation_error.
runner_case(put_code,1, stream, text, 'ISO 8.12.3.4, ISO 11') :-
catch((current_output(S), put_code(S, ty)), error(E,_), true), E==type_error(integer, ty).
/* peek_code(C) */
runner_pred(peek_code,1, stream, text, 'ISO 8.12.2.4').
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 2') :-
with_text_from('qwerty ', (current_input(S), peek_code(S, X))), X==113.
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, XLOG 2') :-
with_text_from('qwerty ', (current_input(S), peek_code(S, _), get_code(S, X))), X==113.
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 6') :-
with_text_from('\'qwerty\' ', (current_input(S), peek_code(S, X))), X==39.
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 9') :-
\+ with_text_from('qwerty ', (current_input(S), peek_code(S, 112))).
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 11') :-
with_text_from('', (current_input(S), peek_code(S, X))), X== -1.
/* get_code(C) */
runner_pred(get_code,1, stream, text, 'ISO 8.12.1.4').
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 2') :-
with_text_from('qwerty ', (current_input(S), get_code(S, X))), X==113.
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, XLOG 2') :-
with_text_from('qwerty ', (current_input(S), get_code(S,_), get_code(S,X))), X==119.
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 6') :-
with_text_from('\'qwerty\' ', (current_input(S), get_code(S,X))), X==39.
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 8') :-
\+ with_text_from('qwerty ', (current_input(S), get_code(S,112))).
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 10') :-
with_text_from('', (current_input(S), get_code(S,X))), X== -1.