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('event')
0016 
0017 _object = 'new Object()'
0018 _function = 'function(){}'
0019 _stream = 'new stream.Writable()'
0020 
0021 Module().members(
0022     F('new Interface()', 'createInterface', ('options', _object)),
0023     Class('Interface').prototype('event.EventEmitter').members(
0024         F(_void, 'setPrompt', ('prompt', _string), ('length', _int)),
0025         F(_void, 'prompt', ('preserveCursor', _bool)),
0026         F(_void, 'question', ('query', _string), ('callback', _function)),
0027         F(_void, 'pause'),
0028         F(_void, 'resume'),
0029         F(_void, 'close'),
0030         F(_void, 'write', ('data', _string), ('key', _object))
0031     ),
0032     F(_void, 'cursorTo', ('stream', _stream), ('x', _int), ('y', _int)),
0033     F(_void, 'moveCursor', ('stream', _stream), ('dx', _int), ('dy', _int)),
0034     F(_void, 'clearLine', ('stream', _stream), ('dir', _int)),
0035     F(_void, 'clearScreenDown', ('stream', _stream))
0036 ).print()