Skip to content

Commit fe9e797

Browse files
committed
sockopts - fix for major_changed
allow both versions of major_changed after and before based on zmq version
1 parent 8543c0b commit fe9e797

File tree

4 files changed

+155
-138
lines changed

4 files changed

+155
-138
lines changed

options/sockopts_get.gsl

+8
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ PHP_METHOD(zmqsocket, getsockopt)
4949
.-
5050
. if php_type = "int"
5151
.-
52+
. if defined (major_changed)
53+
# if ZMQ_VERSION_MAJOR < $(major_changed)
5254
SOCKOPTS_GET_INT($(NAME), $(c_type));
55+
# else
56+
SOCKOPTS_GET_INT($(NAME), $(c_type_new));
57+
# endif
58+
. else
59+
SOCKOPTS_GET_INT($(NAME), $(c_type));
60+
. endif
5361
.-
5462
. elsif php_type = "string"
5563
.-

options/sockopts_preprocess.gsl

+31-70
Original file line numberDiff line numberDiff line change
@@ -24,88 +24,49 @@ for version
2424
option.is_alias = "YES"
2525
endif
2626

27-
if defined (major_changed)
28-
if type_new = "uint64" | type_new = "int64" | type_new = "uint32"
27+
if type = "uint64" | type = "int64" | type = "uint32" | type = "int"
2928

30-
option.php_type = "int"
31-
option.c_type = "$(type_new)_t"
32-
option.binary = "no"
33-
34-
elsif type_new = "int"
35-
36-
option.php_type = "int"
37-
option.c_type = "$(type_new)"
38-
option.binary = "no"
39-
40-
elsif type_new = "string"
41-
42-
option.php_type = "string"
43-
option.c_type = "char"
44-
option.max_length = 255
45-
46-
if name = "subscribe" | name = "usubscribe" | name = "identity"
47-
option.binary = "yes"
48-
else
49-
option.binary = "no"
29+
option.php_type = "int"
30+
option.c_type = "$(type)_t"
31+
if(option.c_type = "int_t")
32+
option.c_type = "int"
33+
endif
34+
if defined (major_changed)
35+
option.c_type_new = "$(type_new)_t"
36+
if(option.c_type_new = "int_t")
37+
option.c_type_new = "int"
5038
endif
39+
option.major_changed = major_changed
40+
endif
41+
option.binary = "no"
5142

52-
elsif type_new = "key"
53-
54-
option.php_type = "string"
55-
option.c_type = "char"
56-
option.max_length = 32
57-
option.binary = "yes"
58-
59-
elsif type_new = "socket"
43+
elsif type = "string"
6044

61-
option.php_type = "resource"
62-
option.c_type = "int"
63-
option.binary = "no"
45+
option.php_type = "string"
46+
option.c_type = "char"
47+
option.max_length = 255
6448

49+
if name = "subscribe" | name = "usubscribe" | name = "identity"
50+
option.binary = "yes"
6551
else
66-
echo "ERROR: Unrecognised type: $(type_new)"
52+
option.binary = "no"
6753
endif
68-
else
69-
if type = "uint64" | type = "int64" | type = "uint32"
7054

71-
option.php_type = "int"
72-
option.c_type = "$(type)_t"
73-
option.binary = "no"
55+
elsif type = "key"
7456

75-
elsif type = "int"
57+
option.php_type = "string"
58+
option.c_type = "char"
59+
option.max_length = 32
60+
option.binary = "yes"
7661

77-
option.php_type = "int"
78-
option.c_type = "$(type)"
79-
option.binary = "no"
62+
elsif type = "socket"
8063

81-
elsif type = "string"
64+
option.php_type = "resource"
65+
option.c_type = "int"
66+
option.binary = "no"
8267

83-
option.php_type = "string"
84-
option.c_type = "char"
85-
option.max_length = 255
86-
87-
if name = "subscribe" | name = "usubscribe" | name = "identity"
88-
option.binary = "yes"
89-
else
90-
option.binary = "no"
91-
endif
92-
93-
elsif type = "key"
94-
95-
option.php_type = "string"
96-
option.c_type = "char"
97-
option.max_length = 32
98-
option.binary = "yes"
99-
100-
elsif type = "socket"
101-
102-
option.php_type = "resource"
103-
option.c_type = "int"
104-
option.binary = "no"
105-
106-
else
107-
echo "ERROR: Unrecognised type: $(type)"
108-
endif
68+
else
69+
echo "ERROR: Unrecognised type: $(type)"
10970
endif
11071
endfor
11172
endfor

options/sockopts_set.gsl

+9-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ PHP_METHOD(zmqsocket, setsockopt)
8787
.-
8888
. if php_type = "int"
8989
.-
90-
SOCKOPTS_SET_INT($(NAME), $(c_type))
90+
. if defined (major_changed)
91+
# if ZMQ_VERSION_MAJOR < $(major_changed)
92+
SOCKOPTS_SET_INT($(NAME), $(c_type))
93+
# else
94+
SOCKOPTS_SET_INT($(NAME), $(c_type_new))
95+
# endif
96+
. else
97+
SOCKOPTS_SET_INT($(NAME), $(c_type))
98+
. endif
9199
.-
92100
. elsif php_type = "string"
93101
.-

0 commit comments

Comments
 (0)