Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
1de2d5c4
Commit
1de2d5c4
authored
Apr 21, 2016
by
Etienne Baratte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add an atom-decoder script
parent
75aca263
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
scripts/atom.py
scripts/atom.py
+39
-0
No files found.
scripts/atom.py
0 → 100755
View file @
1de2d5c4
#!/usr/bin/env python
from
__future__
import
print_function
import
sys
# decodes 6bit characters to ASCII
DECODING_TABLE
=
' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
def
atom_read
(
x
):
result
=
''
read_chars
=
((
x
&
0xF000000000000000
)
>>
60
)
==
0xF
mask
=
0x0FC0000000000000
bitshift
=
54
while
bitshift
>=
0
:
if
read_chars
:
result
+=
DECODING_TABLE
[(
x
&
mask
)
>>
bitshift
]
elif
((
x
&
mask
)
>>
bitshift
)
==
0xF
:
read_chars
=
True
bitshift
-=
6
mask
=
mask
>>
6
return
result
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
!=
2
:
print
(
'*** Usage: atom.py <atom_val>'
)
sys
.
exit
(
-
1
)
try
:
s
=
sys
.
argv
[
1
]
if
s
.
startswith
(
'0x'
):
val
=
int
(
s
,
16
)
else
:
val
=
int
(
s
)
print
(
atom_read
(
val
))
except
ValueError
:
print
(
'Not a number:'
,
sys
.
argv
[
1
])
print
(
'*** Usage: atom.py <atom_val>'
)
sys
.
exit
(
-
2
)
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