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

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 
0015 _buffer = 'new Buffer()'
0016 
0017 Module().members(
0018     Class('Buffer', ('size', _int)).members(
0019         F(_bool, 'isEncoding', ('encoding', _string)),
0020         F(_void, 'write', ('string', _string), ('offset', _int), ('length', _int), ('encoding', _string)),
0021         F(_string, 'toJSON'),
0022         F(_bool, 'isBuffer', ('obj', _buffer)),
0023         F(_int, 'byteLength', ('string', _string), ('encoding', _string)),
0024         F(_void, 'concat', ('list', _array), ('totalLength', _int)),
0025         Var(_int, 'length'),
0026         F(_void, 'copy', ('target', _buffer), ('targetStart', _int), ('sourceStart', _int), ('sourceEnd', _int)),
0027         F(_void, 'slice', ('start', _int), ('end', _int)),
0028         F(_int, 'readUInt8', ('offset', _int), ('noAssert', _bool)),
0029         F(_int, 'readUInt16LE', ('offset', _int), ('noAssert', _bool)),
0030         F(_int, 'readUInt16BE', ('offset', _int), ('noAssert', _bool)),
0031         F(_int, 'readUInt32LE', ('offset', _int), ('noAssert', _bool)),
0032         F(_int, 'readUInt32BE', ('offset', _int), ('noAssert', _bool)),
0033         F(_int, 'readInt8', ('offset', _int), ('noAssert', _bool)),
0034         F(_int, 'readInt16LE', ('offset', _int), ('noAssert', _bool)),
0035         F(_int, 'readInt16BE', ('offset', _int), ('noAssert', _bool)),
0036         F(_int, 'readInt32LE', ('offset', _int), ('noAssert', _bool)),
0037         F(_int, 'readInt32BE', ('offset', _int), ('noAssert', _bool)),
0038         F(_float, 'readFloatLE', ('offset', _int), ('noAssert', _bool)),
0039         F(_float, 'readFloatBE', ('offset', _int), ('noAssert', _bool)),
0040         F(_float, 'readDoubleLE', ('offset', _int), ('noAssert', _bool)),
0041         F(_float, 'readDoubleBE', ('offset', _int), ('noAssert', _bool)),
0042         F(_void, 'writeUInt8', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0043         F(_void, 'writeUInt16LE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0044         F(_void, 'writeUInt16BE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0045         F(_void, 'writeUInt32LE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0046         F(_void, 'writeUInt32BE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0047         F(_void, 'writeInt8', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0048         F(_void, 'writeInt16LE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0049         F(_void, 'writeInt16BE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0050         F(_void, 'writeInt32LE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0051         F(_void, 'writeInt32BE', ('value', _int), ('offset', _int), ('noAssert', _bool)),
0052         F(_void, 'writeFloatLE', ('value', _float), ('offset', _int), ('noAssert', _bool)),
0053         F(_void, 'writeFloatBE', ('value', _float), ('offset', _int), ('noAssert', _bool)),
0054         F(_void, 'writeDoubleLE', ('value', _float), ('offset', _int), ('noAssert', _bool)),
0055         F(_void, 'writeDoubleBE', ('value', _float), ('offset', _int), ('noAssert', _bool)),
0056         F(_void, 'fill', ('value', _mixed), ('offset', _int), ('end', _int)),
0057         Var(_int, 'INSPECT_MAX_BYTES')
0058     )
0059 ).print()