Skip to content

Commit d804580

Browse files
Fix Ruby and PHP
1 parent de618bf commit d804580

File tree

4 files changed

+13
-410
lines changed

4 files changed

+13
-410
lines changed

php/lib/IceLocal/Connection.php

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -63,67 +63,6 @@ public function heartbeat($con);
6363
$Ice__t_HeartbeatCallback = IcePHP_defineClass('::Ice::HeartbeatCallback', '\\Ice\\HeartbeatCallback', -1, true, null, null);
6464
}
6565

66-
namespace Ice
67-
{
68-
global $Ice__t_ACMClose;
69-
class ACMClose
70-
{
71-
const CloseOff = 0;
72-
const CloseOnIdle = 1;
73-
const CloseOnInvocation = 2;
74-
const CloseOnInvocationAndIdle = 3;
75-
const CloseOnIdleForceful = 4;
76-
}
77-
78-
$Ice__t_ACMClose = IcePHP_defineEnum('::Ice::ACMClose', array('CloseOff', 0, 'CloseOnIdle', 1, 'CloseOnInvocation', 2, 'CloseOnInvocationAndIdle', 3, 'CloseOnIdleForceful', 4));
79-
}
80-
81-
namespace Ice
82-
{
83-
global $Ice__t_ACMHeartbeat;
84-
class ACMHeartbeat
85-
{
86-
const HeartbeatOff = 0;
87-
const HeartbeatOnDispatch = 1;
88-
const HeartbeatOnIdle = 2;
89-
const HeartbeatAlways = 3;
90-
}
91-
92-
$Ice__t_ACMHeartbeat = IcePHP_defineEnum('::Ice::ACMHeartbeat', array('HeartbeatOff', 0, 'HeartbeatOnDispatch', 1, 'HeartbeatOnIdle', 2, 'HeartbeatAlways', 3));
93-
}
94-
95-
namespace Ice
96-
{
97-
global $Ice__t_ACM;
98-
class ACM
99-
{
100-
public function __construct($timeout=0, $close=\Ice\ACMClose::CloseOff, $heartbeat=\Ice\ACMHeartbeat::HeartbeatOff)
101-
{
102-
$this->timeout = $timeout;
103-
$this->close = $close;
104-
$this->heartbeat = $heartbeat;
105-
}
106-
107-
public function __toString(): string
108-
{
109-
global $Ice__t_ACM;
110-
return IcePHP_stringify($this, $Ice__t_ACM);
111-
}
112-
113-
public $timeout;
114-
public $close;
115-
public $heartbeat;
116-
}
117-
118-
global $IcePHP__t_int;
119-
global $Ice__t_ACMClose;
120-
global $Ice__t_ACMHeartbeat;
121-
$Ice__t_ACM = IcePHP_defineStruct('::Ice::ACM', '\\Ice\\ACM', array(
122-
array('timeout', $IcePHP__t_int),
123-
array('close', $Ice__t_ACMClose),
124-
array('heartbeat', $Ice__t_ACMHeartbeat)));
125-
}
126-
12766
namespace Ice
12867
{
12968
global $Ice__t_ConnectionClose;

php/src/Connection.cpp

Lines changed: 13 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -175,103 +175,6 @@ ZEND_METHOD(Ice_Connection, heartbeat)
175175
}
176176
}
177177

178-
ZEND_BEGIN_ARG_INFO_EX(Ice_Connection_setACM_arginfo, 1, ZEND_RETURN_VALUE, static_cast<zend_ulong>(3))
179-
ZEND_ARG_INFO(0, timeout)
180-
ZEND_ARG_INFO(0, close)
181-
ZEND_ARG_INFO(0, heartbeat)
182-
ZEND_END_ARG_INFO()
183-
184-
ZEND_METHOD(Ice_Connection, setACM)
185-
{
186-
Ice::ConnectionPtr _this = Wrapper<Ice::ConnectionPtr>::value(getThis());
187-
assert(_this);
188-
189-
zval* t;
190-
zval* c;
191-
zval* h;
192-
if (zend_parse_parameters(ZEND_NUM_ARGS(), const_cast<char*>("zzz"), &t, &c, &h) != SUCCESS)
193-
{
194-
RETURN_NULL();
195-
}
196-
197-
optional<int32_t> timeout;
198-
optional<Ice::ACMClose> close;
199-
optional<Ice::ACMHeartbeat> heartbeat;
200-
201-
if (!isUnset(t))
202-
{
203-
if (Z_TYPE_P(t) != IS_LONG)
204-
{
205-
invalidArgument("value for 'timeout' argument must be Unset or an integer");
206-
RETURN_NULL();
207-
}
208-
timeout = static_cast<int32_t>(Z_LVAL_P(t));
209-
}
210-
211-
if (!isUnset(c))
212-
{
213-
if (Z_TYPE_P(c) != IS_LONG)
214-
{
215-
invalidArgument("value for 'close' argument must be Unset or an enumerator of ACMClose");
216-
RETURN_NULL();
217-
}
218-
close = static_cast<Ice::ACMClose>(Z_LVAL_P(c));
219-
}
220-
221-
if (!isUnset(h))
222-
{
223-
if (Z_TYPE_P(h) != IS_LONG)
224-
{
225-
invalidArgument("value for 'heartbeat' argument must be Unset or an enumerator of ACMHeartbeat");
226-
RETURN_NULL();
227-
}
228-
heartbeat = static_cast<Ice::ACMHeartbeat>(Z_LVAL_P(h));
229-
}
230-
231-
try
232-
{
233-
_this->setACM(timeout, close, heartbeat);
234-
}
235-
catch (...)
236-
{
237-
throwException(current_exception());
238-
RETURN_NULL();
239-
}
240-
}
241-
242-
ZEND_METHOD(Ice_Connection, getACM)
243-
{
244-
if (ZEND_NUM_ARGS() > 0)
245-
{
246-
WRONG_PARAM_COUNT;
247-
}
248-
249-
Ice::ConnectionPtr _this = Wrapper<Ice::ConnectionPtr>::value(getThis());
250-
assert(_this);
251-
252-
try
253-
{
254-
Ice::ACM acm = _this->getACM();
255-
256-
zend_class_entry* acmClass = idToClass("::Ice::ACM");
257-
258-
if (object_init_ex(return_value, const_cast<zend_class_entry*>(acmClass)) != SUCCESS)
259-
{
260-
runtimeError("unable to initialize object of type %s", acmClass->name);
261-
RETURN_NULL();
262-
}
263-
264-
add_property_long(return_value, "timeout", static_cast<long>(acm.timeout));
265-
add_property_long(return_value, "close", static_cast<long>(acm.close));
266-
add_property_long(return_value, "heartbeat", static_cast<long>(acm.heartbeat));
267-
}
268-
catch (...)
269-
{
270-
throwException(current_exception());
271-
RETURN_NULL();
272-
}
273-
}
274-
275178
ZEND_METHOD(Ice_Connection, type)
276179
{
277180
if (ZEND_NUM_ARGS() > 0)
@@ -440,23 +343,19 @@ static zend_function_entry _connectionClassMethods[] = {
440343
__toString,
441344
ice_to_string_arginfo,
442345
ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, close, Ice_Connection_close_arginfo, ZEND_ACC_PUBLIC)
443-
ZEND_ME(Ice_Connection, getEndpoint, ice_void_arginfo, ZEND_ACC_PUBLIC)
444-
ZEND_ME(Ice_Connection, flushBatchRequests, Ice_Connection_flushBatchRequests_arginfo, ZEND_ACC_PUBLIC)
445-
ZEND_ME(Ice_Connection, heartbeat, ice_void_arginfo, ZEND_ACC_PUBLIC)
446-
ZEND_ME(Ice_Connection, setACM, Ice_Connection_setACM_arginfo, ZEND_ACC_PUBLIC)
447-
ZEND_ME(Ice_Connection, getACM, ice_void_arginfo, ZEND_ACC_PUBLIC)
448-
ZEND_ME(Ice_Connection, type, ice_void_arginfo, ZEND_ACC_PUBLIC)
449-
ZEND_ME(Ice_Connection, timeout, ice_void_arginfo, ZEND_ACC_PUBLIC)
450-
ZEND_ME(Ice_Connection, toString, ice_void_arginfo, ZEND_ACC_PUBLIC)
451-
ZEND_ME(Ice_Connection, getInfo, ice_void_arginfo, ZEND_ACC_PUBLIC) ZEND_ME(
452-
Ice_Connection,
453-
setBufferSize,
454-
Ice_Connection_setBufferSize_arginfo,
455-
ZEND_ACC_PUBLIC)
456-
ZEND_ME(Ice_Connection, throwException, ice_void_arginfo, ZEND_ACC_PUBLIC){
457-
0,
458-
0,
459-
0}};
346+
ZEND_ME(Ice_Connection, getEndpoint, ice_void_arginfo, ZEND_ACC_PUBLIC) ZEND_ME(
347+
Ice_Connection,
348+
flushBatchRequests,
349+
Ice_Connection_flushBatchRequests_arginfo,
350+
ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, heartbeat, ice_void_arginfo, ZEND_ACC_PUBLIC)
351+
ZEND_ME(Ice_Connection, type, ice_void_arginfo, ZEND_ACC_PUBLIC) ZEND_ME(
352+
Ice_Connection,
353+
timeout,
354+
ice_void_arginfo,
355+
ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, toString, ice_void_arginfo, ZEND_ACC_PUBLIC)
356+
ZEND_ME(Ice_Connection, getInfo, ice_void_arginfo, ZEND_ACC_PUBLIC)
357+
ZEND_ME(Ice_Connection, setBufferSize, Ice_Connection_setBufferSize_arginfo, ZEND_ACC_PUBLIC)
358+
ZEND_ME(Ice_Connection, throwException, ice_void_arginfo, ZEND_ACC_PUBLIC){0, 0, 0}};
460359

461360
ZEND_METHOD(Ice_ConnectionInfo, __construct) { runtimeError("ConnectionInfo cannot be instantiated"); }
462361

ruby/ruby/IceLocal/Connection.rb

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -111,148 +111,6 @@ def initialize(underlying=nil, incoming=false, adapterName='', connectionId='')
111111
T_HeartbeatCallback = ::Ice::__declareLocalClass('::Ice::HeartbeatCallback')
112112
end
113113

114-
if not defined?(::Ice::ACMClose)
115-
class ACMClose
116-
include Comparable
117-
118-
def initialize(name, value)
119-
@name = name
120-
@value = value
121-
end
122-
123-
def ACMClose.from_int(val)
124-
@@_enumerators[val]
125-
end
126-
127-
def to_s
128-
@name
129-
end
130-
131-
def to_i
132-
@value
133-
end
134-
135-
def <=>(other)
136-
other.is_a?(ACMClose) or raise ArgumentError, "value must be a ACMClose"
137-
@value <=> other.to_i
138-
end
139-
140-
def hash
141-
@value.hash
142-
end
143-
144-
def ACMClose.each(&block)
145-
@@_enumerators.each_value(&block)
146-
end
147-
148-
CloseOff = ACMClose.new("CloseOff", 0)
149-
CloseOnIdle = ACMClose.new("CloseOnIdle", 1)
150-
CloseOnInvocation = ACMClose.new("CloseOnInvocation", 2)
151-
CloseOnInvocationAndIdle = ACMClose.new("CloseOnInvocationAndIdle", 3)
152-
CloseOnIdleForceful = ACMClose.new("CloseOnIdleForceful", 4)
153-
154-
@@_enumerators = {0=>CloseOff, 1=>CloseOnIdle, 2=>CloseOnInvocation, 3=>CloseOnInvocationAndIdle, 4=>CloseOnIdleForceful}
155-
156-
def ACMClose._enumerators
157-
@@_enumerators
158-
end
159-
160-
private_class_method :new
161-
end
162-
163-
T_ACMClose = ::Ice::__defineEnum('::Ice::ACMClose', ACMClose, ACMClose::_enumerators)
164-
end
165-
166-
if not defined?(::Ice::ACMHeartbeat)
167-
class ACMHeartbeat
168-
include Comparable
169-
170-
def initialize(name, value)
171-
@name = name
172-
@value = value
173-
end
174-
175-
def ACMHeartbeat.from_int(val)
176-
@@_enumerators[val]
177-
end
178-
179-
def to_s
180-
@name
181-
end
182-
183-
def to_i
184-
@value
185-
end
186-
187-
def <=>(other)
188-
other.is_a?(ACMHeartbeat) or raise ArgumentError, "value must be a ACMHeartbeat"
189-
@value <=> other.to_i
190-
end
191-
192-
def hash
193-
@value.hash
194-
end
195-
196-
def ACMHeartbeat.each(&block)
197-
@@_enumerators.each_value(&block)
198-
end
199-
200-
HeartbeatOff = ACMHeartbeat.new("HeartbeatOff", 0)
201-
HeartbeatOnDispatch = ACMHeartbeat.new("HeartbeatOnDispatch", 1)
202-
HeartbeatOnIdle = ACMHeartbeat.new("HeartbeatOnIdle", 2)
203-
HeartbeatAlways = ACMHeartbeat.new("HeartbeatAlways", 3)
204-
205-
@@_enumerators = {0=>HeartbeatOff, 1=>HeartbeatOnDispatch, 2=>HeartbeatOnIdle, 3=>HeartbeatAlways}
206-
207-
def ACMHeartbeat._enumerators
208-
@@_enumerators
209-
end
210-
211-
private_class_method :new
212-
end
213-
214-
T_ACMHeartbeat = ::Ice::__defineEnum('::Ice::ACMHeartbeat', ACMHeartbeat, ACMHeartbeat::_enumerators)
215-
end
216-
217-
if not defined?(::Ice::ACM)
218-
class ACM
219-
include ::Ice::Inspect_mixin
220-
def initialize(timeout=0, close=::Ice::ACMClose::CloseOff, heartbeat=::Ice::ACMHeartbeat::HeartbeatOff)
221-
@timeout = timeout
222-
@close = close
223-
@heartbeat = heartbeat
224-
end
225-
226-
def hash
227-
_h = 0
228-
_h = 5 * _h + @timeout.hash
229-
_h = 5 * _h + @close.hash
230-
_h = 5 * _h + @heartbeat.hash
231-
_h % 0x7fffffff
232-
end
233-
234-
def ==(other)
235-
return false if !other.is_a? ::Ice::ACM or
236-
@timeout != other.timeout or
237-
@close != other.close or
238-
@heartbeat != other.heartbeat
239-
true
240-
end
241-
242-
def eql?(other)
243-
return other.class == self.class && other == self
244-
end
245-
246-
attr_accessor :timeout, :close, :heartbeat
247-
end
248-
249-
T_ACM = ::Ice::__defineStruct('::Ice::ACM', ACM, [
250-
["timeout", ::Ice::T_int],
251-
["close", ::Ice::T_ACMClose],
252-
["heartbeat", ::Ice::T_ACMHeartbeat]
253-
])
254-
end
255-
256114
if not defined?(::Ice::ConnectionClose)
257115
class ConnectionClose
258116
include Comparable

0 commit comments

Comments
 (0)