I am really bored to convert the FORTRAN array decorator () to C array , and eventually, I hacked this small script to do the tendious work:
import sys, re, string
p = re.compile( ‘([A-Z]+)\(([^\(\)]+)\)‘ )
for line in sys.stdin:
print string.rstrip( p.sub( r‘\1[\2]‘, line ))+";"
The usage is quite simple:
Here is the trick: the array consists variable name(captilized letters), (, whatever, ). we group the variable name and whatever as group 1, 2; then replace (, ) with [, ]. A simple demostration of how powerful the regular expression is.