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

0001 #!/usr/bin/env python3
0002 # -*- coding: utf-8 -*-
0003 #
0004 # SPDX-FileCopyrightText: 2014 Denis Steckelmacher <steckdenis@yahoo.fr>
0005 #
0006 # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 
0008 from jsgenerator import *
0009 from common import *
0010 
0011 # Print the license of the generated file (the same as the one of this file)
0012 license()
0013 basicTypes(globals())
0014 
0015 _object = 'new Object()'
0016 _function = 'function(){}'
0017 _context = 'new Context()'
0018 _script = 'new Script()'
0019 
0020 Module().members(
0021     F(_mixed, 'runInThisContext', ('code', _string), ('filename', _string)),
0022     F(_mixed, 'runInNewContext', ('code', _string), ('sandbox', _object), ('filename', _string)),
0023     F(_mixed, 'runInContext', ('code', _string), ('context', _context), ('filename', _string)),
0024     F(_context, 'createContext', ('initSandbox', _object)),
0025     F(_script, 'createScript', ('code', _string), ('filename', _string)),
0026     Class('Context'),
0027     Class('Script').members(
0028         F(_mixed, 'runInThisContext'),
0029         F(_mixed, 'runInNewContext', ('sandbox', _object))
0030     )
0031 ).print()