started with py crypto, enhanced raw.py generation, better autoconf integration

This commit is contained in:
git@daemon.de
2014-12-22 16:22:52 +01:00
parent 28a0405d55
commit 45c5daae54
11 changed files with 496 additions and 150 deletions

View File

@@ -0,0 +1,27 @@
from pypcp.dll import *
class Stream(object):
def __init__(self, string=None, file=None):
if file:
fd = open(file, 'r')
self._stream = libpcp.ps_new_file(fd)
elif string:
buf = libpcp.buffer_new_buf('inbuf', string, len(string))
self._stream = libpcp.ps_new_inbuffer(buf)
else:
self._stream = libpcp.ps_new_outbuffer()
def __del__(self):
libpcp.ps_close(self._stream)
class Buffer(object):
def __init__(self, string=None):
if string:
self._buffer = libpcp.buffer_new_buf('pybuf', string, len(string))
else:
self._buffer = libpcp.buffer_new(32, 'pybuf')
def __del__(self):
libpcp.buffer_free(self._buffer)