2016-10-11 06:28:16 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Charybdis Development Team
|
|
|
|
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice is present in all copies.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This header exposes the SpiderMonkey engine API to all ye who include it.
|
|
|
|
* It also anchors all of our own developed headers and utils which use and extend their API.
|
|
|
|
*
|
|
|
|
* This header is included after the 'stdinc header' <ircd/js.h>. That header creates the
|
|
|
|
* namespace ircd::js, and does not include any 3rd party symbols. <ircd/js.h> is included
|
|
|
|
* automatically in stdinc.h.
|
|
|
|
*
|
|
|
|
* This header should be included if you intend to get dirty with the JS engine subsystem
|
|
|
|
* which requires jsapi support and can't be satisfied by the stdinc header.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_JS_JS_H
|
|
|
|
|
|
|
|
// SpiderMonkey headers require an include basis e.g. -I/usr/include/mozjs-XX as their
|
|
|
|
// include directives are written as "jsxxx.h" or "mozilla/xxx.h" etc. Our includes are all
|
|
|
|
// <ircd/xxx.h> and shouldn't have any conflict issues.
|
|
|
|
#include <jsapi.h>
|
2016-10-14 06:51:43 +02:00
|
|
|
#include <js/Conversions.h>
|
2016-10-11 06:28:16 +02:00
|
|
|
|
|
|
|
namespace ircd {
|
|
|
|
namespace js {
|
|
|
|
|
2016-10-14 02:24:50 +02:00
|
|
|
// Extend this class to store your data with any priv(),
|
|
|
|
// i.e priv(runtime, privdata*) or priv(context, privdata*) etc
|
|
|
|
struct privdata
|
|
|
|
{
|
|
|
|
virtual ~privdata() noexcept = 0; // Your object is managed by the host
|
|
|
|
};
|
|
|
|
|
2016-10-19 02:10:27 +02:00
|
|
|
inline const char *version(const JSVersion &v) { return JS_VersionToString(v); }
|
|
|
|
inline JSVersion version(const char *const &v) { return JS_StringToVersion(v); }
|
2016-10-14 02:24:50 +02:00
|
|
|
|
2016-10-11 06:28:16 +02:00
|
|
|
} // namespace js
|
|
|
|
} // namespace ircd
|
2016-10-12 09:04:26 +02:00
|
|
|
|
|
|
|
#include "runtime.h"
|
2016-10-22 05:32:45 +02:00
|
|
|
#include "timer.h"
|
2016-10-12 09:04:26 +02:00
|
|
|
#include "context.h"
|
2016-10-16 03:44:51 +02:00
|
|
|
#include "compartment.h"
|
2016-10-24 07:40:45 +02:00
|
|
|
#include "debug.h"
|
2016-10-17 21:16:30 +02:00
|
|
|
#include "error.h"
|
2016-10-26 10:28:17 +02:00
|
|
|
#include "native.h"
|
2016-10-19 02:17:29 +02:00
|
|
|
#include "value.h"
|
2016-10-14 06:51:43 +02:00
|
|
|
#include "string.h"
|
2016-10-19 02:17:29 +02:00
|
|
|
#include "id.h"
|
|
|
|
#include "object.h"
|
2016-10-23 06:08:04 +02:00
|
|
|
#include "script.h"
|
2016-10-19 02:17:29 +02:00
|
|
|
#include "function.h"
|
2016-10-24 03:18:37 +02:00
|
|
|
#include "function_literal.h"
|
2016-10-20 02:12:36 +02:00
|
|
|
#include "vector.h"
|
2016-10-18 03:44:36 +02:00
|
|
|
#include "priv.h"
|
2016-10-24 07:44:41 +02:00
|
|
|
#include "has.h"
|
2016-10-18 03:44:36 +02:00
|
|
|
#include "get.h"
|
2016-10-24 07:44:41 +02:00
|
|
|
#include "set.h"
|
|
|
|
#include "del.h"
|
2016-10-19 02:17:29 +02:00
|
|
|
#include "call.h"
|
|
|
|
#include "for_each.h"
|
2016-10-25 07:11:15 +02:00
|
|
|
#include "args.h"
|
2016-10-15 07:44:42 +02:00
|
|
|
#include "trap.h"
|