1/*
2 * check-stateless
3 *
4 *      Complete check of a stateless encoding.
5 *      Usage: check-stateless SRCDIR CHARSET
6 */
7
8IF RxFuncQuery('SysLoadFuncs') THEN DO
9   CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
10   CALL SysLoadFuncs
11END
12
13'@echo off'
14
15PARSE ARG srcdir charset
16
17'.\table-from 'charset' > tmp-'charset'.TXT'
18'.\table-to 'charset' | sort > tmp-'charset'.INVERSE.TXT'
19'cmp 'srcdir'\'charset'.TXT tmp-'charset'.TXT'
20
21IF exists(srcdir'\'charset'.IRREVERSIBLE.TXT') = 1 THEN
22    DO
23        'cat 'srcdir'\'charset'.TXT 'srcdir'\'charset'.IRREVERSIBLE.TXT | sort | uniq -u > tmp-orig-'charset'.INVERSE.TXT'
24        'cmp tmp-orig-'charset'.INVERSE.TXT tmp-'charset'.INVERSE.TXT'
25    END
26ELSE
27    DO
28        'cmp 'srcdir'\'charset'.TXT tmp-'charset'.INVERSE.TXT'
29    END
30
31'rm -f tmp-'charset'.TXT tmp-'charset'.INVERSE.TXT tmp-orig-'charset'.INVERSE.TXT'
32
33EXIT
34
35/*
36 * exists - check if file exists
37 */
38
39exists: PROCEDURE
40    IF STREAM(ARG(1), 'C', 'QUERY EXISTS') = '' THEN
41        RETURN 0
42    ELSE
43        RETURN 1
44