@@ -43,15 +43,19 @@ def create_dict_of_defines(lines,file_out):
43
43
if line .startswith ("#define" ):
44
44
buffer = line .split ()
45
45
key = buffer [1 ]
46
- value = " " .join (buffer [2 :])
47
- if key [0 ] == '_' or '(' in key or ',' in value :
46
+ try :
47
+ value = int (eval (" " .join (buffer [2 :]).strip ()))
48
+ except :
48
49
continue
49
- command = "%(key)s=%(value)s\n d['%(key)s']=%(key)s" % locals ()
50
+ if key [0 ] == '_' or '(' in key :
51
+ continue
52
+ d [key ] = value
53
+ command = "%(key)s=%(value)d\n d['%(key)s']=%(key)s" % locals ()
50
54
command = re .sub ("/\*.*?\*/" , "" , command )
51
55
exec command in locals ()
52
56
53
57
# Add the version number:
54
- d ['ZMQ_VERSION' ] = ZMQ_VERSION_MAJOR * 10000 + ZMQ_VERSION_MINOR * 100 + ZMQ_VERSION_PATCH
58
+ d ['ZMQ_VERSION' ] = int ( d [ ' ZMQ_VERSION_MAJOR' ]) * 10000 + int ( d [ ' ZMQ_VERSION_MINOR' ]) * 100 + int ( d [ ' ZMQ_VERSION_PATCH' ])
55
59
d ['ZMQ_PTR' ] = ctypes .sizeof (ctypes .c_voidp )
56
60
print "==========================================="
57
61
print "ZMQ_PTR set to %d (for %d-bit architectures)" % (d ['ZMQ_PTR' ],d ['ZMQ_PTR' ]* 8 )
@@ -63,7 +67,11 @@ def create_dict_of_defines(lines,file_out):
63
67
for k in keys :
64
68
print >> file_out , " integer %s" % (k )
65
69
for k in keys :
66
- print >> file_out , " parameter ( %-20s = %s )" % (k , d [k ])
70
+ buffer = " parameter(%s=%s)" % (k , d [k ])
71
+ if len (buffer ) > 72 :
72
+ buffer = " parameter(\n & %s=%s)" % (k , d [k ])
73
+ print >> file_out , buffer
74
+
67
75
return None
68
76
69
77
def create_prototypes (lines ,file_out ):
@@ -126,6 +134,13 @@ def main():
126
134
127
135
file_out .close ()
128
136
137
+ file_in = open ('f77_zmq.h' ,'r' )
138
+ file_out = open ('f77_zmq_free.h' ,'w' )
139
+ file_out .write (file_in .read ().replace ('\n &' ,' &\n ' ))
140
+ file_in .close ()
141
+ file_out .close ()
142
+
143
+
129
144
130
145
if __name__ == '__main__' :
131
146
main ()
0 commit comments