Line data Source code
1 0 : /* 2 : 3 : OOJSCall.h 4 : 5 : Basic JavaScript-to-ObjC bridge implementation. 6 : 7 : Oolite 8 : Copyright (C) 2004-2013 Giles C Williams and contributors 9 : 10 : This program is free software; you can redistribute it and/or 11 : modify it under the terms of the GNU General Public License 12 : as published by the Free Software Foundation; either version 2 13 : of the License, or (at your option) any later version. 14 : 15 : This program is distributed in the hope that it will be useful, 16 : but WITHOUT ANY WARRANTY; without even the implied warranty of 17 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 : GNU General Public License for more details. 19 : 20 : You should have received a copy of the GNU General Public License 21 : along with this program; if not, write to the Free Software 22 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 : MA 02110-1301, USA. 24 : 25 : */ 26 : 27 : #ifndef NDEBUG 28 : 29 : 30 : #import <Foundation/Foundation.h> 31 : #include <jsapi.h> 32 : 33 : 34 : /* OOJSCallObjCObjectMethod() 35 : 36 : Function for implementing JavaScript call() methods. 37 : 38 : The argument list is expected to be either a single string (selector), or 39 : a string ending with a : followed by arbitrary arguments which will be 40 : concatenated as a string. (This behaviour reflects Oolite's traditional 41 : scripting system and the expectations of its script methods. It also has 42 : the advantage that it can be done with GNUstep's buggy implementation of 43 : NSMethodSignature.) 44 : 45 : If the method returns an object, *outResult will be set to that object's 46 : -oo_jsValueInContext:. Otherwise, it will be left unchanged. 47 : 48 : argv is assumed to contain at least one value. 49 : */ 50 0 : BOOL OOJSCallObjCObjectMethod(JSContext *context, id object, NSString *oo_jsClassName, uintN argc, jsval *argv, jsval *outResult); 51 : 52 : #endif