Prolog "unicode"
Admin User, created Jan 24. 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.
*/
runner_file(extend, unicode, 'XLOG 3.5 unicode').
/*******************************************************************/
/* Atom Codes etc.. */
/*******************************************************************/
/* atom_codes(X, Y) */
runner_pred(atom_codes, 2, extend, unicode, 'ISO 8.16.5.4').
runner_case(atom_codes, 2, extend, unicode, 'ISO 8.16.5.4, XLOG 1') :-
atom_codes(X, [97, 98, 99, 0x1F602, 49, 50, 51]), atom_codes(X, Y),
Y == [97, 98, 99, 0x1F602, 49, 50, 51].
runner_case(atom_codes, 2, extend, unicode, 'ISO 8.16.5.4, XLOG 2') :-
atom_codes(X, [97, 98, 99, 0xD83D, 0xDE02, 49, 50, 51]), atom_codes(X, Y),
Y == [97, 98, 99, 0x1F602, 49, 50, 51].
/* char_code(X, Y) */
runner_pred(char_code, 2, extend, unicode, 'ISO 8.16.6.4').
runner_case(char_code, 2, extend, unicode, 'ISO 8.16.6.4, XLOG 1') :-
char_code(X, 0x1F602), char_code(X, Y),
Y == 0x1F602.
/*******************************************************************/
/* Code Type etc.. */
/*******************************************************************/
/* code_category(C, T) */
runner_pred(code_category,2, extend, unicode, 'XLOG 3.5.1').
runner_case(code_category,2, extend, unicode, 'XLOG 3.5.1, XLOG 1') :-
code_category(0xA7C1, T),
T == 2.
runner_case(code_category,2, extend, unicode, 'XLOG 3.5.1, XLOG 2') :-
code_category(0x10599, T),
T == 2.
/* code_numeric(C, V) */
runner_pred(code_numeric,2, extend, unicode, 'XLOG 3.5.2').
runner_case(code_numeric,2, extend, unicode, 'XLOG 3.5.2, XLOG 1') :-
code_numeric(0x11F53, V),
V == 3.
/*******************************************************************/
/* Crypto */
/*******************************************************************/
/* hex_encode(A, B) */
runner_pred(hex_encode,2, extend, unicode, 'XLOG 3.5.3').
runner_case(hex_encode,2, extend, unicode, 'XLOG 3.5.3, XLOG 1') :-
hex_encode('üäö123', X),
X == 'fce4f6313233'.
runner_case(hex_encode,2, extend, unicode, 'XLOG 3.5.3, XLOG 2') :-
catch(hex_encode(_,_), error(E,_), true),
E == instantiation_error.
/* digest_close(A, B) */
runner_pred(digest_close,2, extend, unicode, 'XLOG 3.5.4').
runner_case(digest_close,2, extend, unicode, 'XLOG 3.5.4, XLOG 1') :-
digest_open(D),
digest_update(D, 'The quick brown fox jumps over the lazy dog'),
digest_close(D, X),
X == 'רû³\a×\200\\224\iÊ\232\¼°\b.O\215\VQäm<Ûv-\2\п7Éå\222\'.
runner_case(digest_close,2, extend, unicode, 'XLOG 3.5.4, XLOG 2') :-
digest_open(D),
digest_update(D, 'The quick brown fox'),
digest_update(D, ' jumps over the lazy dog'),
digest_close(D, X),
X == 'רû³\a×\200\\224\iÊ\232\¼°\b.O\215\VQäm<Ûv-\2\п7Éå\222\'.
runner_case(digest_close,2, extend, unicode, 'XLOG 3.5.4, XLOG 3') :-
digest_open(D),
catch(digest_update(D, 3.1415), error(E,_), true),
E == type_error(atom, 3.1415).
/*******************************************************************/
/* Fancy */
/*******************************************************************/
/* fancy_atom(A, B, P) */
runner_pred(fancy_atom,3, extend, unicode, 'XLOG 3.5.5').
runner_case(fancy_atom,3, extend, unicode, 'XLOG 3.5.5, XLOG 1') :-
fancy_atom('foo :- bar.', X, ''),
X == 'foo :- bar.'.
runner_case(fancy_atom,3, extend, unicode, 'XLOG 3.5.5, XLOG 2') :-
fancy_atom('foo(\'abc\',0rNone) :- bar("abc").', X, ''),
X == 'foo(<span class=\"cs\">'abc'</span>,<span class=\"cs\">0rNone</span>) :- bar(<span class=\"cs\">"abc"</span>).'.
runner_case(fancy_atom,3, extend, unicode, 'XLOG 3.5.5, XLOG 3') :-
fancy_atom('foo(12,34.56) :- bar(0xFF).', X, ''),
X == 'foo(<span class=\"cs\">12</span>,<span class=\"cs\">34.56</span>) :- bar(<span class=\"cs\">0xFF</span>).'.
runner_case(fancy_atom,3, extend, unicode, 'XLOG 3.5.5, XLOG 4') :-
fancy_atom('foo(A,_) :- bar(A).', X, ''),
X == 'foo(<span class=\"vr\">A</span>,<span class=\"vr\">_</span>) :- bar(<span class=\"vr\">A</span>).'.
runner_case(fancy_atom,3, extend, unicode, 'XLOG 3.5.5, XLOG 5') :-
fancy_atom('/* block */\nfoo :- bar. % line', X, ''),
X == '<span class=\"cm\">/* block */</span>\nfoo :- bar. <span class=\"cm\">% line</span>'.