]> err.no Git - sope/blob - Recycler/NGJavaScript/NGJavaScriptCallable.m
removed NGCString
[sope] / Recycler / NGJavaScript / NGJavaScriptCallable.m
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #include "NGJavaScriptCallable.h"
24 #include "common.h"
25
26 @implementation NGJavaScriptCallable
27
28 static void _finalize(JSContext *cx, JSObject *obj);
29
30 JSClass NGJavaScriptCallable_JSClass = {
31   "NGJavaScriptCallable",
32   JSCLASS_HAS_PRIVATE /* flags */,
33   JS_PropertyStub,
34   JS_PropertyStub,
35   JS_PropertyStub,
36   JS_PropertyStub,
37   JS_EnumerateStub,
38   JS_ResolveStub,
39   JS_ConvertStub,
40   _finalize,
41   /* Optionally non-null members start here. */
42   NULL, //JSGetObjectOps getObjectOps;
43   NULL, //JSCheckAccessOp checkAccess;
44   NULL, //JSNative call;
45   NULL, //JSNative construct;
46   NULL, //JSXDRObjectOp xdrObject;
47   NULL, //JSHasInstanceOp hasInstance;
48   //prword spare[2];
49 };
50
51 + (void *)jsObjectClass {
52   return &NGJavaScriptCallable_JSClass;
53 }
54
55 static void _finalize(JSContext *cx, JSObject *obj) {
56   NGJavaScriptCallable *self;
57   
58   if ((self = JS_GetPrivate(cx, obj)) == nil) {
59     JS_FinalizeStub(cx, obj);
60   }
61   else if (self->handle == obj) {
62   }
63   else {
64 #if DEBUG
65     fprintf(stderr, "%s: aborting ..\n", __PRETTY_FUNCTION__);
66     abort();
67 #else
68     fprintf(stderr, "%s: invalid finalize ..\n", __PRETTY_FUNCTION__);
69 #endif
70   }
71 }
72
73 @end /* NGJavaScriptCallable */