diff --git a/plugins/qmljs/3rdparty/qtcreator-libs/qmljs/parser/changeLicense.py b/plugins/qmljs/3rdparty/qtcreator-libs/qmljs/parser/changeLicense.py index b10ebbc938..18811c37c5 100755 --- a/plugins/qmljs/3rdparty/qtcreator-libs/qmljs/parser/changeLicense.py +++ b/plugins/qmljs/3rdparty/qtcreator-libs/qmljs/parser/changeLicense.py @@ -1,24 +1,24 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import os if not len(sys.argv) >= 3: print("Usage: %s license files..." % os.path.basename(sys.argv[0])) sys.exit() licenseFileName = sys.argv[1] licenseText = "" with open(licenseFileName, 'r') as f: licenseText = f.read() licenseText = licenseText[0:licenseText.find('*/')] files = sys.argv[2:] for fileName in files: with open(fileName, 'r') as f: text = f.read() oldEnd = text.find('*/') if oldEnd == -1: oldEnd = 0 text = licenseText + text[oldEnd:] with open(fileName, 'w') as f: f.write(text) diff --git a/plugins/qmljs/nodejsmodules/buffer.py b/plugins/qmljs/nodejsmodules/buffer.py index e9eebf670b..f1829ddddf 100755 --- a/plugins/qmljs/nodejsmodules/buffer.py +++ b/plugins/qmljs/nodejsmodules/buffer.py @@ -1,76 +1,76 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _buffer = 'new Buffer()' Module().members( Class('Buffer', ('size', _int)).members( F(_bool, 'isEncoding', ('encoding', _string)), F(_void, 'write', ('string', _string), ('offset', _int), ('length', _int), ('encoding', _string)), F(_string, 'toJSON'), F(_bool, 'isBuffer', ('obj', _buffer)), F(_int, 'byteLength', ('string', _string), ('encoding', _string)), F(_void, 'concat', ('list', _array), ('totalLength', _int)), Var(_int, 'length'), F(_void, 'copy', ('target', _buffer), ('targetStart', _int), ('sourceStart', _int), ('sourceEnd', _int)), F(_void, 'slice', ('start', _int), ('end', _int)), F(_int, 'readUInt8', ('offset', _int), ('noAssert', _bool)), F(_int, 'readUInt16LE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readUInt16BE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readUInt32LE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readUInt32BE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readInt8', ('offset', _int), ('noAssert', _bool)), F(_int, 'readInt16LE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readInt16BE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readInt32LE', ('offset', _int), ('noAssert', _bool)), F(_int, 'readInt32BE', ('offset', _int), ('noAssert', _bool)), F(_float, 'readFloatLE', ('offset', _int), ('noAssert', _bool)), F(_float, 'readFloatBE', ('offset', _int), ('noAssert', _bool)), F(_float, 'readDoubleLE', ('offset', _int), ('noAssert', _bool)), F(_float, 'readDoubleBE', ('offset', _int), ('noAssert', _bool)), F(_void, 'writeUInt8', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeUInt16LE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeUInt16BE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeUInt32LE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeUInt32BE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeInt8', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeInt16LE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeInt16BE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeInt32LE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeInt32BE', ('value', _int), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeFloatLE', ('value', _float), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeFloatBE', ('value', _float), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeDoubleLE', ('value', _float), ('offset', _int), ('noAssert', _bool)), F(_void, 'writeDoubleBE', ('value', _float), ('offset', _int), ('noAssert', _bool)), F(_void, 'fill', ('value', _mixed), ('offset', _int), ('end', _int)), Var(_int, 'INSPECT_MAX_BYTES') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/child_process.py b/plugins/qmljs/nodejsmodules/child_process.py index 9a58bc6408..115a0af08a 100755 --- a/plugins/qmljs/nodejsmodules/child_process.py +++ b/plugins/qmljs/nodejsmodules/child_process.py @@ -1,52 +1,52 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') _object = 'new Object()' _childprocess = 'new ChildProcess()' _stream = 'new stream.Stream()' Module().members( Class('ChildProcess').prototype('event.EventEmitter').members( Var(_stream, 'stdin'), Var(_stream, 'stdout'), Var(_stream, 'stderr'), Var(_int, 'pid'), Var(_bool, 'connected'), F(_void, 'kill', ('signal', _string)), F(_void, 'send', ('message', _object), ('sendHandle', _object)), F(_void, 'disconnect'), ), F(_childprocess, 'spawn', ('command', _string), ('args', _array), ('options', _object)), F(_childprocess, 'exec', ('command', _string), ('args', _array), ('callback', 'function(){}')), F(_childprocess, 'execFile', ('file', _string), ('args', _array), ('options', _object), ('callback', 'function(){}')), F(_childprocess, 'fork', ('modulePath', _string), ('args', _array), ('options', _object)) ).print() diff --git a/plugins/qmljs/nodejsmodules/common.py b/plugins/qmljs/nodejsmodules/common.py index 3e2ef6c5da..758f87cdd1 100644 --- a/plugins/qmljs/nodejsmodules/common.py +++ b/plugins/qmljs/nodejsmodules/common.py @@ -1,58 +1,58 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Print the license of the generated file (the same as the one of this file) def license(): print("""\ /* * This file is part of qmljs, the QML/JS language support plugin for KDevelop * Copyright (c) 2014 Denis Steckelmacher * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ """) def basicTypes(d): d["_mixed"] = '_mixed' # This variable does not exist and will therefore yield the type "mixed" d["_string"] = '""' d["_bool"] = 'true' d["_int"] = '1' d["_float"] = '1.0' d["_array"] = '[]' d["_void"] = '' def require(module): print('var %s = require("%s");\n' % (module, module)) diff --git a/plugins/qmljs/nodejsmodules/console.py b/plugins/qmljs/nodejsmodules/console.py index 92b5e94938..eb684d3e81 100755 --- a/plugins/qmljs/nodejsmodules/console.py +++ b/plugins/qmljs/nodejsmodules/console.py @@ -1,44 +1,44 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _object = 'new Object()' Module().members( F(_void, 'log', ('data', _mixed)), F(_void, 'info', ('data', _mixed)), F(_void, 'error', ('data', _mixed)), F(_void, 'warn', ('data', _mixed)), F(_void, 'dir', ('obj', _object)), F(_void, 'time', ('label', _string)), F(_void, 'timeEnd', ('label', _string)), F(_void, 'trace', ('label', _string)), F(_void, 'assert', ('expression', _bool), ('message', _string)) ).print() diff --git a/plugins/qmljs/nodejsmodules/crypto.py b/plugins/qmljs/nodejsmodules/crypto.py index 0bf4401f7a..da49bed011 100755 --- a/plugins/qmljs/nodejsmodules/crypto.py +++ b/plugins/qmljs/nodejsmodules/crypto.py @@ -1,90 +1,90 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('buffer') _object = 'new Object()' Module().members( F(_array, 'getCiphers'), F(_array, 'getHashes'), F(_object, 'createCredentials', ('details', _object)), F('new Hash()', 'createHash', ('algorithm', _string)), Class('Hash').members( F(_void, 'update', ('data', _string), ('input_encoding', _string)), F(_string, 'digest', ('encoding', _string)) ), F('new Hmac()', 'createHmac', ('algorithm', _string), ('key', _string)), Class('Hmac').members( F(_void, 'update', ('data', _string)), F(_string, 'digest', ('encoding', _string)) ), F('new Cipher()', 'createCipher', ('algorithm', _string), ('password', _string)), F('new Cipher()', 'createCipheriv', ('algorithm', _string), ('password', _string), ('iv', _string)), Class('Cipher').members( F(_void, 'update', ('data', _string), ('input_encoding', _string), ('output_encoding', _string)), F(_string, 'final', ('output_encoding', _string)), F(_void, 'setAutoPadding', ('auto_padding', _bool)) ), F('new Decipher()', 'createDecipher', ('algorithm', _string), ('password', _string)), F('new Decipher()', 'createDecipheriv', ('algorithm', _string), ('password', _string), ('iv', _string)), Class('Decipher').members( F(_void, 'update', ('data', _string), ('input_encoding', _string), ('output_encoding', _string)), F(_string, 'final', ('output_encoding', _string)), F(_void, 'setAutoPadding', ('auto_padding', _bool)) ), F('new Sign()', 'createSign', ('algorithm', _string)), Class('Sign').members( F(_void, 'update', ('data', _string)), F(_string, 'sign', ('private_key', _string), ('output_format', _string)) ), F('new Verify()', 'createVerify', ('algorithm', _string)), Class('Verify').members( F(_void, 'update', ('data', _string)), F(_bool, 'verify', ('object', _string), ('signature', _string), ('signature_format', _string)) ), F('new DiffieHellman()', 'createDiffieHellman', ('prime_length', _int)), Class('DiffieHellman').members( F(_string, 'generateKeys', ('encoding', _string)), F(_string, 'computeSecret', ('other_public_key', _string), ('input_encoding', _string), ('output_encoding', _string)), F(_string, 'getPrime', ('encoding', _string)), F(_string, 'getGenerator', ('encoding', _string)), F(_string, 'getPublicKey', ('encoding', _string)), F(_string, 'getPrivateKey', ('encoding', _string)), F(_void, 'setPublicKey', ('public_key', _string), ('encoding', _string)), F(_void, 'setPrivateKey', ('private_key', _string), ('encoding', _string)), ), F('new DiffieHellman()', 'getDiffieHellman', ('group_name', _string)), F(_void, 'pbkdf2', ('password', _string), ('salt', _string), ('iterations', _int), ('keylen', _int), ('callback', 'function(){}')), F(_string, 'pbkdf2Sync', ('password', _string), ('salt', _string), ('iterations', _int), ('keylen', _int)), F('new buffer.Buffer()', 'randomBytes', ('size', _int), ('callback', 'function(){}')), F('new buffer.Buffer()', 'pseudoRandomBytes', ('size', _int), ('callback', 'function(){}')), Var(_string, 'DEFAULT_ENCODING') ).print() diff --git a/plugins/qmljs/nodejsmodules/dgram.py b/plugins/qmljs/nodejsmodules/dgram.py index c18a2f3bdc..85e9e20797 100755 --- a/plugins/qmljs/nodejsmodules/dgram.py +++ b/plugins/qmljs/nodejsmodules/dgram.py @@ -1,55 +1,55 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') require('buffer') _object = 'new Object()' _function = 'function(){}' _buffer = 'new buffer.Buffer()' _address = '{address: "", family: "", port: 1}' Module().members( F('new Socket', 'createSocket', ('type', _string), ('callback', _function)), Class('Socket').prototype('event.EventEmitter').members( F(_void, 'send', ('buf', _buffer), ('offset', _int), ('length', _int), ('port', _int), ('address', _string), ('callback', _function)), F(_void, 'bind', ('port', _int), ('address', _string), ('callback', _function)), F(_void, 'close'), F(_address, 'address'), F(_void, 'setBroadcast', ('flag', _bool)), F(_void, 'setTTL', ('ttl', _int)), F(_void, 'setMulticastTTL', ('ttl', _int)), F(_void, 'setMulticastLoopback', ('flag', _bool)), F(_void, 'addMembership', ('multicastAddress', _string), ('multicastInterface', _string)), F(_void, 'dropMembership', ('multicastAddress', _string), ('multicastInterface', _string)), F(_void, 'unref'), F(_void, 'ref') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/dns.py b/plugins/qmljs/nodejsmodules/dns.py index 791cc6d765..77136b2e58 100755 --- a/plugins/qmljs/nodejsmodules/dns.py +++ b/plugins/qmljs/nodejsmodules/dns.py @@ -1,69 +1,69 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _function = 'function(){}' Module().members( F(_void, 'lookup', ('domain', _string), ('family', _int), ('callback', _function)), F(_void, 'resolve', ('domain', _string), ('rrtype', _string), ('callback', _function)), F(_void, 'resolve4', ('domain', _string), ('callback', _function)), F(_void, 'resolve6', ('domain', _string), ('callback', _function)), F(_void, 'resolveMx', ('domain', _string), ('callback', _function)), F(_void, 'resolveTxt', ('domain', _string), ('callback', _function)), F(_void, 'resolveSrv', ('domain', _string), ('callback', _function)), F(_void, 'resolveNs', ('domain', _string), ('callback', _function)), F(_void, 'resolveCname', ('domain', _string), ('callback', _function)), F(_void, 'reverse', ('ip', _string), ('callback', _function)), Var(_int, 'NODATA'), Var(_int, 'FORMERR'), Var(_int, 'SERVFAIL'), Var(_int, 'NOTFOUND'), Var(_int, 'NOTIMP'), Var(_int, 'REFUSED'), Var(_int, 'BADQUERY'), Var(_int, 'BADNAME'), Var(_int, 'BADFAMILY'), Var(_int, 'BADRESP'), Var(_int, 'CONNREFUSED'), Var(_int, 'TIMEOUT'), Var(_int, 'EOF'), Var(_int, 'FILE'), Var(_int, 'NOMEM'), Var(_int, 'DESTRUCTION'), Var(_int, 'BADSTR'), Var(_int, 'BADFLAGS'), Var(_int, 'NONAME'), Var(_int, 'BADHINTS'), Var(_int, 'NOTINITIALIZED'), Var(_int, 'LOADIPHLPAPI'), Var(_int, 'ADDRGETNETWORKPARAMS'), Var(_int, 'CANCELLED') ).print() diff --git a/plugins/qmljs/nodejsmodules/domain.py b/plugins/qmljs/nodejsmodules/domain.py index c2944dadbc..11b3f396fb 100755 --- a/plugins/qmljs/nodejsmodules/domain.py +++ b/plugins/qmljs/nodejsmodules/domain.py @@ -1,49 +1,49 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') _function = 'function(){}' _object = 'new Object()' Module().members( F('new Domain()', 'create'), Class('Domain').prototype('event.EventEmitter').members( F(_void, 'run', ('fn', _function)), Var(_array, 'members'), F(_void, 'add', ('emitter', _object)), F(_void, 'remove', ('emitter', _object)), F(_function, 'bind', ('callback', _function)), F(_function, 'intercept', ('callback', _function)), F(_void, 'enter'), F(_void, 'exit'), F(_void, 'dispose') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/ecmascript.py b/plugins/qmljs/nodejsmodules/ecmascript.py index b7827ebeb8..8bf0d3d363 100755 --- a/plugins/qmljs/nodejsmodules/ecmascript.py +++ b/plugins/qmljs/nodejsmodules/ecmascript.py @@ -1,424 +1,424 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * # Print the license of the generated file (the same as the one of this file) print(""" /* * This file is part of qmljs, the QML/JS language support plugin for KDevelop * Copyright (c) 2014 Denis Steckelmacher * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ """) _mixed = '_mixed' # This variable does not exist and will therefore yield the type "mixed" _string = '""' _bool = 'true' _int = '1' _float = '1.0' _array = '[]' _void = '' # Fundamental objects (section 19) _object = 'new Object()' _function = 'function(){}' _date = 'new Date()' _regexp = 'new RegExp()' _regexp_match = '{index: 1, input: "", length: 1}' _map = 'new Map()' _set = 'new Set()' _arraybuffer = 'new ArrayBuffer()' _dataview = 'new DataView()' _iterator = '{next: function() {}, done: true, value: _mixed}' _promise = 'new Promise()' Module().members( Class('Object').members( F(_object, 'assign', ('target', _object), ('sources', _mixed)), F(_object, 'create', ('O', _object), ('properties', _object)), F(_object, 'defineProperties', ('O', _object), ('properties', _object)), F(_object, 'defineProperty', ('O', _object), ('property', _string), ('attributes', _object)), F(_object, 'freeze', ('O', _object)), F(_object, 'getOwnPropertyDescriptor', ('O', _object), ('property', _string)), F(_array, 'getOwnPropertyNames', ('O', _object)), F(_array, 'getOwnPropertySymbols', ('O', _object)), F(_object, 'getPrototypeOf', ('O', _object)), F(_bool, 'is', ('a', _mixed), ('b', _mixed)), F(_bool, 'isExtensible', ('O', _object)), F(_bool, 'isFrozen', ('O', _object)), F(_bool, 'isSealed', ('O', _object)), F(_iterator, 'keys', ('O', _object)), F(_object, 'preventExtensions', ('O', _object)), F(_object, 'seal', ('O', _object)), F(_object, 'setPrototypeOf', ('O', _object), ('proto', _object)), Var(_function, 'constructor'), F(_object, 'hasOwnProperty', ('property', _string)), F(_bool, 'isPrototypeOf', ('object', _object)), F(_bool, 'propertyIsEnumerable', ('property', _string)), F(_string, 'toLocaleString'), F(_string, 'toString'), ), Class('Function').members( Var(_int, 'length'), F(_mixed, 'apply', ('thisArg', _object), ('arguments', _array)), F(_function, 'bind', ('thisArg', _object), ('arguments', _mixed)), F(_mixed, 'call', ('thisArg', _object), ('arguments', _mixed)), F(_function, 'toMethod', ('newHome', _object), ('methodName', _string)), Var(_string, 'name') ), Class('Boolean', ('value', _bool)).members( F(_bool, 'valueOf'), ), # 19.4 (Symbol) skipped for now because it is far too internal Class('Error', ('message', _string)).members( Var(_string, 'message'), Var(_string, 'name'), ), Class('EvalError').prototype('Error'), Class('RangeError').prototype('Error'), Class('ReferenceError').prototype('Error'), Class('SyntaxError').prototype('Error'), Class('TypeError').prototype('Error'), Class('URIError').prototype('Error'), # 19.5.6 (NativeError) skipped because it seems too internal # Numbers and dates (section 20) Class('Number', ('value', _float)).members( Var(_float, 'EPSILON'), F(_bool, 'isFinite', ('number', _float)), F(_bool, 'isInteger', ('number', _int)), F(_bool, 'isNaN', ('number', _float)), F(_bool, 'isSafeInteger', ('number', _int)), Var(_int, 'MAX_SAFE_INTEGER'), Var(_float, 'MAX_VALUE'), Var(_float, 'NaN'), Var(_float, 'NEGATIVE_INFINITY'), Var(_int, 'MIN_SAFE_INTEGER'), Var(_float, 'MIN_VALUE'), F(_float, 'parseFloat', ('string', _string)), F(_int, 'parseInt', ('string', _string), ('radix', _int)), Var(_float, 'POSITIVE_INFINITY'), F(_string, 'toExponential', ('fractionDigits', _int)), F(_string, 'toFixed', ('fractionDigits', _int)), F(_string, 'toPrecision', ('precision', _int)), F(_float, 'valueOf'), ), Struct('Math').members( Var(_float, 'E'), Var(_float, 'LN10'), Var(_float, 'LOG10E'), Var(_float, 'LN2'), Var(_float, 'PI'), Var(_float, 'SQRT1_2'), Var(_float, 'SQRT2'), F(_float, 'abs', ('x', _float)), F(_float, 'acos', ('x', _float)), F(_float, 'acosh', ('x', _float)), F(_float, 'asin', ('x', _float)), F(_float, 'asinh', ('x', _float)), F(_float, 'atan', ('x', _float)), F(_float, 'atanh', ('x', _float)), F(_float, 'atan2', ('x', _float), ('y', _float)), F(_float, 'cbrt', ('x', _float)), F(_int, 'ceil', ('x', _float)), F(_int, 'clz32', ('x', _int)), F(_float, 'cos', ('x', _float)), F(_float, 'cosh', ('x', _float)), F(_float, 'exp', ('x', _float)), F(_float, 'expm1', ('x', _float)), F(_int, 'floor', ('x', _float)), F(_int, 'fround', ('x', _float)), F(_float, 'hypot', ('a', _float), ('b', _float)), F(_int, 'imul', ('x', _int), ('y', _int)), F(_float, 'log', ('x', _float)), F(_float, 'log1p', ('x', _float)), F(_float, 'log10', ('x', _float)), F(_float, 'log2', ('x', _float)), F(_float, 'max', ('a', _float), ('b', _float)), F(_float, 'min', ('a', _float), ('b', _float)), F(_float, 'pow', ('x', _float), ('y', _float)), F(_float, 'random'), F(_int, 'round', ('x', _float)), F(_int, 'sign', ('x', _float)), F(_float, 'sin', ('x', _float)), F(_float, 'sinh', ('x', _float)), F(_float, 'sqrt', ('x', _float)), F(_float, 'tan', ('x', _float)), F(_float, 'tanh', ('x', _float)), F(_int, 'trunc', ('x', _float)), ), Class('Date', ('year', _int), ('month', _int), ('date', _int), ('hours', _int), ('minutes', _int), ('seconds', _int), ('ms', _int)).members( F(_date, 'now'), F(_date, 'parse', ('string', _string)), F(_date, 'UTC', ('year', _int), ('month', _int), ('date', _int), ('hours', _int), ('minutes', _int), ('seconds', _int), ('ms', _int)), F(_int, 'getDate'), F(_int, 'getDay'), F(_int, 'getFullYear'), F(_int, 'getHours'), F(_int, 'getMilliseconds'), F(_int, 'getMinutes'), F(_int, 'getMonth'), F(_int, 'getSeconds'), F(_int, 'getTime'), F(_int, 'getTimezoneOffset'), F(_int, 'getUTCDate'), F(_int, 'getUTCDay'), F(_int, 'getUTCFullYear'), F(_int, 'getUTCHours'), F(_int, 'getUTCMilliseconds'), F(_int, 'getUTCMinutes'), F(_int, 'getUTCMonth'), F(_int, 'getUTCSeconds'), F(_int, 'setDate', ('date', _int)), F(_int, 'setFullYear', ('year', _int), ('month', _int), ('date', _int)), F(_int, 'setHours', ('hours', _int), ('minutes', _int), ('seconds', _int), ('ms', _int)), F(_int, 'setMilliseconds', ('ms', _int)), F(_int, 'setMinutes', ('min', _int), ('sec', _int), ('ms', _int)), F(_int, 'setMonth', ('month', _int), ('date', _int)), F(_int, 'setSeconds', ('sec', _int), ('ms', _int)), F(_int, 'setTime', ('time', _int)), F(_int, 'setUTCDate', ('date', _int)), F(_int, 'setUTCFullYear', ('year', _int), ('month', _int), ('date', _int)), F(_int, 'setUTCHours', ('hours', _int), ('minutes', _int), ('seconds', _int), ('ms', _int)), F(_int, 'setUTCMilliseconds', ('ms', _int)), F(_int, 'setUTCMinutes', ('min', _int), ('sec', _int), ('ms', _int)), F(_int, 'setUTCMonth', ('month', _int), ('date', _int)), F(_int, 'setUTCSeconds', ('sec', _int), ('ms', _int)), F(_string, 'toDateString'), F(_string, 'toISOString'), F(_string, 'toJSON', ('key', _string)), F(_string, 'toLocaleDateString'), F(_string, 'toLocaleTimeString'), F(_string, 'toTimeString'), F(_string, 'toUTCString'), F(_int, 'valueOf'), ), # Text Processing (section 21) Class('String', ('value', _mixed)).members( F(_string, 'fromCharCode', ('code', _int)), F(_string, 'fromCodePoint', ('code', _int)), F(_string, 'raw', ('callSize', _mixed)), F(_string, 'charAt', ('pos', _int)), F(_int, 'charCodeAt', ('pos', _int)), F(_int, 'codePointAt', ('pos', _int)), F(_string, 'concat', ('other', _string)), F(_bool, 'contains', ('searchString', _string), ('position', _int)), F(_bool, 'endsWith', ('searchString', _string), ('endPosition', _int)), F(_int, 'indexOf', ('searchString', _string), ('position', _int)), F(_int, 'lastIndexOf', ('searchString', _string), ('position', _int)), F(_int, 'localeCompare', ('other', _string)), F(_regexp_match, 'match', ('regexp', _regexp)), F(_string, 'normalize', ('form', _string)), F(_string, 'repeat', ('count', _int)), F(_string, 'replace', ('searchValue', _string), ('replaceValue', _string)), F(_int, 'search', ('regexp', _regexp)), F(_string, 'slice', ('start', _int), ('end', _int)), F(_array, 'split', ('separator', _string), ('limit', _int)), F(_bool, 'startsWith', ('searchString', _string), ('position', _int)), F(_string, 'substring', ('start', _int), ('end', _int)), F(_string, 'toLocaleLowerCase'), F(_string, 'toLocaleUpperCase'), F(_string, 'toLowerCase'), F(_string, 'toUpperCase'), F(_string, 'trim'), F(_string, 'valueOf'), Var(_int, 'length'), ), Class('RegExp', ('pattern', _string), ('flags', _string)).members( F(_void, 'compile'), F(_array, 'exec', ('string', _string)), Var(_bool, 'ingoreCase'), F(_regexp_match, 'match', ('string', _string)), Var(_bool, 'multiline'), F(_string, 'replace', ('string', _string), ('replaceValue', _string)), F(_int, 'search', ('string', _string)), Var(_string, 'source'), F(_array, 'split', ('string', _string), ('limit', _int)), Var(_bool, 'sticky'), F(_bool, 'test', ('string', _string)), Var(_bool, 'unicode'), Var(_int, 'lastIndex'), Var(_string, 'lastMatch'), ), # Array Objects (section 22) Class('Array', ('len', _int)).members( F(_array, 'from', ('arrayLike', _mixed), ('mapfn', _function), ('thisArg', _object)), F(_bool, 'isArray', ('arg', _mixed)), F(_array, 'of', ('items', _mixed)), F(_array, 'concat', ('other', _array)), F(_array, 'copyWithin', ('target', _int), ('start', _int), ('end', _int)), F(_iterator, 'entries'), F(_bool, 'every', ('callbackfn', _function), ('thisArg', _object)), F(_array, 'fill', ('value', _mixed), ('start', _int), ('end', _int)), F(_array, 'filter', ('callbackfn', _function), ('thisArg', _object)), F(_mixed, 'find', ('predicate', _function), ('thisArg', _object)), F(_int, 'findIndex', ('predicate', _function), ('thisArg', _object)), F(_void, 'forEach', ('callbackfn', _function), ('thisArg', _object)), F(_int, 'indexOf', ('searchElement', _mixed), ('fromIndex', _int)), F(_string, 'join', ('separator', _string)), F(_int, 'lastIndexOf', ('searchElement', _mixed), ('fromIndex', _int)), F(_array, 'map', ('callbackfn', _function), ('thisArg', _object)), F(_mixed, 'pop'), F(_int, 'push', ('element', _mixed)), F(_mixed, 'reduce', ('callbackfn', _function), ('initialValue', _mixed)), F(_mixed, 'reduceRight', ('callbackfn', _function), ('initialValue', _mixed)), F(_array, 'reverse'), F(_mixed, 'shift'), F(_array, 'slice', ('start', _int), ('end', _int)), F(_bool, 'some', ('callbackfn', _function), ('thisArg', _object)), F(_array, 'sort', ('comparefn', _function)), F(_array, 'splice', ('start', _int), ('deleteCount', _int), ('items', _mixed)), F(_string, 'substr', ('start', _int), ('length', _int)), F(_int, 'unshift', ('items', _mixed)), F(_iterator, 'values'), Var(_int, 'length'), ), # Keyed Collection (section 23) Class('Map', ('iterable', _mixed)).members( F(_void, 'clear'), F(_bool, 'delete', ('key', _mixed)), F(_iterator, 'entries'), F(_void, 'forEach', ('callbackfn', _function), ('thisArg', _object)), F(_mixed, 'get', ('key', _mixed)), F(_bool, 'has', ('key', _mixed)), F(_map, 'set', ('key', _mixed), ('value', _mixed)), Var(_int, 'size'), F(_iterator, 'values'), ), Class('Set', ('iterable', _mixed)).members( F(_set, 'add', ('value', _mixed)), F(_void, 'clear'), F(_bool, 'delete', ('value', _mixed)), F(_iterator, 'entries'), F(_void, 'forEach', ('callbackfn', _function), ('thisArg', _object)), F(_bool, 'has', ('value', _mixed)), Var(_int, 'size'), F(_iterator, 'values'), ), Class('WeakMap', ('iterable', _mixed)).members( F(_void, 'clear'), F(_bool, 'delete', ('key', _mixed)), F(_mixed, 'get', ('key', _mixed)), F(_bool, 'has', ('key', _mixed)), F(_map, 'set', ('key', _mixed), ('value', _mixed)), ), Class('WeakSet', ('iterable', _mixed)).members( F(_set, 'add', ('value', _mixed)), F(_void, 'clear'), F(_bool, 'delete', ('value', _mixed)), F(_bool, 'has', ('value', _mixed)), ), # Structured Data (section 24) Class('ArrayBuffer', ('length', _int)).members( F(_bool, 'isView', ('arg', _mixed)), Var(_int, 'byteLength'), F(_arraybuffer, 'slice', ('start', _int), ('end', _int)), ), Class('DataView', ('buffer', _arraybuffer), ('byteOffset', _int), ('byteLength', _int)).members( Var(_dataview, 'buffer'), Var(_int, 'byteLength'), Var(_int, 'byteOffset'), F(_float, 'getFloat32', ('byteOffset', _int), ('littleEndian', _bool)), F(_float, 'getFloat64', ('byteOffset', _int), ('littleEndian', _bool)), F(_int, 'getInt8', ('byteOffset', _int)), F(_int, 'getInt16', ('byteOffset', _int), ('littleEndian', _bool)), F(_int, 'getInt32', ('byteOffset', _int), ('littleEndian', _bool)), F(_int, 'getUInt8', ('byteOffset', _int)), F(_int, 'getUInt16', ('byteOffset', _int), ('littleEndian', _bool)), F(_int, 'getUInt32', ('byteOffset', _int), ('littleEndian', _bool)), F(_void, 'setFloat32', ('byteOffset', _int), ('value', _float), ('littleEndian', _bool)), F(_void, 'setFloat64', ('byteOffset', _int), ('value', _float), ('littleEndian', _bool)), F(_void, 'setInt8', ('byteOffset', _int), ('value', _int)), F(_void, 'setInt16', ('byteOffset', _int), ('value', _int), ('littleEndian', _bool)), F(_void, 'setInt32', ('byteOffset', _int), ('value', _int), ('littleEndian', _bool)), F(_void, 'setUInt8', ('byteOffset', _int), ('value', _int)), F(_void, 'setUInt16', ('byteOffset', _int), ('value', _int), ('littleEndian', _bool)), F(_void, 'setUInt32', ('byteOffset', _int), ('value', _int), ('littleEndian', _bool)), ), Struct('JSON').members( F(_mixed, 'parse', ('text', _string), ('reviver', _function)), F(_string, 'stringify', ('value', _mixed), ('replacer', _function), ('space', _string)), ), # Control Abstraction Objects (section 25) Class('Promise', ('executor', _function)).members( F(_void, 'all', ('iterable', _array)), F(_void, 'race', ('iterable', _array)), F(_promise, 'resolve', ('x', _mixed)), F(_void, 'catch', ('onRejected', _function)), F(_void, 'then', ('onFulfilled', _function), ('onRejected', _function)), ), Struct('Reflect').members( F(_mixed, 'apply', ('target', _function), ('thisArgument', _object), ('argumentList', _array)), F(_object, 'construct', ('target', _function), ('argumentList', _array)), F(_void, 'deleteProperty', ('target', _object), ('propertyKey', _string)), F(_iterator, 'enumerate', ('target', _object)), F(_mixed, 'get', ('target', _object), ('propertyKey', _string), ('receiver', _object)), F(_bool, 'has', ('target', _object), ('propertyKey', _string)), F(_array, 'ownKeys', ('target', _object)), F(_void, 'set', ('target', _object), ('propertyKey', _string), ('value', _mixed), ('receiver', _object)), ), *[Class(a + 'Array', ('length', _int)).prototype('Array').members( Var(_mixed, 'buffer'), Var(_int, 'byteLength'), Var(_int, 'byteOffset'), F(_array, 'subarray', ('begin', _int), ('end', _int)), Var(_int, 'BYTES_PER_ELEMENT'), ) for a in ['Int8', 'Uint8', 'Uint8Clamped', 'Int16', 'Uint16', 'Int32', 'Uint32', 'Float32', 'Float64']] ).print() # Realm, Loader and Proxy not decribed for now diff --git a/plugins/qmljs/nodejsmodules/event.py b/plugins/qmljs/nodejsmodules/event.py index 871b907663..dca15fe1fd 100755 --- a/plugins/qmljs/nodejsmodules/event.py +++ b/plugins/qmljs/nodejsmodules/event.py @@ -1,47 +1,47 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _function = 'function(){}' _object = 'new Object()' Module().members( Class('EventEmitter').members( F(_void, 'addListener', ('event', _string), ('listener', _function)), F(_void, 'on', ('event', _string), ('listener', _function)), F(_void, 'once', ('event', _string), ('listener', _function)), F(_void, 'removeListener', ('event', _string), ('listener', _function)), F(_void, 'removeAllListeners', ('event', _string)), F(_void, 'setMaxListeners', ('n', _int)), F(_array, 'listeners', ('event', _string)), F(_void, 'emit', ('event', _string), ('args', _mixed)), F(_int, 'listenerCount', ('emitter', 'new EventEmitter()'), ('event', _string)) ) ).print() diff --git a/plugins/qmljs/nodejsmodules/fs.py b/plugins/qmljs/nodejsmodules/fs.py index e7e6ca11de..b413f3df65 100755 --- a/plugins/qmljs/nodejsmodules/fs.py +++ b/plugins/qmljs/nodejsmodules/fs.py @@ -1,149 +1,149 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('stream') require('buffer') require('event') _function = 'function(){}' _object = 'new Object()' _date = 'new Date()' _buffer = 'new buffer.Buffer()' _stats = 'new Stats' _callback = ('callback', _function) _fd = ('fd', _int) _len = ('len', _int) _path = ('path', _string) _uid = ('uid', _int) _gid = ('gid', _int) _mode = ('mode', _int) _offset = ('offset', _int) _length = ('length', _int) _position = ('position', _int) _filename = ('filename', _string) _options = ('options', _object) _data = ('data', _string) Module().members( F(_void, 'rename', ('oldPath', _string), ('newPath', _string), _callback), F(_int, 'renameSync', ('oldPath', _string), ('newPath', _string)), F(_void, 'ftruncate', _fd, _len, _callback), F(_int, 'ftruncateSync', _fd, _len), F(_void, 'truncate', _path, _len, _callback), F(_int, 'truncateSync', _path, _len), F(_void, 'chown', _path, _uid, _gid, _callback), F(_int, 'chownSync', _path, _uid, _gid), F(_void, 'fchown', _fd, _uid, _gid, _callback), F(_int, 'fchownSync', _fd, _uid, _gid), F(_void, 'lchown', _path, _uid, _gid, _callback), F(_int, 'lchownSync', _path, _uid, _gid), F(_void, 'chmod', _path, _mode, _callback), F(_int, 'chmodSync', _path, _mode), F(_void, 'fchmod', _fd, _mode, _callback), F(_int, 'fchmodSync', _fd, _mode), F(_void, 'lchmod', _path, _mode, _callback), F(_int, 'lchmodSync', _path, _mode), F(_void, 'stat', _path, _callback), F(_void, 'lstat', _path, _callback), F(_void, 'fstat', _fd, _callback), F(_stats, 'statSync', _path), F(_stats, 'lstatSync', _path), F(_stats, 'fstatSync', _fd), F(_void, 'link', ('srcpath', _string), ('dstpath', _string), _callback), F(_int, 'linkSync', ('srcpath', _string), ('dstpath', _string)), F(_void, 'symlink', ('srcpath', _string), ('dstpath', _string), ('type', _string), _callback), F(_int, 'symlinkSync', ('srcpath', _string), ('dstpath', _string), ('type', _string)), F(_void, 'readlink', _path, _callback), F(_int, 'readlinkSync', _path), F(_void, 'realpath', _path, ('cache', _object), _callback), F(_string, 'realpathSync', _path, ('cache', _object)), F(_void, 'unlink', _path, _callback), F(_int, 'unlinkSync', _path), F(_void, 'rmdir', _path, _callback), F(_int, 'rmdirSync', _path), F(_void, 'mkdir', _path, _mode, _callback), F(_int, 'mkdirSync', _path, _mode), F(_void, 'readdir', _path, _callback), F(_array, 'readdirSync', _path), F(_void, 'close', _fd, _callback), F(_int, 'closeSync', _fd), F(_void, 'open', _path, ('flags', _string), _mode, _callback), F(_int, 'openSync', _path, ('flags', _string), _mode), F(_void, 'utimes', _path, ('atime', _date), ('mtime', _date), _callback), F(_int, 'utimesSync', _path, ('atime', _date), ('mtime', _date)), F(_void, 'futimes', _fd, ('atime', _date), ('mtime', _date), _callback), F(_int, 'futimesSync', _fd, ('atime', _date), ('mtime', _date)), F(_void, 'fsync', _fd, _callback), F(_int, 'fsyncSync', _fd), F(_void, 'write', _fd, _buffer, _offset, _length, _position, _callback), F(_int, 'writeSync', _fd, _buffer, _offset, _length, _position), F(_void, 'read', _fd, _buffer, _offset, _length, _position, _callback), F(_int, 'readSync', _fd, _buffer, _offset, _length, _position), F(_void, 'readFile', _filename, _options, _callback), F(_int, 'readFileSync', _filename, _options), F(_void, 'writeFile', _filename, _data, _options, _callback), F(_int, 'writeFileSync', _filename, _data, _options), F(_void, 'appendFile', _filename, _data, _options, _callback), F(_int, 'appendFileSync', _filename, _data, _options), F(_void, 'watchFile', _filename, _options, _callback), F(_void, 'unwatchFile', _filename, _callback), F('new FSWatcher()', 'watch', _filename, _options, _callback), F(_void, 'exists', _path, _callback), F(_bool, 'existsSync', _path), Class('Stats').members( F(_bool, 'isFile'), F(_bool, 'isDirectory'), F(_bool, 'isBlockDevice'), F(_bool, 'isCharacterDevice'), F(_bool, 'isSymbolicLink'), F(_bool, 'isFIFO'), F(_bool, 'isSocket'), Var(_int, 'dev'), Var(_int, 'ino'), Var(_int, 'mode'), Var(_int, 'nlink'), Var(_int, 'uid'), Var(_int, 'gid'), Var(_int, 'rdev'), Var(_int, 'size'), Var(_int, 'blksize'), Var(_int, 'blocks'), Var(_date, 'atime'), Var(_date, 'mtime'), Var(_date, 'ctime') ), F('new ReadStream()', 'createReadStream', _path, _options), Class('ReadStream').prototype('stream.Readable'), F('new WriteStream()', 'createWriteStream', _path, _options), Class('WriteStream').prototype('stream.Writable'), Class('FSWatcher').prototype('event.EventEmitter').members( F(_void, 'close') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/http.py b/plugins/qmljs/nodejsmodules/http.py index af25e1ce70..0bb7088b95 100755 --- a/plugins/qmljs/nodejsmodules/http.py +++ b/plugins/qmljs/nodejsmodules/http.py @@ -1,89 +1,89 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') require('net') _function = 'function(){}' _object = 'new Object()' _date = 'new Date()' Module().members( Var('{}', 'STATUS_CODES'), F('new Server()', 'createServer', ('requestListener', _function)), F('new Client()', 'createClient', ('port', _int), ('host', _string)), Class('Server').prototype('event.EventEmitter').members( F(_void, 'listen', ('port', _int), ('hostname', _string), ('backlog', _int), ('callback', _function)), F(_void, 'close', ('callback', _function)), Var(_int, 'maxHeadersCount'), F(_void, 'setTimeout', ('msecs', _int), ('callback', _function)), Var(_int, 'timeout'), ), Class('ServerResponse').prototype('event.EventEmitter').members( F(_void, 'writeContinue'), F(_void, 'writeHead', ('statusCode', _int), ('reasonPhrase', _string), ('headers', _object)), F(_void, 'setTimeout', ('msecs', _int), ('callback', _function)), Var(_int, 'statusCode'), F(_void, 'setHeader', ('name', _string), ('value', _string)), Var(_bool, 'headersSent'), Var(_bool, 'sendDate'), F(_string, 'getHeader', ('name', _string)), F(_void, 'removeHeader', ('name', _string)), F(_bool, 'write', ('chunk', _string), ('encoding', _string)), F(_void, 'addTrailers', ('headers', _object)), F(_void, 'end', ('data', _string), ('encoding', _string)) ), F('new ClientRequest()', 'request', ('options', _object), ('callback', _function)), F('new ClientRequest()', 'get', ('options', _object), ('callback', _function)), Class('Agent').members( Var(_int, 'maxSockets'), Var(_array, 'sockets'), Var(_array, 'requests') ), Var('new Agent()', 'globalAgent'), Class('ClientRequest').prototype('event.EventEmitter').members( F(_void, 'write', ('chunk', _string), ('encoding', _string)), F(_void, 'end', ('data', _string), ('encoding', _string)), F(_void, 'abort'), F(_void, 'setTimeout', ('msecs', _int), ('callback', _function)), F(_void, 'setNoDelay', ('noDelay', _bool)), F(_void, 'setSocketKeepAlive', ('enable', _bool), ('initialDelay', _int)), ), Class('IncomingMessage').prototype('event.EventEmitter').members( Var(_string, 'httpVersion'), Var(_object, 'headers'), Var(_object, 'trailers'), F(_void, 'setTimeout', ('msecs', _int), ('callback', _function)), Var(_string, 'method'), Var(_string, 'url'), Var(_int, 'statusCode'), Var('new net.Socket()', 'socket') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/https.py b/plugins/qmljs/nodejsmodules/https.py index 3c0b51e05f..1514b5336b 100755 --- a/plugins/qmljs/nodejsmodules/https.py +++ b/plugins/qmljs/nodejsmodules/https.py @@ -1,47 +1,47 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('tls') require('http') _function = 'function(){}' _object = 'new Object()' Module().members( F('new Server()', 'createServer', ('requestListener', _function)), Class('Server').prototype('tls.Server').members( F(_void, 'listen', ('port', _int), ('hostname', _string), ('backlog', _int), ('callback', _function)), F(_void, 'close', ('callback', _function)) ), F('new http.ClientRequest()', 'request', ('options', _object), ('callback', _function)), F('new http.ClientRequest()', 'get', ('options', _object), ('callback', _function)), Class('Agent').prototype('http.Agent'), Var('new Agent()', 'globalAgent') ).print() diff --git a/plugins/qmljs/nodejsmodules/idltojs.py b/plugins/qmljs/nodejsmodules/idltojs.py index bc7dca7f9e..8a2ef9ba1b 100755 --- a/plugins/qmljs/nodejsmodules/idltojs.py +++ b/plugins/qmljs/nodejsmodules/idltojs.py @@ -1,243 +1,243 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * def license(): # Print the license of the generated file (the same as the one of this file) print(""" /* * ==== FILE AUTOGENERATED FROM .idl FILES UNDER THE FOLLOWING LICENSE ==== * * Copyright (C) 2008 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ """) def get_type(decl): typename = ' '.join(decl[0:-1]) if typename == 'void': typename = '' elif typename == 'any': typename = '_mixed' elif typename == 'boolean' or typename == 'bool': typename = 'true' elif typename == 'DOMString': typename = "''" elif typename == 'DOMObject': typename = 'new Object()' elif typename == 'DOMTimeStamp': typename = 'new Date()' elif 'unsigned' in typename or ' short' in typename or ' int' in typename or ' long' in typename or typename in ['short', 'int', 'long']: typename = '1' elif typename == 'float' or typename == 'double': typename = '1.0' elif typename == 'Array': typename = '[]' elif 'Callback' in typename or 'Handler' in typename: typename = 'function(){}' elif 'Constructor' in typename: typename = typename.replace('Constructor', '') else: typename = 'new %s()' % typename return typename def get_name(decl): return decl[-1] member_decl = [] param_decl = [] params = [] skip_end_of_line = False in_module = False in_interface = False in_inherit = False in_param = False cl = None def parse(token): global member_decl, param_decl, params, skip_end_of_line, in_module, in_interface, in_inherit, in_param, cl if token in ['in', 'readonly', 'optional', 'attribute', 'getter', 'setter', '{', '}']: pass elif token == 'raises': skip_end_of_line = True elif token == 'module': in_module = True elif token == 'interface': in_module = False in_interface = True elif in_module: # Skip the module declaration pass elif in_interface: # Interface name cl = Class(token) in_interface = False if token == 'DOMWindow': # Export window, the only thing that should be exposed to the outside world print('module.exports = DOMWindow;') elif token == ';': # End the current declaration if len(member_decl) == 0: # When the end of a class is reached, an empty declaration is produced cl.print() return if in_param: # Declare a method cl.member(F(get_type(member_decl), get_name(member_decl), \ *[(get_name(p), get_type(p)) for p in params] )) else: # Declare a member variable if get_type(member_decl) is not None and get_name(member_decl)[0].isalpha(): cl.member(Var(get_type(member_decl), get_name(member_decl))) member_decl.clear() params.clear() skip_end_of_line = False in_param = False elif skip_end_of_line: # Skip everything until the colon pass elif token == ':': in_inherit = True elif in_inherit: cl.prototype(token) in_inherit = False elif token == '(': # Begin the parameter list in_param = True elif token == ')' or token == ',': # End of a parameter if len(param_decl) != 0: params.append(param_decl[:]) param_decl.clear() pass elif in_param: # Add a token to the parameter declaration param_decl.append(token) else: # Add a token to the member declaration member_decl.append(token) def tokenize(data): token = '' prev_c = '' c = '' next_c = '' in_comment = 'none' bracket_depth = 0 for i in range(len(data) + 1): prev_c = c c = next_c if i < len(data): next_c = data[i] # Handle single-line and multi-line comments if in_comment == 'singleline': if c == '\n': in_comment = 'none' continue if in_comment == 'multiline': if prev_c == '*' and c == '/': in_comment = 'none' continue if c == '/' and next_c == '*': in_comment = 'multiline' continue if c == '/' and next_c == '/': in_comment = 'singleline' continue if c == '#': # Skip preprocessor macros: consider them as comments in_comment = 'singleline' continue # Skip hints between brackets if c == '[': bracket_depth += 1 continue elif c == ']': bracket_depth -= 1 continue if bracket_depth > 0: continue # Spaces are used to separate tokens if not c.isalnum() or not token.isalnum(): if token != '': parse(token) token = '' if c.isspace(): continue token += c def main(): license() for fl in sys.argv[1:]: f = open(fl, 'r') tokenize(f.read()) f.close() if __name__ == '__main__': if len(sys.argv) < 2: print('Usage: idltojs.py ') else: main() diff --git a/plugins/qmljs/nodejsmodules/jsgenerator.py b/plugins/qmljs/nodejsmodules/jsgenerator.py index 297458b54d..64ab431301 100644 --- a/plugins/qmljs/nodejsmodules/jsgenerator.py +++ b/plugins/qmljs/nodejsmodules/jsgenerator.py @@ -1,224 +1,224 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . class Member(object): def __init__(self, name): """ Member of classes are identified by a name. A parent name can be given and will be used to build the string "Parent.prototype.name" """ self._name = name self._full_name = name def setParentName(self, name, usePrototype = True): if usePrototype: self._full_name = '%s.prototype.%s' % (name, self.name()) else: self._full_name = '%s.%s' % (name, self.name()) def setName(self, name): self._name = name def name(self): return self._name def fullName(self): return self._full_name def print(self): print('%s = %s;' % (self.fullName(), self.valueToAssign())) if self.valueAfterAssignation() != '': print(self.valueAfterAssignation()) def valueToAssign(self): """ Value to assign to the member, for instance "function (){}" """ return '""'; def valueAfterAssignation(self): """ Line that will be printed after the assignation. Can be used to call a function (therefore giving the type of its parameters. """ return ''; class F(Member): def __init__(self, returnValue, name, *args): """ A function has a name, a return value, and arguments. Each argument, is a tuple whose first entry is the argument name, and the second one its type. Note that types are not given using names ("int", "bool", etc), but values of the type ("1" for an int, "true" or "false" for a boolean, "new X()" for class X, etc). """ Member.__init__(self, name) self._return_value = returnValue self._args = args def print(self): if self.name() != '': # This function is not a member, no need to assign it to an object print(self.valueToAssign()) else: Member.print(self) def valueToAssign(self): # Define the function return 'function %s(%s) { return %s; }' % ( self.name(), ', '.join([arg[0] for arg in self._args]), self._return_value ) def valueAfterAssignation(self): # Call it, so that its parameters have the correct type return '%s(%s);' % ( self.fullName(), ', '.join([arg[1] for arg in self._args]) ) class Var(Member): def __init__(self, type, name): """ A variable has a name and a type """ Member.__init__(self, name) self._type = type def print(self): if self.name() != '': # This variable is not a member, declare it using 'var' print('var %s = %s;' % (self.name(), self.valueToAssign())) else: Member.print(self) def valueToAssign(self): return self._type class Class(F): def __init__(self, name, *args): F.__init__(self, '', name, *args) self._members = [] self._prototype = None def prototype(self, proto): self._prototype = proto return self def member(self, member): self._members.append(member) return self def members(self, *args): for arg in args: self.member(arg) return self def print(self): # Declare the constructor (a function) print('/*\n * %s\n */' % self.fullName()) # Always declare a function using the function keyword old_full_name = self._full_name old_name = self._name self._full_name = self._full_name.split('.')[-1] self._name = self._full_name F.print(self) if old_full_name != self._name: print('%s = %s;' % (old_full_name, self._name)) self._full_name = old_full_name self._name = old_name # Print the prototype if self._prototype is not None: print('%s.prototype = %s;' % (self.fullName(), self._prototype)) print('') # Declare the members for member in self._members: member.setParentName(self.fullName()) member.setName('') member.print() print('') class Struct(Var): def __init__(self, name): Var.__init__(self, '{}', name) self._members = [] def member(self, member): self._members.append(member) return self def members(self, *args): for arg in args: self.member(arg) return self def print(self): # Declare the object print('/*\n * %s\n */' % self.fullName()) Var.print(self) print('') # Declare the members for member in self._members: member.setParentName(self.fullName(), False) member.setName('') member.print() print('') class Module(object): def __init__(self): self._members = [] def member(self, member): self._members.append(member) return self def members(self, *args): for arg in args: self.member(arg) return self def print(self): # Declare the members in "exports" for member in self._members: member.setParentName('exports', False) member.setName('') member.print() print('') diff --git a/plugins/qmljs/nodejsmodules/net.py b/plugins/qmljs/nodejsmodules/net.py index 6e8437f6f2..d28dac622f 100755 --- a/plugins/qmljs/nodejsmodules/net.py +++ b/plugins/qmljs/nodejsmodules/net.py @@ -1,79 +1,79 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') _function = 'function(){}' _object = 'new Object()' _date = 'new Date()' _socket = 'new Socket()' _server = 'new Server()' _address = '{port: 1, family: "", address: ""}' Module().members( F(_server, 'createServer', ('options', _object), ('connectionListener', _function)), F(_socket, 'connect', ('options', _object), ('connectionListener', _function)), F(_socket, 'createConnection', ('options', _object), ('connectionListener', _function)), Class('Server').prototype('event.EventEmitter').members( F(_void, 'listen', ('port', _int), ('host', _string), ('backlog', _int), ('callback', _function)), F(_void, 'close', ('callback', _function)), F(_address, 'address'), F(_void, 'unref'), F(_void, 'ref'), Var(_int, 'maxConnections'), Var(_int, 'connections'), F(_void, 'getConnections', ('callback', _function)) ), Class('Socket', ('options', _object)).prototype('event.EventEmitter').members( F(_void, 'connect', ('port', _int), ('host', _string), ('connectionListener', _function)), Var(_int, 'bufferSize'), F(_void, 'setEncoding', ('encoding', _string)), F(_void, 'write', ('data', _string), ('encoding', _string), ('callback', _function)), F(_void, 'end', ('data', _string), ('encoding', _string)), F(_void, 'destroy'), F(_void, 'pause'), F(_void, 'resume'), F(_void, 'setTimeout', ('timeout', _int), ('callback', _function)), F(_void, 'setNoDelay', ('noDelay', _bool)), F(_void, 'setKeepAlive', ('enable', _bool), ('initialDelay', _int)), F(_address, 'address'), F(_void, 'unref'), F(_void, 'ref'), Var(_string, 'remoteAddress'), Var(_int, 'remotePort'), Var(_string, 'localAddress'), Var(_int, 'localPort'), Var(_int, 'bytesRead'), Var(_int, 'bytesWritten') ), F(_int, 'isIP', ('input', _string)), F(_bool, 'isIPv4', ('input', _string)), F(_bool, 'isIPv6', ('input', _string)) ).print() diff --git a/plugins/qmljs/nodejsmodules/os.py b/plugins/qmljs/nodejsmodules/os.py index 59dbc0dd31..6b0447121b 100755 --- a/plugins/qmljs/nodejsmodules/os.py +++ b/plugins/qmljs/nodejsmodules/os.py @@ -1,49 +1,49 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _object = 'new Object()' Module().members( F(_string, 'tmpdir'), F(_string, 'endianness'), F(_string, 'hostname'), F(_string, 'type'), F(_string, 'platform'), F(_string, 'arch'), F(_string, 'release'), F(_string, 'uptime'), F(_array, 'loadavg'), F(_int, 'totalmem'), F(_int, 'freemem'), F(_array, 'cpus'), F(_object, 'networkInterfaces'), Var(_string, 'EOL') ).print() diff --git a/plugins/qmljs/nodejsmodules/path.py b/plugins/qmljs/nodejsmodules/path.py index 36f4a81094..92679373a3 100755 --- a/plugins/qmljs/nodejsmodules/path.py +++ b/plugins/qmljs/nodejsmodules/path.py @@ -1,42 +1,42 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) Module().members( F(_string, 'normalize', ('p', _string)), F(_string, 'join', ('path1', _string), ('path2', _string)), F(_string, 'resolve', ('path', _string)), F(_string, 'relative', ('from', _string), ('to', _string)), F(_string, 'dirname', ('p', _string)), F(_string, 'basename', ('p', _string), ('ext', _string)), F(_string, 'extname', ('p', _string)), Var(_string, 'sep'), Var(_string, 'delimiter') ).print() diff --git a/plugins/qmljs/nodejsmodules/punycode.py b/plugins/qmljs/nodejsmodules/punycode.py index fa7225917f..d5c409c8a0 100755 --- a/plugins/qmljs/nodejsmodules/punycode.py +++ b/plugins/qmljs/nodejsmodules/punycode.py @@ -1,42 +1,42 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) Module().members( F(_string, 'decode', ('string', _string)), F(_string, 'encode', ('string', _string)), F(_string, 'toUnicode', ('domain', _string)), F(_string, 'toASCII', ('domain', _string)), Struct('ucs2').members( F(_string, 'decode', ('string', _string)), F(_string, 'encode', ('codePoints', _array)) ), Var(_string, 'version') ).print() diff --git a/plugins/qmljs/nodejsmodules/querystring.py b/plugins/qmljs/nodejsmodules/querystring.py index 29bf2b3a15..acf8cb3c12 100755 --- a/plugins/qmljs/nodejsmodules/querystring.py +++ b/plugins/qmljs/nodejsmodules/querystring.py @@ -1,40 +1,40 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _object = 'new Object()' _function = 'new Function()' Module().members( F(_string, 'stringify', ('object', _object), ('sep', _string), ('eq', _string)), F(_object, 'parse', ('str', _string), ('sep', _string), ('eq', _string), ('options', _object)), Var(_function, 'escape'), Var(_function, 'unescape') ).print() diff --git a/plugins/qmljs/nodejsmodules/readline.py b/plugins/qmljs/nodejsmodules/readline.py index 95d51ec5f1..cdd4fba5f0 100755 --- a/plugins/qmljs/nodejsmodules/readline.py +++ b/plugins/qmljs/nodejsmodules/readline.py @@ -1,53 +1,53 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('stream') require('event') _object = 'new Object()' _function = 'function(){}' _stream = 'new stream.Writable()' Module().members( F('new Interface()', 'createInterface', ('options', _object)), Class('Interface').prototype('event.EventEmitter').members( F(_void, 'setPrompt', ('prompt', _string), ('length', _int)), F(_void, 'prompt', ('preserveCursor', _bool)), F(_void, 'question', ('query', _string), ('callback', _function)), F(_void, 'pause'), F(_void, 'resume'), F(_void, 'close'), F(_void, 'write', ('data', _string), ('key', _object)) ), F(_void, 'cursorTo', ('stream', _stream), ('x', _int), ('y', _int)), F(_void, 'moveCursor', ('stream', _stream), ('dx', _int), ('dy', _int)), F(_void, 'clearLine', ('stream', _stream), ('dir', _int)), F(_void, 'clearScreenDown', ('stream', _stream)) ).print() diff --git a/plugins/qmljs/nodejsmodules/stream.py b/plugins/qmljs/nodejsmodules/stream.py index 067490d95e..9b1fdb3120 100755 --- a/plugins/qmljs/nodejsmodules/stream.py +++ b/plugins/qmljs/nodejsmodules/stream.py @@ -1,64 +1,64 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') _object = 'new Object()' _function = 'function(){}' Module().members( Class('Readable').prototype('event.EventEmitter').members( F(_string, 'read', ('size', _int)), F(_void, 'setEncoding', ('encoding', _string)), F(_void, 'resume'), F(_void, 'pause'), F(_void, 'pipe', ('destination', 'new Writable()'), ('options', _object)), F(_void, 'unpipe', ('destination', 'new Writable()')), F(_void, 'unshift', ('chunk', _string)), F('new Readable()', 'wrap', ('stream', _mixed)) ), Class('Writable').prototype('event.EventEmitter').members( F(_void, 'write', ('chunk', _string), ('encoding', _string), ('callback', _function)), F(_void, 'end', ('chunk', _string), ('encoding', _string), ('callback', _function)) ), Class('Duplex').prototype('event.EventEmitter').members( F(_string, 'read', ('size', _int)), F(_void, 'setEncoding', ('encoding', _string)), F(_void, 'resume'), F(_void, 'pause'), F(_void, 'pipe', ('destination', 'new Writable()'), ('options', _object)), F(_void, 'unpipe', ('destination', 'new Writable()')), F(_void, 'unshift', ('chunk', _string)), F('new Readable()', 'wrap', ('stream', _mixed)), F(_void, 'write', ('chunk', _string), ('encoding', _string), ('callback', _function)), F(_void, 'end', ('chunk', _string), ('encoding', _string), ('callback', _function)) ), Class('Transform').prototype('exports.Duplex') ).print() diff --git a/plugins/qmljs/nodejsmodules/string_decoder.py b/plugins/qmljs/nodejsmodules/string_decoder.py index 932e3813b4..dd6465e746 100755 --- a/plugins/qmljs/nodejsmodules/string_decoder.py +++ b/plugins/qmljs/nodejsmodules/string_decoder.py @@ -1,38 +1,38 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('buffer') Module().members( Class('StringDecoder', ('encoding', _string)).members( F(_string, 'write', ('buffer', 'new buffer.Buffer()')), F(_string, 'end') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/tls.py b/plugins/qmljs/nodejsmodules/tls.py index 800941a997..f359f6bccf 100755 --- a/plugins/qmljs/nodejsmodules/tls.py +++ b/plugins/qmljs/nodejsmodules/tls.py @@ -1,72 +1,72 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('event') _object = 'new Object()' _function = 'function(){}' _address = '{port: 1, family: "", address: ""}' _peer_certificate = """{ subject: {C: "", ST: "", L: "", O: "", OU: "", CN: ""}, issuer: {C: "", ST: "", L: "", O: "", OU: "", CN: ""}, valid_from: "", valid_to: "", fingerprint: ""}""" _cipher = '{name: "", version: ""}' Module().members( F(_array, 'getCiphers'), F('new Server()', 'createServer', ('options', _object), ('secureConnectionListener', _function)), Var(_int, 'SLAB_BUFFER_SIZE'), F('new CleartextStream()', 'connect', ('options', _object), ('callback', _function)), F('new SecurePair()', 'createSecurePair', ('credentials', _object), ('isServer', _bool), ('requestCert', _bool), ('rejectUnauthorized', _bool)), Class('SecurePair').prototype('event.EventEmitter'), Class('Server').prototype('event.EventEmitter').members( F(_void, 'listen', ('port', _int), ('host', _string), ('callback', _function)), F(_void, 'close'), F(_address, 'address'), F(_void, 'addContext', ('hostname', _string), ('credentials', _object)), Var(_int, 'maxConnections'), Var(_int, 'connections') ), Class('CryptoStream').members( Var(_int, 'bytesWritten') ), Class('CleartextStream').prototype('event.EventEmitter').members( Var(_bool, 'authorized'), Var(_string, 'authorizationError'), F(_peer_certificate, 'getPeerCertificate'), F(_cipher, 'getCipher'), F(_address, 'address'), Var(_string, 'remoteAddress'), Var(_int, 'remotePort') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/tty.py b/plugins/qmljs/nodejsmodules/tty.py index 5300352634..b48b583873 100755 --- a/plugins/qmljs/nodejsmodules/tty.py +++ b/plugins/qmljs/nodejsmodules/tty.py @@ -1,46 +1,46 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('stream') _object = 'new Object()' Module().members( F(_bool, 'isatty', ('fd', _int)), F(_void, 'setRawMode', ('mode', _bool)), Class('ReadStream').prototype('stream.Readable').members( Var(_bool, 'isRaw'), F(_void, 'setRawMode', ('mode', _bool)) ), Class('WriteStream').prototype('stream.Writable').members( Var(_int, 'columns'), Var(_int, 'rows') ) ).print() diff --git a/plugins/qmljs/nodejsmodules/url.py b/plugins/qmljs/nodejsmodules/url.py index b669e67971..1066e9c103 100755 --- a/plugins/qmljs/nodejsmodules/url.py +++ b/plugins/qmljs/nodejsmodules/url.py @@ -1,39 +1,39 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _object = 'new Object()' _url = '{href: "", protocol: "", auth: "", hostname: "", port: 1, host: "", pathname: "", search: "", query: new Object(), hash: ""}' Module().members( F(_url, 'parse', ('urlStr', _string), ('parseQueryString', _bool), ('slashesDenoteHost', _string)), F(_string, 'format', ('urlObj', _object)), F(_string, 'resolve', ('from', _string), ('to', _string)) ).print() diff --git a/plugins/qmljs/nodejsmodules/util.py b/plugins/qmljs/nodejsmodules/util.py index 61c80a484a..e1911bfc30 100755 --- a/plugins/qmljs/nodejsmodules/util.py +++ b/plugins/qmljs/nodejsmodules/util.py @@ -1,48 +1,48 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _object = 'new Object()' _function = 'function(){}' Module().members( F(_string, 'format', ('format', _string), ('args', _mixed)), F(_void, 'debug', ('string', _string)), F(_void, 'error', ('string', _string)), F(_void, 'puts', ('string', _string)), F(_void, 'print', ('string', _string)), F(_void, 'log', ('string', _string)), F(_string, 'inspect', ('object', _object), ('options', _object)), F(_bool, 'isArray', ('object', _array)), F(_bool, 'isRegExp', ('object', 'new RegExp()')), F(_bool, 'isDate', ('object', 'new Date()')), F(_bool, 'isError', ('object', 'new Error()')), F(_void, 'inherits', ('constructor', _function), ('superConstructor', _function)) ).print() diff --git a/plugins/qmljs/nodejsmodules/vm.py b/plugins/qmljs/nodejsmodules/vm.py index 8ca7fd8a2d..74ef3882b7 100755 --- a/plugins/qmljs/nodejsmodules/vm.py +++ b/plugins/qmljs/nodejsmodules/vm.py @@ -1,48 +1,48 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) _object = 'new Object()' _function = 'function(){}' _context = 'new Context()' _script = 'new Script()' Module().members( F(_mixed, 'runInThisContext', ('code', _string), ('filename', _string)), F(_mixed, 'runInNewContext', ('code', _string), ('sandbox', _object), ('filename', _string)), F(_mixed, 'runInContext', ('code', _string), ('context', _context), ('filename', _string)), F(_context, 'createContext', ('initSandbox', _object)), F(_script, 'createScript', ('code', _string), ('filename', _string)), Class('Context'), Class('Script').members( F(_mixed, 'runInThisContext'), F(_mixed, 'runInNewContext', ('sandbox', _object)) ) ).print() diff --git a/plugins/qmljs/nodejsmodules/zlib.py b/plugins/qmljs/nodejsmodules/zlib.py index be7cd75a8b..4daf4e5ab4 100755 --- a/plugins/qmljs/nodejsmodules/zlib.py +++ b/plugins/qmljs/nodejsmodules/zlib.py @@ -1,66 +1,66 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of qmljs, the QML/JS language support plugin for KDevelop # Copyright (c) 2014 Denis Steckelmacher # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from jsgenerator import * from common import * # Print the license of the generated file (the same as the one of this file) license() basicTypes(globals()) require('stream') require('buffer') _object = 'new Object()' _function = 'function(){}' _options = ('options', _object) _buf = ('buf', 'new buffer.Buffer()') _callback = ('callback', _function) Module().members( F('new Gzip()', 'createGzip', _options), F('new Gunzip()', 'createGunzip', _options), F('new Deflate()', 'createDeflate', _options), F('new Inflate()', 'createInflate', _options), F('new DeflateRaw()', 'createDeflateRaw', _options), F('new InflateRaw()', 'createInflateRaw', _options), F('new Unzip()', 'createUnzip', _options), Class('Zlib').prototype('stream.Duplex').members( F(_void, 'flush', ('callback', _function)), F(_void, 'reset') ), Class('Gzip').prototype('exports.Zlib'), Class('Gunzip').prototype('exports.Zlib'), Class('Deflate').prototype('exports.Zlib'), Class('Inflate').prototype('exports.Zlib'), Class('DeflateRaw').prototype('exports.Zlib'), Class('InflateRaw').prototype('exports.Zlib'), Class('Unzip').prototype('exports.Zlib'), F(_void, 'deflate', _buf, _callback), F(_void, 'deflateRaw', _buf, _callback), F(_void, 'gzip', _buf, _callback), F(_void, 'gunzip', _buf, _callback), F(_void, 'inflate', _buf, _callback), F(_void, 'inflateRaw', _buf, _callback), F(_void, 'unzip', _buf, _callback) ).print()