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('event')
0015 
0016 _object = 'new Object()'
0017 _function = 'function(){}'
0018 
0019 Module().members(
0020     Class('Readable').prototype('event.EventEmitter').members(
0021         F(_string, 'read', ('size', _int)),
0022         F(_void, 'setEncoding', ('encoding', _string)),
0023         F(_void, 'resume'),
0024         F(_void, 'pause'),
0025         F(_void, 'pipe', ('destination', 'new Writable()'), ('options', _object)),
0026         F(_void, 'unpipe', ('destination', 'new Writable()')),
0027         F(_void, 'unshift', ('chunk', _string)),
0028         F('new Readable()', 'wrap', ('stream', _mixed))
0029     ),
0030     Class('Writable').prototype('event.EventEmitter').members(
0031         F(_void, 'write', ('chunk', _string), ('encoding', _string), ('callback', _function)),
0032         F(_void, 'end', ('chunk', _string), ('encoding', _string), ('callback', _function))
0033     ),
0034     Class('Duplex').prototype('event.EventEmitter').members(
0035         F(_string, 'read', ('size', _int)),
0036         F(_void, 'setEncoding', ('encoding', _string)),
0037         F(_void, 'resume'),
0038         F(_void, 'pause'),
0039         F(_void, 'pipe', ('destination', 'new Writable()'), ('options', _object)),
0040         F(_void, 'unpipe', ('destination', 'new Writable()')),
0041         F(_void, 'unshift', ('chunk', _string)),
0042         F('new Readable()', 'wrap', ('stream', _mixed)),
0043         F(_void, 'write', ('chunk', _string), ('encoding', _string), ('callback', _function)),
0044         F(_void, 'end', ('chunk', _string), ('encoding', _string), ('callback', _function))
0045     ),
0046     Class('Transform').prototype('exports.Duplex')
0047 ).print()