File indexing completed on 2024-05-19 04:42:04

0001 #!/usr/bin/env python3
0002 # -*- coding: utf-8 -*-
0003 #
0004 # SPDX-FileCopyrightText: 2014 Denis Steckelmacher <steckdenis@yahoo.fr>
0005 #
0006 # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 
0008 from jsgenerator import *
0009 from common import *
0010 
0011 # Print the license of the generated file (the same as the one of this file)
0012 license()
0013 basicTypes(globals())
0014 require('stream')
0015 require('buffer')
0016 
0017 _object = 'new Object()'
0018 _function = 'function(){}'
0019 _options = ('options', _object)
0020 _buf = ('buf', 'new buffer.Buffer()')
0021 _callback = ('callback', _function)
0022 
0023 Module().members(
0024     F('new Gzip()', 'createGzip', _options),
0025     F('new Gunzip()', 'createGunzip', _options),
0026     F('new Deflate()', 'createDeflate', _options),
0027     F('new Inflate()', 'createInflate', _options),
0028     F('new DeflateRaw()', 'createDeflateRaw', _options),
0029     F('new InflateRaw()', 'createInflateRaw', _options),
0030     F('new Unzip()', 'createUnzip', _options),
0031     Class('Zlib').prototype('stream.Duplex').members(
0032         F(_void, 'flush', ('callback', _function)),
0033         F(_void, 'reset')
0034     ),
0035     Class('Gzip').prototype('exports.Zlib'),
0036     Class('Gunzip').prototype('exports.Zlib'),
0037     Class('Deflate').prototype('exports.Zlib'),
0038     Class('Inflate').prototype('exports.Zlib'),
0039     Class('DeflateRaw').prototype('exports.Zlib'),
0040     Class('InflateRaw').prototype('exports.Zlib'),
0041     Class('Unzip').prototype('exports.Zlib'),
0042     F(_void, 'deflate', _buf, _callback),
0043     F(_void, 'deflateRaw', _buf, _callback),
0044     F(_void, 'gzip', _buf, _callback),
0045     F(_void, 'gunzip', _buf, _callback),
0046     F(_void, 'inflate', _buf, _callback),
0047     F(_void, 'inflateRaw', _buf, _callback),
0048     F(_void, 'unzip', _buf, _callback)
0049 ).print()