procrc.py - display the CRCs and include file references of the source files used to build a compiled Progress programs. based on procrc.c from Grant P. Maizels. Credits and thanks go to his excellent work.
Python port and maintainer: Frank Spaniak (python.procrc at gmail dot com)
with appreciation for the help from: Progress Tools (http://progress-tools.x10.mx)
Last updated: 7/12/2015
# *** procrc.py - Copyright (C) 2015 Frank Spaniak All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
In other words, use at your own risk. All I ask, is that if you make an improvment to the program send me a copy so I can include it in future versions.
Rather than rehashing what has already been written about what rcode CRC's are, I'll point you to Grant Maizel's original work Here
I've been using this program for some time now and needed it for Progress version 11. After scouring the internet for some time looking for a v11 port, without any luck, decided to try to do it myself.
Since I'm a better coder in Progress and Python, and know enough c to be extremely dangerous (and not in a good way), translated the code into Python to be able to port it to other systems as needed. I've also added a few more options to the program to hopefully make life a little easier. Hopefully it may be of use to you too.
Python 2.4 or higher (tested thru 2.7+) only standard built in imports are used. Python 3 is not yet supported.
This was written for *nix, but have had some success with it working on Windows
Windows users will probably have to install Python before trying this.
To find out what version of Python you have:sh-3.2$ python Python 2.4.3 (#1, Oct 23 2012, 22:02:41) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
To exit Python: (unix: press control-d, windows: type quit() Press enter )
procrc.py has had only limited testing with V9 Progress.
Download procrc.py from Here and copy the program somewhere into your path, Typically /usr/local/bin, and change the permissions to executable (E.G. chmod 755 procrc.py) as needed. Like many unix scripts, the first line tells the operating system where python is.
#!/bin/env /usr/bin/python
Change this to local system needs using your favorite editor. This was originally written on a Redhat 5.5 system and these are the default locations.
to see the help options after installing, run procrc.py with the --help option and it will display:
procrc.py --help Usage: procrc.py [--version --sort --tab --dir [path] --export [--only] --compare [--message] --help ] rcode.r [rcode2.r ...] Display file and crc information for Progress dotr file(s) procrc.py - Copyright (C) 2015 Frank Spaniak All rights reserved (email@some_address.com, http://procrc.spaniak.org/) Original Work and credit to Grant P. Maizels With thanks to Progress Tools (email@some_address.com, http://progress-tools.x10.mx) Options: --version show program's version number and exit -h, --help show this help message and exit -s, --sort Sort include files by module name -t, --tab Tab delimit include filenames -d SCAN_DIR, --dir=SCAN_DIR Directory Name to scan. Repeat as needed -e, --export Output in export format -o, --only Only the header information is exported -c CDIR, --compare=CDIR Compare to file/dir, repeat as needed -u USER_MESSAGE, --message=USER_MESSAGE User message to put on compare report
Anyone familiar with this program will recognize the layout.# procrc.py dir1/crctest11.r ***procrc.py - Copyright (C) 2015 Frank Spaniak, see --help R-Code file: dir1/crctest11.r Size: 1305 Compiled on: 1436710475 (0x55a2764b) Sun Jul 12 07:14:35 2015 R-Code version: 1100 R-Code CRC: 50630 Source CRC: crctest11.p crctest11.p 3508 Source CRC: test1.i includes/test1.i 39814 Source CRC: test2.i includes/test2.i 25255 Source CRC: test3.i /tmp/test/dir1/includes/test3.i 17664
One of the first changes made was to allow multiple program names on the command line
procrc.py crctest9/dir1/crctest9.r crctest10/dir1/crctest10.r crctest11/dir1/crctest11.r ***procrc.py - Copyright (C) 2015 Frank Spaniak, see --help R-Code file: crctest9/dir1/crctest9.r Size: 879 Compiled on: 1436708609 (0x55a26f01) Sun Jul 12 06:43:29 2015 R-Code version: 908 R-Code CRC: 50630 Source CRC: crctest9.p .\crctest9.p 25690 Source CRC: test1.i .\includes\test1.i 39814 Source CRC: test2.i .\includes\test2.i 25255 Source CRC: test3.i C:\temp\test\dir1\includes\test3.i 17664 R-Code file: crctest10/dir1/crctest10.r Size: 1369 Compiled on: 1436707950 (0x55a26c6e) Sun Jul 12 06:32:30 2015 R-Code version: 17391 R-Code CRC: 50630 Source CRC: crctest10.p crctest10.p 3508 Source CRC: test1.i includes/test1.i 39814 Source CRC: test2.i includes/test2.i 25255 Source CRC: test3.i /tmp/test/dir1/includes/test3.i 17664 R-Code file: crctest11/dir1/crctest11.r Size: 1305 Compiled on: 1436710475 (0x55a2764b) Sun Jul 12 07:14:35 2015 R-Code version: 1100 R-Code CRC: 50630 Source CRC: crctest11.p crctest11.p 3508 Source CRC: test1.i includes/test1.i 39814 Source CRC: test2.i includes/test2.i 25255 Source CRC: test3.i /tmp/test/dir1/includes/test3.i 17664
Note: Wildcards in the filenames may work under some versions of *nix, but it is the shell that is expanding them not procrc.py.
Print the program version number and exit.
This option will sort the include modules by name.
Instead of spaces between each of the items in the include file section, they will be seporated by tabs.
The --dir (-d) option which will display the procrc report for all dotr's found in the given directory. This can be repeated any number of times (up to the command line size limit) as needed.
procrc.py -d crctest9/dir1 -d crctest10/dir1 -d crctest11/dir1 ***procrc.py - Copyright (C) 2015 Frank Spaniak, see --help R-Code file: crctest9/dir1/crctest9.r Size: 879 Compiled on: 1436708609 (0x55a26f01) Sun Jul 12 06:43:29 2015 R-Code version: 908 R-Code CRC: 50630 Source CRC: crctest9.p .\crctest9.p 25690 Source CRC: test1.i .\includes\test1.i 39814 Source CRC: test2.i .\includes\test2.i 25255 Source CRC: test3.i C:\temp\test\dir1\includes\test3.i 17664 R-Code file: crctest10/dir1/crctest10.r Size: 1369 Compiled on: 1436707950 (0x55a26c6e) Sun Jul 12 06:32:30 2015 R-Code version: 17391 R-Code CRC: 50630 Source CRC: crctest10.p crctest10.p 3508 Source CRC: test1.i includes/test1.i 39814 Source CRC: test2.i includes/test2.i 25255 Source CRC: test3.i /tmp/test/dir1/includes/test3.i 17664 R-Code file: crctest11/dir1/crctest11.r Size: 1305 Compiled on: 1436710475 (0x55a2764b) Sun Jul 12 07:14:35 2015 R-Code version: 1100 R-Code CRC: 50630 Source CRC: crctest11.p crctest11.p 3508 Source CRC: test1.i includes/test1.i 39814 Source CRC: test2.i includes/test2.i 25255 Source CRC: test3.i /tmp/test/dir1/includes/test3.i 17664
the example can be take further with:
procrc.py --dir /path/to/directory -d to/directory2 -d /directory3 dotrfile1.p dotrfile2.r
This will print the contents of any dotr's found the three directories named here as well as dotrfile1.r and dotrfile2.r for directory2, notice the relative path, this is relative to your current working directory. Any read or permission errors are supressed.
The export option was added so the crc information could be more easily imported into a Progress program.
procrc.py --export -d crctest9/dir1 -d crctest10/dir1 -d crctest11/dir1 "crctest9/dir1/crctest9.r" 879 2015-07-12T06:43:29 908 50630 "crctest9/dir1/crctest9.r" "crctest9.p" ".\crctest9.p" 25690 "crctest9/dir1/crctest9.r" "test1.i" ".\includes\test1.i" 39814 "crctest9/dir1/crctest9.r" "test2.i" ".\includes\test2.i" 25255 "crctest9/dir1/crctest9.r" "test3.i" "C:\temp\test\dir1\includes\test3.i" 17664 . "crctest10/dir1/crctest10.r" 1369 2015-07-12T06:32:30 17391 50630 "crctest10/dir1/crctest10.r" "crctest10.p" "crctest10.p" 3508 "crctest10/dir1/crctest10.r" "test1.i" "includes/test1.i" 39814 "crctest10/dir1/crctest10.r" "test2.i" "includes/test2.i" 25255 "crctest10/dir1/crctest10.r" "test3.i" "/tmp/test/dir1/includes/test3.i" 17664 . "crctest11/dir1/crctest11.r" 1305 2015-07-12T07:14:35 1100 50630 "crctest11/dir1/crctest11.r" "crctest11.p" "crctest11.p" 3508 "crctest11/dir1/crctest11.r" "test1.i" "includes/test1.i" 39814 "crctest11/dir1/crctest11.r" "test2.i" "includes/test2.i" 25255 "crctest11/dir1/crctest11.r" "test3.i" "/tmp/test/dir1/includes/test3.i" 17664 . .
Any errors are ignored.
define temp-table pheader field dotr as char format "x(18)" /* adjust as needed */ field file_size as int format ">>>>>>9" field compiled_on as datetime field rcode_version as int format ">>>>9" field rcode_crc as int format ">>>>>9" . define temp-table pdetail field dotr as char format "x(18)" /* should be same size as pheader.dotr */ field module_basename as char format "x(18)" field module_fullpath as char format "x(30)" /* make longer based on need */ field module_crc as int format ">>>>9" index idx1 dotr module_basename .
This option will only export the header information for each of the dotr files reported.
procrc.py --only --export -d crctest9/dir1 -d crctest10/dir1 -d crctest11/dir1 "crctest9/dir1/crctest9.r" 879 2015-07-12T06:43:29 908 50630 "crctest10/dir1/crctest10.r" 1369 2015-07-12T06:32:30 17391 50630 "crctest11/dir1/crctest11.r" 1305 2015-07-12T07:14:35 1100 50630 .
The compare option will display a report of the CRC differences (to the include level) between the directory specified in the --compare option to the list of files specified in the --dir option or on the command line. The filenames will compare based on the basename of the file (without the path). Only the differences will be displayed.
procrc.py -d crctest9/dir1 --compare crctest9/dir2 -d crctest10/dir1 -d crctest11/dir1 -c crctest10/dir2 -c crctest11/dir2 ***procrc.py - Copyright (C) 2015 Frank Spaniak, see --help Dir crctest9/dir1 CDir crctest9/dir2 FileName CRC Dir CRC Cdir crctest10.r 50630 48671 crctest10.p 3508 6343 test2.i 25255 48677 crctest11.r 50630 48671 crctest11.p 3508 6343 test2.i 25255 48677 crctest9.r 50630 48671 crctest9.p 25690 28969 test2.i 25255 48677 3 unique files checked, 6 differences found.
Finally, on the compare option you can add --message which will display a user defined message at the top of the report
procrc.py -d crctest11/dir1 -c crctest11/dir2 --message "comparison report for crctest11" ***procrc.py - Copyright (C) 2015 Frank Spaniak, see --help comparison report for crctest11 Dir crctest11/dir1 CDir crctest11/dir2 FileName CRC Dir CRC Cdir crctest11.r 50630 48671 crctest11.p 3508 6343 test2.i 25255 48677 1 unique files checked, 2 differences found.
Procrc.py in tar file OR here zipfile or view source Here