aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/lsp/__init__.py
diff options
context:
space:
mode:
authortgingold <tgingold@users.noreply.github.com>2020-12-29 17:19:09 +0100
committerGitHub <noreply@github.com>2020-12-29 17:19:09 +0100
commit7ca54117b8f757396ba5ef04c83ff1228ca94384 (patch)
treecc5f7f4166cc0570bda5cf2047d3ef7abbc36e37 /pyGHDL/lsp/__init__.py
parent340fc792bba2ffdb4f930bc427a39ea3a1b659b2 (diff)
parent50adcf884c3cfa4e33ca45769295f163baa63a3e (diff)
downloadghdl-7ca54117b8f757396ba5ef04c83ff1228ca94384.tar.gz
ghdl-7ca54117b8f757396ba5ef04c83ff1228ca94384.tar.bz2
ghdl-7ca54117b8f757396ba5ef04c83ff1228ca94384.zip
Merge pull request #1556 from Paebbels/paebbels/pyGHDL
Cleanup and Restructuring of pyGHDL
Diffstat (limited to 'pyGHDL/lsp/__init__.py')
-rw-r--r--pyGHDL/lsp/__init__.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pyGHDL/lsp/__init__.py b/pyGHDL/lsp/__init__.py
new file mode 100644
index 000000000..ee748ba8a
--- /dev/null
+++ b/pyGHDL/lsp/__init__.py
@@ -0,0 +1,23 @@
+class LSPConnTrace(object):
+ """Wrapper class to save in and out packets"""
+
+ def __init__(self, basename, conn):
+ self.conn = conn
+ self.trace_in = open(basename + ".in", "w")
+ self.trace_out = open(basename + ".out", "w")
+
+ def readline(self):
+ res = self.conn.readline()
+ self.trace_in.write(res)
+ return res
+
+ def read(self, size):
+ res = self.conn.read(size)
+ self.trace_in.write(res)
+ self.trace_in.flush()
+ return res
+
+ def write(self, out):
+ self.conn.write(out)
+ self.trace_out.write(out)
+ self.trace_out.flush()