1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# SPDX-FileCopyrightText: 2014 Denis Steckelmacher <steckdenis@yahoo.fr>
5#
6# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
7
8from jsgenerator import *
9from common import *
10
11# Print the license of the generated file (the same as the one of this file)
12license()
13basicTypes(globals())
14
15_object = 'new Object()'
16_function = 'function(){}'
17_context = 'new Context()'
18_script = 'new Script()'
19
20Module().members(
21    F(_mixed, 'runInThisContext', ('code', _string), ('filename', _string)),
22    F(_mixed, 'runInNewContext', ('code', _string), ('sandbox', _object), ('filename', _string)),
23    F(_mixed, 'runInContext', ('code', _string), ('context', _context), ('filename', _string)),
24    F(_context, 'createContext', ('initSandbox', _object)),
25    F(_script, 'createScript', ('code', _string), ('filename', _string)),
26    Class('Context'),
27    Class('Script').members(
28        F(_mixed, 'runInThisContext'),
29        F(_mixed, 'runInNewContext', ('sandbox', _object))
30    )
31).print()
32