Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
secrules
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
tools
secrules
Commits
e9815457b283
Commit
e9815457b283
authored
5 years ago
by
Jean-Francois Pieronne
Browse files
Options
Downloads
Patches
Plain Diff
secrules/IdToAsc.py initial version
parent
b8e74c2d27c2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
secrules/IdToAsc.py
+43
-0
43 additions, 0 deletions
secrules/IdToAsc.py
with
43 additions
and
0 deletions
secrules/IdToAsc.py
0 → 100644
+
43
−
0
View file @
e9815457
from
vms
import
starlet
,
ssdef
class
IdToAsc
(
object
):
def
__init__
(
self
):
self
.
contxt
=
0
self
.
iid
=
None
def
__enter__
(
self
):
self
.
contxt
=
0
self
.
iid
=
0xFFFFFFFF
# do a wildcard lookup
return
self
def
__exit__
(
self
,
exc_type
,
exc_value
,
traceback
):
starlet
.
finish_rdb
(
self
.
contxt
)
def
__iter__
(
self
):
return
self
def
__next__
(
self
):
try
:
s
,
idname
,
rid
,
attrib
,
self
.
contxt
=
\
starlet
.
idtoasc
(
self
.
iid
,
self
.
contxt
)
return
self
.
uictoasc
(
rid
)
if
(
rid
<
0x80000000
L
)
else
"
%s
"
%
idname
except
VMSError
,
e
:
raise
StopIteration
if
e
.
errno
==
ssdef
.
SS__NOSUCHID
else
e
def
next
(
self
):
return
self
.
__next__
()
def
uictoasc
(
self
,
uic_value
):
high_word
=
int
(
uic_value
/
65536
)
low_word
=
int
(
uic_value
-
(
high_word
*
65536
))
# Note: [1:], because octal values will be preceeded by '0'
high_word
=
'
0
'
if
high_word
==
0
else
oct
(
high_word
)[
1
:]
low_word
=
'
0
'
if
low_word
==
0
else
oct
(
low_word
)[
1
:]
return
'
[
'
+
high_word
+
'
,
'
+
low_word
+
'
]
'
if
__name__
==
'
__main__
'
:
with
IdToAsc
()
as
iid
:
for
idnam
in
iid
:
print
idnam
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