Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vmspython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
vmspython
Commits
e759e9202ec7
Commit
e759e9202ec7
authored
2 years ago
by
jfp
Browse files
Options
Downloads
Patches
Plain Diff
Allow ile3 retlen to be short or long.
parent
a0da7ea8aa30
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/local/ovms_module/ovms/iledef/__init__.py
+60
-24
60 additions, 24 deletions
python/local/ovms_module/ovms/iledef/__init__.py
python/local/ovms_module/tests/test_starlet.py
+7
-10
7 additions, 10 deletions
python/local/ovms_module/tests/test_starlet.py
with
67 additions
and
34 deletions
python/local/ovms_module/ovms/iledef/__init__.py
+
60
−
24
View file @
e759e920
'
vms Extension Series for Python
'
"""
vms Extension Series for Python
"""
__version__
=
'
0.3
'
"""
vms Extension Series for Python
...
...
@@ -67,6 +67,23 @@
# Length of ILEA
ILEA_64_C_LENGTH
=
24
from
ctypes
import
Structure
,
c_ushort
,
c_uint32
,
c_void_p
,
c_char
,
POINTER
,
cast
,
sizeof
,
pointer
from
ctypes
import
(
Structure
,
Union
,
c_ushort
,
c_ulong
,
c_uint32
,
c_void_p
,
c_char
,
POINTER
,
cast
,
sizeof
,
pointer
,
)
class
RETLEN
(
Union
):
_fields_
=
[(
'
ushort
'
,
POINTER
(
c_ushort
)),
(
'
ulong
'
,
POINTER
(
c_ulong
))]
class
ILE3
(
Structure
):
...
...
@@ -71,9 +88,10 @@
class
ILE3
(
Structure
):
_fields_
=
[(
"
ile3_w_length
"
,
c_ushort
),
# Length of buffer in bytes
(
"
ile3_w_code
"
,
c_ushort
),
# Item code value
(
"
ile3_ps_bufaddr
"
,
c_void_p
),
# Buffer address
(
"
ile3_ps_retlen_addr
"
,
POINTER
(
c_uint32
))
# Address of word or longword
_fields_
=
[
(
'
ile3_w_length
'
,
c_ushort
),
# Length of buffer in bytes
(
'
ile3_w_code
'
,
c_ushort
),
# Item code value
(
'
ile3_ps_bufaddr
'
,
c_void_p
),
# Buffer address
(
'
ile3_ps_retlen_addr
'
,
RETLEN
)
# Address of word or longword
# for returned length
]
...
...
@@ -77,4 +95,5 @@
# for returned length
]
class
ILE2
(
Structure
):
...
...
@@ -80,6 +99,7 @@
class
ILE2
(
Structure
):
_fields_
=
[(
"
ile2_w_length
"
,
c_ushort
),
# Length of buffer in bytes
(
"
ile2_w_code
"
,
c_ushort
),
# Item code value
(
"
ile2_ps_bufaddr
"
,
c_void_p
)
# Buffer address
_fields_
=
[
(
'
ile2_w_length
'
,
c_ushort
),
# Length of buffer in bytes
(
'
ile2_w_code
'
,
c_ushort
),
# Item code value
(
'
ile2_ps_bufaddr
'
,
c_void_p
),
# Buffer address
]
...
...
@@ -84,3 +104,4 @@
]
def
set_ile3_item
(
item
,
length
=
None
,
code
=
0
,
buffer
=
None
,
retlen
=
None
):
...
...
@@ -86,6 +107,9 @@
def
set_ile3_item
(
item
,
length
=
None
,
code
=
0
,
buffer
=
None
,
retlen
=
None
):
if
(
length
is
None
and
buffer
is
not
None
and
isinstance
(
buffer
,
c_char
*
sizeof
(
buffer
))):
if
(
length
is
None
and
buffer
is
not
None
and
isinstance
(
buffer
,
c_char
*
sizeof
(
buffer
))
):
length
=
sizeof
(
buffer
)
-
1
if
length
is
None
:
length
=
0
...
...
@@ -95,6 +119,14 @@
buffer
=
cast
(
buffer
,
c_void_p
)
item
.
ile3_ps_bufaddr
=
buffer
if
retlen
is
not
None
:
retlen
=
pointer
(
retlen
)
oretlen
=
retlen
if
isinstance
(
retlen
,
c_ushort
):
retlen
=
RETLEN
()
retlen
.
ushort
=
pointer
(
oretlen
)
elif
isinstance
(
retlen
,
c_ulong
):
retlen
=
RETLEN
()
retlen
.
ulong
=
pointer
(
oretlen
)
else
:
raise
ValueError
(
'
retlen should be None or c_ushort or c_ulong
'
)
item
.
ile3_ps_retlen_addr
=
retlen
...
...
@@ -99,3 +131,4 @@
item
.
ile3_ps_retlen_addr
=
retlen
def
set_ile2_item
(
item
,
length
=
None
,
code
=
0
,
buffer
=
None
):
...
...
@@ -101,6 +134,9 @@
def
set_ile2_item
(
item
,
length
=
None
,
code
=
0
,
buffer
=
None
):
if
(
length
is
None
and
buffer
is
not
None
and
isinstance
(
buffer
,
c_char
*
sizeof
(
buffer
))):
if
(
length
is
None
and
buffer
is
not
None
and
isinstance
(
buffer
,
c_char
*
sizeof
(
buffer
))
):
length
=
sizeof
(
buffer
)
-
1
if
length
is
None
:
length
=
0
...
...
@@ -110,7 +146,8 @@
buffer
=
cast
(
buffer
,
c_void_p
)
item
.
ile2_ps_bufaddr
=
buffer
def
get_ile3_string_item
(
item
):
if
item
.
ile3_ps_retlen_addr
is
None
:
retlen
=
item
.
ile3_w_length
+
1
else
:
...
...
@@ -113,10 +150,10 @@
def
get_ile3_string_item
(
item
):
if
item
.
ile3_ps_retlen_addr
is
None
:
retlen
=
item
.
ile3_w_length
+
1
else
:
retlen
=
item
.
ile3_ps_retlen_addr
.
contents
.
value
return
cast
(
item
.
ile3_ps_bufaddr
,
POINTER
(
c_char
*
(
retlen
))).
contents
retlen
=
item
.
ile3_ps_retlen_addr
.
ushort
.
contents
.
value
return
cast
(
item
.
ile3_ps_bufaddr
,
POINTER
(
c_char
*
(
retlen
))).
contents
def
get_ile2_string_item
(
item
):
retlen
=
item
.
ile3_w_length
+
1
...
...
@@ -120,5 +157,4 @@
def
get_ile2_string_item
(
item
):
retlen
=
item
.
ile3_w_length
+
1
return
cast
(
item
.
ile3_ps_bufaddr
,
POINTER
(
c_char
*
(
retlen
))).
contents
return
cast
(
item
.
ile3_ps_bufaddr
,
POINTER
(
c_char
*
(
retlen
))).
contents
This diff is collapsed.
Click to expand it.
python/local/ovms_module/tests/test_starlet.py
+
7
−
10
View file @
e759e920
...
...
@@ -485,7 +485,6 @@
def
test_ile3_a
():
from
ctypes
import
(
c_ushort
,
c_uint32
,
create_string_buffer
,
CDLL
,
sizeof
,
...
...
@@ -495,7 +494,7 @@
c_int
,
byref
,
)
from
ovms.iledef
import
ILE3
,
set_ile3_item
,
get_ile3_string_item
from
ovms.iledef
import
ILE3
,
RETLEN
,
set_ile3_item
,
get_ile3_string_item
from
ovms.efndef
import
EFN_C_ENF
from
ovms.ssdef
import
SS__NOMORENODE
from
ovms.stsdef
import
vms_status_success
...
...
@@ -509,5 +508,5 @@
iosb
=
IOSB_r_get_64
()
verlen
=
c_u
int32
()
verlen
=
c_u
short
()
verbuf
=
create_string_buffer
(
16
+
1
)
...
...
@@ -513,3 +512,3 @@
verbuf
=
create_string_buffer
(
16
+
1
)
nodelen
=
c_u
int32
()
nodelen
=
c_u
short
()
nodebuf
=
create_string_buffer
(
12
+
1
)
...
...
@@ -515,5 +514,5 @@
nodebuf
=
create_string_buffer
(
12
+
1
)
devlen
=
c_u
int32
()
devlen
=
c_u
short
()
devbuf
=
create_string_buffer
(
255
+
1
)
it
=
(
ILE3
*
4
)()
...
...
@@ -521,8 +520,9 @@
it
[
0
].
ile3_w_length
=
sizeof
(
verbuf
)
-
1
it
[
0
].
ile3_w_code
=
SYI__VERSION
it
[
0
].
ile3_ps_bufaddr
=
cast
(
verbuf
,
c_void_p
)
it
[
0
].
ile3_ps_retlen_addr
=
pointer
(
verlen
)
it
[
0
].
ile3_ps_retlen_addr
=
RETLEN
()
it
[
0
].
ile3_ps_retlen_addr
.
ushort
=
pointer
(
verlen
)
set_ile3_item
(
it
[
1
],
sizeof
(
nodebuf
)
-
1
,
SYI__NODENAME
,
nodebuf
,
nodelen
)
set_ile3_item
(
it
[
2
],
None
,
SYI__BOOT_DEVICE
,
devbuf
,
devlen
)
...
...
@@ -525,10 +525,7 @@
set_ile3_item
(
it
[
1
],
sizeof
(
nodebuf
)
-
1
,
SYI__NODENAME
,
nodebuf
,
nodelen
)
set_ile3_item
(
it
[
2
],
None
,
SYI__BOOT_DEVICE
,
devbuf
,
devlen
)
# it[3].ile3_w_length = it[3].ile3_w_code = 0
# it[3].ile3_ps_bufaddr = None
# it[3].ile3_ps_retlen_addr = None
set_ile3_item
(
it
[
3
])
status
=
getsyiw
(
...
...
@@ -1003,7 +1000,7 @@
nodename
=
ctypes
.
create_string_buffer
(
32
+
1
)
pid
=
ctypes
.
c_uint32
()
retlen
=
ctypes
.
c_u
int32
()
retlen
=
ctypes
.
c_u
short
()
it
=
(
ILE3
*
3
)()
set_ile3_item
(
it
[
0
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment