procpg command

Purpose

Command creates a Progress© codepage conversion table (convmap.dat). A simple text file is used as source.

Syntax

procpg [-h | ?] [ -[X [Y]] ] [-i] [-s] [-g | input_file]

Description

Command creates a Progress codepage conversion table (convmap.dat). Utility takes a simple text file for input. Input file consist of two columns separated by one or more spaces:

source_code_1 destination_code_1
source_code_2 destination_code_2
... ...
source_code_N destination_code_N

Source and destination codes may be in one of the following formats: decimal, hexadecimal, html numeric character reference (like 'ϼ'), character (the byte value of character is used).

When needed and it is possible utility may add some conversions to create an "inverse" table.

Utility is written in C. Tested under Linux, AIX, DOS.

Options

Command line flags

-h | ? Show help
-X input file source code data type, default is character
Y input file destination code data type, default is character
-i change table values in a way that table become an inverse codepage table
-s create table in a C source format
-g create an input file with no conversion: value of entry 127 is 127, value of entry 128 is 128 and so on
input_file name of input file

Data types of input file codes

c - character, there is no way to present a space character
d - decimal value
x - hexadecimal value
e - html numeric character reference, for example ÿ or ÿ

Inverse codepage table

"Inverse" means that no one code is lost after converting to destination code and backwards.

For example, there are two lithuanian codepages: source table is KBL and destination table is LT772. In forward conversion KBL code 253 is converted to LT772 code 254. If we had inverse table, backward conversion of code 254 from LT772 to KBL would return code 253. If backward conversion returns any other code, code 195 for example, the codepage table is not inverse.

Destination code is considered as lost code in backward conversion when more than one source code points to the same destination code in forward conversion. In theese cases having destination code there is no possibility to say which code of the two were the source code.

Source code is considered as empty code when no one code points to it in backward conversion.

For example:

LT722 code 254 is considered as "lost" code, KBL code 252 is considered as "empty" one.

Samples

procpg -cdi kbl_772.txt > kbl_772.dat

procpg -cdis kbl_772.txt > kbl_772.c

procpg -cx kbl_utf.txt > kbl_utf.dat

procpg -xe -gs > empty.txt

Downloads

Source file procpg.c

Compilation script for Linux, AIX compile

Compilation script for Win32 compile.bat

Precompiled

Win32 console procpg.exe (32kB)

Author

License: GNU General Public License.
Version: 1.03
Author: Gediminas Markevicius, Klaipeda