[Freeswitch-branches] [commit] r7476 - freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/languages/mod_spidermonkey_directory

Freeswitch SVN anthonyl at freeswitch.org
Fri Feb 1 16:41:54 EST 2008


Author: anthonyl
Date: Fri Feb  1 16:41:53 2008
New Revision: 7476

Added:
   freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/languages/mod_spidermonkey_directory/mod_spidermonkey_directory.c

Log:
framework for mod_spidermonkey_directory, filling it up today.


Added: freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/languages/mod_spidermonkey_directory/mod_spidermonkey_directory.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/languages/mod_spidermonkey_directory/mod_spidermonkey_directory.c	Fri Feb  1 16:41:53 2008
@@ -0,0 +1,125 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct at yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct at yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony LaMantia  <anthony at petabit.net>
+ *
+ *
+ * mod_spidermonkey_directory.c -- Sipdermonkey Directory Module
+ *
+ */
+#include <switch.h>
+#include "mod_spidermonkey.h"
+#include "switch_core_directory.h"
+#include "switch_module_interfaces.h"
+#include "switch_types.h"
+#include "private/switch_core_pvt.h"
+
+static const char modname[] = "JSDirectory";
+
+static JSBool js_directory_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	return JS_TRUE;
+}
+static void js_directory_destroy(JSContext * cx, JSObject * obj)
+{
+   
+}
+static JSBool js_directory_open(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+    return JS_FALSE;
+}
+static JSBool js_directory_next(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+    return JS_FALSE;
+}
+static JSBool js_directory_next_pair(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+    return JS_FALSE;
+}
+static js_directory_add(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+    return JS_FALSE;
+}
+enum directory_tinyid {
+	DIRECTORY_NAME
+};
+
+static JSFunctionSpec directory_methods[] = {
+	{"directoryOpen",    js_open_directory, 1},
+    {"directoryNext",    js_directory_next, 1},
+    {"directoryNextPair" js_directory_next_pair, 1},
+	{0}
+};
+
+static JSPropertySpec directory_props[] = {
+	{"name", DIRECTORY_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
+	{0}
+};
+
+
+static JSBool js_directory_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	JSBool res = JS_TRUE;
+
+	return res;
+}
+
+JSClass js_directory_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, js_directory_getProperty, DEFAULT_SET_PROPERTY,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, js_directory_destroy, NULL, NULL, NULL,
+	js_directory_construct
+};
+
+
+switch_status_t spidermonkey_load(JSContext * cx, JSObject * obj)
+{
+	JS_InitClass(cx, obj, NULL, &js_directory_class, js_directory_construct, 3, directory_props, directory_methods, directory_props, directory_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t js_directory_module_interface = {
+	/*.name = */             modname,
+	/*.spidermonkey_load */  spidermonkey_load,
+	/*.next */               NULL
+};
+
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	*module_interface = &js_directory_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:nil
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */



More information about the Freeswitch-branches mailing list