Debian Codegraph @

common/fixrc.rexx

raw
1 /*
2 * This program converts a generic Win32 resource file into a version-specific
3 * one.
4 * Parameters:
5 * Input: input rc file
6 * Output: output rc file with version numbers
7 * Version: in x.x or x.x.x format
8 * Architecture (32bit/64bit): 32 or 64
9 * Interpreter: Regina, ooRexx, etc
10 * Version Date: DD MON YYYY - MUST be last in argument list!
11 * Assumptions: input file exists and in correct format
12 * output file is writeable
13 */
14 Parse Arg input output version arch interpreter verdate
15 If Words( verdate ) \= 3 Then
16 Do
17 Say 'Invalid value of "'verdate'" for version date.'
18 Exit 1
19 End
20 verdate = Strip( verdate, 'B', '"' )
21 interpreter = Strip( interpreter, 'B', '"' )
22 verdot = version
23 num_dots = Countstr( '.', verdot )
24 Select
25 When num_dots = 1 Then
26 Do
27 qm_ver = '?.?'
28 qm_vercomma = '?,?'
29 End
30 When num_dots = 2 Then
31 Do
32 qm_ver = '?.?.?'
33 qm_vercomma = '?,?,?'
34 End
35 Otherwise Say 'Invalid verdot format:' verdot'. Must be x.x or x.x.x'
36 End
37 vercomma = Changestr( '.', version, ',' )
38 veryear = Left( Date( 'S' ), 4 )
39 Call Stream input, 'C', 'OPEN READ'
40 Do While Lines( input) > 0
41 line = Linein( input )
42 If num_dots = 2 & Countstr( '?.?.0', line ) = 1 Then line = Changestr( '?.?.0', line, verdot )
43 If num_dots = 2 & Countstr( '?,?,0', line ) = 1 Then line = Changestr( '?,?,0', line, vercomma )
44 line = Changestr( qm_ver, line, verdot )
45 line = Changestr( qm_vercomma, line, vercomma )
46 line = Changestr( '????????', line, verdate )
47 line = Changestr( '????', line, veryear )
48 line = Changestr( '??bits??', line, arch )
49 line = Changestr( '??interpreter??', line, interpreter )
50 Queue line
51 End
52 Call Stream input, 'C', 'CLOSE'
53 -- input can be same as output, so need to close input first
54 Call Stream output, 'C', 'OPEN WRITE REPLACE'
55 Do Queued()
56 Parse Pull line
57 Call Lineout output, line
58 End
59 Call Stream output, 'C', 'CLOSE'
60 Return 0