Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
8b829bbe
Kaydet (Commit)
8b829bbe
authored
Mar 30, 2003
tarafından
Jörg Budischewski
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#i12673# some cosmetics and small bugfixes (provided by zagy)
üst
4c937bbd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
40 deletions
+85
-40
pyuno
pyuno/source/module/pyuno
+1
-1
pyuno_runtime.cxx
pyuno/source/module/pyuno_runtime.cxx
+38
-6
uno.py
pyuno/source/module/uno.py
+46
-33
No files found.
pyuno/source/module/pyuno
Dosyayı görüntüle @
8b829bbe
# The bootstrap variable PYUNOLIBDIR will be set by the pyuno runtime library
# The bootstrap variable PYUNOLIBDIR will be set by the pyuno runtime library
PYUNO_BINPATH=$PYUNOLIBDIR/../bin$UPDMINOREXT
PYUNO_BINPATH=$PYUNOLIBDIR/../bin$UPDMINOREXT
UNO_TYPES=$PYUNO_BINPATH/
applicat
.rdb
UNO_TYPES=$PYUNO_BINPATH/
types
.rdb
UNO_SERVICES=$PYUNO_BINPATH/pyuno_services.rdb
UNO_SERVICES=$PYUNO_BINPATH/pyuno_services.rdb
pyuno/source/module/pyuno_runtime.cxx
Dosyayı görüntüle @
8b829bbe
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: pyuno_runtime.cxx,v $
* $RCSfile: pyuno_runtime.cxx,v $
*
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
*
* last change: $Author: jbu $ $Date: 2003-03-
23 12:12:58
$
* last change: $Author: jbu $ $Date: 2003-03-
30 13:32:01
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -370,11 +370,11 @@ PyRef Runtime::any2PyObject (const Any &a ) const
...
@@ -370,11 +370,11 @@ PyRef Runtime::any2PyObject (const Any &a ) const
{
{
long
l
;
long
l
;
a
>>=
l
;
a
>>=
l
;
return
PyRef
(
Py
Long
_FromLong
(
l
),
SAL_NO_ACQUIRE
);
return
PyRef
(
Py
Int
_FromLong
(
l
),
SAL_NO_ACQUIRE
);
}
}
case
typelib_TypeClass_UNSIGNED_LONG
:
case
typelib_TypeClass_UNSIGNED_LONG
:
{
{
unsigned
long
l
;
sal_uInt32
l
;
a
>>=
l
;
a
>>=
l
;
return
PyRef
(
PyLong_FromUnsignedLong
(
l
),
SAL_NO_ACQUIRE
);
return
PyRef
(
PyLong_FromUnsignedLong
(
l
),
SAL_NO_ACQUIRE
);
}
}
...
@@ -622,7 +622,25 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
...
@@ -622,7 +622,25 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
else
if
(
PyLong_Check
(
o
))
else
if
(
PyLong_Check
(
o
))
{
{
sal_Int64
l
=
(
sal_Int64
)
PyLong_AsLong
(
o
);
sal_Int64
l
=
(
sal_Int64
)
PyLong_AsLong
(
o
);
a
<<=
l
;
if
(
l
<
128
&&
l
>=
-
128
)
{
sal_Int8
b
=
(
sal_Int8
)
l
;
a
<<=
b
;
}
else
if
(
l
<=
0x7fff
&&
l
>=
-
0x8000
)
{
sal_Int16
s
=
(
sal_Int16
)
l
;
a
<<=
s
;
}
else
if
(
l
<=
0x7fffffff
&&
l
>=
-
0x80000000
)
{
sal_Int32
l32
=
(
sal_Int32
)
l
;
a
<<=
l32
;
}
else
{
a
<<=
l
;
}
}
}
else
if
(
PyFloat_Check
(
o
))
else
if
(
PyFloat_Check
(
o
))
{
{
...
@@ -631,8 +649,20 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
...
@@ -631,8 +649,20 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
}
}
else
if
(
PyString_Check
(
o
))
else
if
(
PyString_Check
(
o
))
{
{
// needed, if ByteSequence becomes a string
// Runtime runtime;
// if( PyObject_IsInstance( o, getByteSequenceClass( runtime ).get() ) )
// {
// // is it the byte sequence ?
// Sequence< sal_Int8 > seq;
// seq = Sequence<sal_Int8 > ((sal_Int8*) PyString_AsString(o) , PyString_Size(o));
// a <<= seq;
// }
// else
// {
a
<<=
OUString
(
PyString_AsString
(
o
),
strlen
(
PyString_AsString
(
o
)),
a
<<=
OUString
(
PyString_AsString
(
o
),
strlen
(
PyString_AsString
(
o
)),
osl_getThreadTextEncoding
());
osl_getThreadTextEncoding
());
// }
}
}
else
if
(
PyUnicode_Check
(
o
)
)
else
if
(
PyUnicode_Check
(
o
)
)
{
{
...
@@ -668,6 +698,7 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
...
@@ -668,6 +698,7 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
else
else
{
{
Runtime
runtime
;
Runtime
runtime
;
// should be removed, in case ByteSequence gets derived from String
if
(
PyObject_IsInstance
(
o
,
getByteSequenceClass
(
runtime
).
get
()
)
)
if
(
PyObject_IsInstance
(
o
,
getByteSequenceClass
(
runtime
).
get
()
)
)
{
{
PyRef
str
(
PyObject_GetAttrString
(
o
,
"value"
),
SAL_NO_ACQUIRE
);
PyRef
str
(
PyObject_GetAttrString
(
o
,
"value"
),
SAL_NO_ACQUIRE
);
...
@@ -679,7 +710,8 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
...
@@ -679,7 +710,8 @@ Any Runtime::pyObject2Any ( const PyRef & source ) const
}
}
a
<<=
seq
;
a
<<=
seq
;
}
}
else
if
(
PyObject_IsInstance
(
o
,
getTypeClass
(
runtime
).
get
()
)
)
else
if
(
PyObject_IsInstance
(
o
,
getTypeClass
(
runtime
).
get
()
)
)
{
{
Type
t
=
PyType2Type
(
o
,
runtime
);
Type
t
=
PyType2Type
(
o
,
runtime
);
a
<<=
t
;
a
<<=
t
;
...
...
pyuno/source/module/uno.py
Dosyayı görüntüle @
8b829bbe
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
#
#
# $RCSfile: uno.py,v $
# $RCSfile: uno.py,v $
#
#
# $Revision: 1.
1
$
# $Revision: 1.
2
$
#
#
# last change: $Author: jbu $ $Date: 2003-03-
23 12:12:59
$
# last change: $Author: jbu $ $Date: 2003-03-
30 13:32:01
$
#
#
# The Contents of this file are made available subject to the terms of
# The Contents of this file are made available subject to the terms of
# either of the following licenses
# either of the following licenses
...
@@ -58,7 +58,6 @@
...
@@ -58,7 +58,6 @@
#
#
#*************************************************************************
#*************************************************************************
import
sys
import
sys
from
types
import
UnicodeType
,
StringTypes
import
pyuno
import
pyuno
import
__builtin__
import
__builtin__
...
@@ -137,8 +136,8 @@ class Enum:
...
@@ -137,8 +136,8 @@ class Enum:
def
__eq__
(
self
,
that
):
def
__eq__
(
self
,
that
):
if
not
isinstance
(
that
,
Enum
):
if
not
isinstance
(
that
,
Enum
):
return
0
return
False
return
(
self
.
typeName
==
that
.
typeName
)
and
(
self
.
value
==
that
.
value
)
return
(
self
.
typeName
==
that
.
typeName
)
and
(
self
.
value
==
that
.
value
)
class
Type
:
class
Type
:
"Represents a UNO type, use an instance of this class to explicitly pass a boolean to UNO"
"Represents a UNO type, use an instance of this class to explicitly pass a boolean to UNO"
...
@@ -153,7 +152,7 @@ class Type:
...
@@ -153,7 +152,7 @@ class Type:
def
__eq__
(
self
,
that
):
def
__eq__
(
self
,
that
):
if
not
isinstance
(
that
,
Type
):
if
not
isinstance
(
that
,
Type
):
return
0
return
False
return
self
.
typeClass
==
that
.
typeClass
and
self
.
typeName
==
that
.
typeName
return
self
.
typeClass
==
that
.
typeClass
and
self
.
typeName
==
that
.
typeName
def
__hash__
(
self
):
def
__hash__
(
self
):
...
@@ -165,66 +164,80 @@ class Bool(object):
...
@@ -165,66 +164,80 @@ class Bool(object):
Note: This class is deprecated. Use python's True and False directly instead
Note: This class is deprecated. Use python's True and False directly instead
"""
"""
def
__new__
(
cls
,
value
):
def
__new__
(
cls
,
value
):
if
isinstance
(
value
,
type
(
""
)
)
and
value
==
"true"
:
if
isinstance
(
value
,
(
str
,
unicode
)
)
and
value
==
"true"
:
return
True
return
True
elif
isinstance
(
value
,
type
(
""
)
)
and
value
==
"false"
:
if
isinstance
(
value
,
(
str
,
unicode
)
)
and
value
==
"false"
:
return
False
return
False
else
:
if
value
:
if
value
:
return
True
return
True
return
False
else
:
return
False
class
Char
:
class
Char
:
"Represents a UNO char, use an instance of this class to explicitly pass a char to UNO"
"Represents a UNO char, use an instance of this class to explicitly pass a char to UNO"
# @param value pass a Unicode string with length 1
# @param value pass a Unicode string with length 1
def
__init__
(
self
,
value
):
def
__init__
(
self
,
value
):
assert
isinstance
(
value
,
UnicodeTyp
e
)
assert
isinstance
(
value
,
unicod
e
)
assert
len
(
value
)
==
1
assert
len
(
value
)
==
1
self
.
value
=
value
self
.
value
=
value
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<Char instance
%
s>"
&
(
self
.
value
)
return
"<Char instance
%
s>"
%
(
self
.
value
,
)
def
__eq__
(
self
,
that
):
def
__eq__
(
self
,
that
):
if
isinstance
(
that
,
StringTypes
):
if
isinstance
(
that
,
(
str
,
unicode
)
):
if
len
(
that
)
>
1
:
if
len
(
that
)
>
1
:
return
0
return
False
return
self
.
value
==
that
[
0
]
return
self
.
value
==
that
[
0
]
el
if
isinstance
(
that
,
Char
):
if
isinstance
(
that
,
Char
):
return
self
.
value
==
that
.
value
return
self
.
value
==
that
.
value
return
0
return
False
# Suggested by Christian, but still some open problems which need to be solved first
#
#class ByteSequence(str):
#
# def __repr__(self):
# return "<ByteSequence instance %s>" % str.__repr__(self)
# for a little bit compatitbility; setting value is not possible as
# strings are immutable
# def _get_value(self):
# return self
#
# value = property(_get_value)
class
ByteSequence
:
class
ByteSequence
:
def
__init__
(
self
,
value
):
def
__init__
(
self
,
value
):
if
isinstance
(
value
,
StringTypes
):
if
isinstance
(
value
,
str
):
self
.
value
=
value
self
.
value
=
value
elif
isinstance
(
value
,
ByteSequence
):
elif
isinstance
(
value
,
ByteSequence
):
self
.
value
=
value
.
value
self
.
value
=
value
.
value
else
:
else
:
raise
TypeError
(
"expected string or bytesequence"
)
raise
TypeError
(
"expected string or bytesequence"
)
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<ByteSequence instance
%
s>"
%
(
self
.
value
)
return
"<ByteSequence instance
'
%
s'>"
%
(
self
.
value
,
)
def
__eq__
(
self
,
that
):
def
__eq__
(
self
,
that
):
if
isinstance
(
that
,
ByteSequence
):
if
isinstance
(
that
,
ByteSequence
):
return
self
.
value
==
that
.
value
return
self
.
value
==
that
.
value
elif
isinstance
(
that
,
StringTypes
):
if
isinstance
(
that
,
str
):
return
self
.
value
==
that
return
self
.
value
==
that
r
aise
TypeError
(
"expected string or bytesequence for comparison"
)
r
eturn
False
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
value
)
return
len
(
self
.
value
)
def
__getitem__
(
self
,
index
):
def
__getitem__
(
self
,
index
):
return
self
.
value
[
index
]
return
self
.
value
[
index
]
def
__iter__
(
self
):
def
__iter__
(
self
):
return
self
.
value
.
__iter__
()
return
self
.
value
.
__iter__
()
def
__add__
(
self
,
b
):
def
__add__
(
self
,
b
):
if
isinstance
(
b
,
StringTypes
):
if
isinstance
(
b
,
str
):
return
ByteSequence
(
self
.
value
+
b
)
return
ByteSequence
(
self
.
value
+
b
)
elif
isinstance
(
b
,
ByteSequence
):
elif
isinstance
(
b
,
ByteSequence
):
return
ByteSequence
(
self
.
value
+
b
.
value
)
return
ByteSequence
(
self
.
value
+
b
.
value
)
...
@@ -322,5 +335,5 @@ def _uno_struct__str__(self):
...
@@ -322,5 +335,5 @@ def _uno_struct__str__(self):
def
_uno_struct__eq__
(
self
,
cmp
):
def
_uno_struct__eq__
(
self
,
cmp
):
if
hasattr
(
cmp
,
"value"
):
if
hasattr
(
cmp
,
"value"
):
return
self
.
__dict__
[
"value"
]
==
cmp
.
__dict__
[
"value"
]
return
self
.
__dict__
[
"value"
]
==
cmp
.
__dict__
[
"value"
]
return
0
return
False
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment