FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AnotherGraphicsLibrary/ZXGraphicsGen.py at master · errorcalc/AnotherGraphicsLibrary · GitHub
errorcalc
/
AnotherGraphicsLibrary
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
6
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
AnotherGraphicsLibrary
/
ZXGraphicsGen.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (39 loc) · 1.44 KB
Breadcrumbs
AnotherGraphicsLibrary
/
ZXGraphicsGen.py
Copy path
File metadata and controls
46 lines (39 loc) · 1.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#FIXME add Exceptions and etc...
# sorry, your eyes can take damage while reading this script
import
re
src
=
open
(
'zxGraphics.c'
,
'r'
)
dst
=
open
(
'zxGraphicsBitBlit.h'
,
'w'
)
def
gen
():
dst
.
write
(
'/* WARING: DO NOT EDIT THIS CODE, THIS CODE IS AUTO GENERATED,
\n
'
)
dst
.
write
(
' SEE '
'zxGraphicsGen.py'
'
\n
\n
'
)
dst
.
write
(
' Copyright © 2018 errorsoft. All rights reserved. */
\n
\n
'
)
state
=
'search'
for
s
in
src
:
if
state
==
'search'
:
se
=
re
.
search
(
r'BEGIN \$.*\$'
,
s
)
if
se
!=
None
:
name
=
re
.
search
(
r'\$.*\$'
,
s
).
group
(
0
)[
1
:
-
1
]
endName
=
re
.
search
(
r'\w*'
,
name
).
group
(
0
)
endName
=
re
.
escape
(
'$'
+
endName
+
'$'
)
print
(
'add macro: '
+
name
)
state
=
'search{'
elif
state
==
'search{'
:
if
re
.
search
(
r'{'
,
s
)
!=
None
:
dst
.
write
(
'#define '
+
name
+
'
\\
\n
'
)
dst
.
write
(
'do {'
)
state
=
'copy'
elif
state
==
'copy'
:
if
re
.
search
(
r'END '
+
endName
,
s
)
==
None
:
dst
.
write
(
'
\\
\n
'
)
se
=
re
.
search
(
r'\$.*\$'
,
s
)
if
se
!=
None
:
dst
.
write
(
' '
*
re
.
search
(
r'\S'
,
s
).
start
()
+
se
.
group
(
0
)[
1
:
-
1
]
+
';'
)
else
:
dst
.
write
(
s
.
rstrip
())
else
:
dst
.
write
(
' while(0)
\n
\n
'
)
state
=
'search'
gen
()
print
(
'ok'
)
src
.
close
()
dst
.
close
()
Back
|
FazBrowse Home
|
New Git URL