File: helper.py

package info (click to toggle)
htic 3.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 252 kB
  • sloc: python: 1,662; makefile: 3
file content (18 lines) | stat: -rwxr-xr-x 378 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import io
import htic


def getData(code):
	parser = htic.parser.Parser()
	stream = io.StringIO(code)
	return parser.parse(stream)


def toBytes(instructions, precode="", name="A"):
	data = getData(precode + name + "{" + instructions + "\n}")
	if name == "prep":
		return bytes(data.prep)
	elif name == "fpgm":
		return bytes(data.fpgm)
	else:
		return bytes(data.glyphs[name])