Bug 125902 - dcop_add/dcop_next does not support some integer types
Summary: dcop_add/dcop_next does not support some integer types
Status: RESOLVED UNMAINTAINED
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-19 18:37 UTC by Mathias Panzenböck
Modified: 2010-01-20 21:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Panzenböck 2006-04-19 18:37:48 UTC
Version:           435268 (using KDE Devel)
OS:                Linux

pyKDEs dcop_add/dcop_next could easyly support a lot of more int-datatypes. The support is actually there (for char,  short, int, long. signed and unsigned), only the name recognition of the types is not complete. e.g. "long" does work, but "long int" (as used in kmix.Mixer*.absoluteVolume(int deviceidx)) won't.

As a workaround I have defined following type-mapping:
intMarshallers = {
	'bool':    (marshall_bool, unmarshall_bool),
	
	'Q_INT8':  (marshall_int8, unmarshall_int8),
	'Q_UINT8': (marshall_uint8, unmarshall_uint8),
	'QChar':   (marshall_int8, unmarshall_uint8),
	'int8_t':  (marshall_int8, unmarshall_int8),
	'uint8_t': (marshall_uint8, unmarshall_uint8),
	
	'Q_INT16':  (marshall_int16, unmarshall_int16),
	'Q_UINT16': (marshall_uint16, unmarshall_uint16),
	'int16_t':  (marshall_int16, unmarshall_int16),
	'uint16_t': (marshall_uint16, unmarshall_uint16),
	
	'Q_INT32':  (marshall_int32, unmarshall_int32),
	'Q_UINT32': (marshall_uint32, unmarshall_uint32),
	'int32_t':  (marshall_int32, unmarshall_int32),
	'uint32_t': (marshall_uint32, unmarshall_uint32),
	
	'Q_LONG':   (marshall_long, unmarshall_long),
	'Q_ULONG':  (marshall_ulong, unmarshall_ulong),
	
	'Q_LLONG':  (marshall_int64, unmarshall_int64),
	'Q_ULLONG': (marshall_uint64, unmarshall_uint64),
	'Q_INT64':  (marshall_int64, unmarshall_int64),
	'Q_UINT64': (marshall_uint64, unmarshall_uint64),
	'int64_t':  (marshall_int64, unmarshall_int64),
	'uint64_t': (marshall_uint64, unmarshall_uint64),

	'signed short':   (marshall_int16, unmarshall_int16),
	'unsigned short': (marshall_uint16, unmarshall_uint16),
	
	'signed':       (marshall_int32, unmarshall_int32),
	'unsigned':     (marshall_uint32, unmarshall_uint32),
	'signed int':   (marshall_int32, unmarshall_int32),
	'unsigned int': (marshall_uint32, unmarshall_uint32),
	
	'signed long':       (marshall_long, unmarshall_long),
	'unsigned long':     (marshall_ulong, unmarshall_ulong),
	'long int':          (marshall_long, unmarshall_long),
	'signed long int':   (marshall_long, unmarshall_long),
	'unsigned long int': (marshall_ulong, unmarshall_ulong),
	
	'long long':              (marshall_int64, unmarshall_int64),
	'long long int':          (marshall_int64, unmarshall_int64),
	'signed long long':       (marshall_int64, unmarshall_int64),
	'signed long long int':   (marshall_int64, unmarshall_int64),
	'unsigned long long':     (marshall_uint64, unmarshall_uint64),
	'unsigned long long int': (marshall_uint64, unmarshall_uint64),
}

Here the implementation of the (un)marshallers:
def marshall_bool(stream,val):
	dcop_add(stream,int(val),'char')

def unmarshall_bool(stream):
	return bool(dcop_next(stream,'char'))

def marshall_int8(stream,val):
	dcop_add(stream,val,'char')

def marshall_uint8(stream,val):
	dcop_add(stream,val,'uchar')

def unmarshall_int8(stream):
	return dcop_next(stream,'char')
	
def unmarshall_uint8(stream):
	return dcop_next(stream,'unsigned char')
	
def marshall_int16(stream,val):
	dcop_add(stream,val,'short')

def marshall_uint16(stream,val):
	dcop_add(stream,val,'ushort')

def unmarshall_int16(stream):
	return dcop_next(stream,'short')
	
def unmarshall_uint16(stream):
	return dcop_next(stream,'unsigned short')

def marshall_int32(stream,val):
	dcop_add(stream,val,'int')

def marshall_uint32(stream,val):
	dcop_add(stream,val,'uint')
	
def unmarshall_int32(stream):
	return dcop_next(stream,'int')
	
def unmarshall_uint32(stream):
	return dcop_next(stream,'uint')

def marshall_long(stream,val):
	dcop_add(stream,val,'long')

def marshall_ulong(stream,val):
	dcop_add(stream,val,'ulong')
	
def unmarshall_long(stream):
	return dcop_next(stream,'long')
	
def unmarshall_ulong(stream):
	return dcop_next(stream,'ulong')

# XXX int64/long long is not yet supported by pyKDE
def marshall_int64(stream,val):
	dcop_add(stream,val,'long long')

def marshall_uint64(stream,val):
	dcop_add(stream,val,'unsigned long long')
	
def unmarshall_int64(stream):
	return dcop_next(stream,'long long')
	
def unmarshall_uint64(stream):
	return dcop_next(stream,'unsigned long long')
Comment 1 Dario Andres 2010-01-20 21:15:40 UTC
Closing as DCOP is unmaintained.