Giter Site home page Giter Site logo

jsbindings's People

Contributors

carlomorgantinizynga avatar colesbury avatar folecr avatar joshgarnett avatar many20 avatar mvarie avatar ricardoquesada avatar rohankuruvilla avatar rolandoam avatar wu-hao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsbindings's Issues

memory leak in JSB_core_log

JSB_core_log in src/manual/jsb_core.mm has a memory leak. It calls JS_EncodeString whose return value, according to the docs, should be JS_free'd.

wrong SpriteBatchNode initializer name

in jsbindings for cocos2d, the initializer name is initWithFileCapacity(file, capacity), instead of initWithFile(file, capacity), causing incompatibility with cocos2d-html5.

Give better error descriptions

When there's an error compiling a script, all info I get is that it happened at the 'require' statement. In case of the typical cocos2d setup where files are included from an array, that doesn't even tell which file is causing the problem. It would be nice if we got some sort of error description from the compiler.

how to convert own framework to JS as same as those in cocos2d etc.

I have some project that written in object-c,and I want to convert those to JS with JSB so that I can reuse them in cocos2d+JS.I have read the introductions and also followed, But I get troubles in the progress. I post the troubles as follows .Do i get something wrong or the JSB could't convert my own project. My mac os is 10.7.5.Looking for help.
o7njl2flmfre20tfntrip

sre_constants.error: nothing to repeat

I keep getting this error when Parsing the Parse SDK for iOS, this is my config file

[Parse]

You can extend the functionality by using plugins

Basically you can override the functionality of the converters

Ignore constants for CocosDenshion

plugin = constant_class = JSBGenerateConstants_Ignore,

JS namespace. By default it is the same as config file namespace.

This namespace is used then the script autogenerates JS code. eg: with the constants

Not used in CocosDenshion

js_namespace = parse

prefix that will be removed from the ObjC classes in order to generate the JS classes

ex: If the class name is CCNode, then on JavaScript it will be Node

CocosDenshion classes start with 'CD'

obj_class_prefix_to_remove = CD

Classes to generate. Use '*' to generate all the parsed classes.

Subclasses will be parsed as well.

ex: If CCSprite is parsed, then CCNode and NSObject will be parsed as well

It supports regular expressions to match class names.

eg: all cocos2d actions ending in 'By': CC(.*)By

Only parse 'SimpleAudioEngine'

classes_to_parse = *

Classes to ignore.

It is a good idea to add classes that you don't want to have a proxy object. Usually internal classes,

or classes that are already native on JavaScript should be added here.

It supports regular expressions to match class names.

eg: all NS classes: NS(.*)

Ignore the rest of the classes

classes_to_ignore = NS(.*)

Class properties

Options

manual Means that the class is manually bound. No binding info will generated, but it can be used.

class_properties = NSObject = manual,
NSEvent = manual

Whether or not to generate constructors from base classes for the current class.

In JavaScript, the "constructors" or "static methods" are not "inherited".

It is recommended to set it to "auto".

Options:

False: Don't inherited

True: Inherit all class methods from all ancestors

Auto: Inherit only if it has no class constructors. Stop when the fist class constructor is added.

inherit_class_methods = Auto

Files that are going to be imported by the autogenerated files.

Useful to declare subclasses of an already bound project

eg: manual bindigns for NSObject

import_files = jsb_NS_manual.h

The prefix will be removed from function name.

eg: if the C function is "cpBodyAddShape", then the JS name will be "bodyWithAddShape"

For cocos2d add "cc"

function_prefix_to_remove = PF

Free functions to be parsed

functions_to_parse =

Free functions not to parse

functions_to_ignore =

Rules used for methods:

options:

name:"js_name" Rename methods.

ignore This method will be ignored.

callback This method is a callback. It will be invoked from Objective-C

no_swizzle It means that the callback function is an optional protocol and should not be "swizzled" because there is no implementation for it.

variadic_2_array It means that all arguments are variadic, and an Array will be created with them

merge:name | name... List of methods names that should be merged with this method as well.

manual It means that its implementation won't be autogenerated. It is implemented manually

Regular expressions are supported in the Class names, but not in the Method names

method_properties =

Struct properties

options:

opaque The structure will be treated as 'opaque' and can't not be inspected from JS.

Opaque structures are much faster to generate than 'manual' or 'automatic' structures

manual Manual conversion is provided for this structures. jsval_to_structname() and structname_to_jsval shall exists in your project

struct_properties =

BridgeSupport files

add as many as you need. Usually you will only one.

bridge_support_file = Parse.bridgesupport

File that contains information that complements BridgeSupport (not present on BridgeSupport file)

complement_file = Parse-complement.txt

Info: Thesis on glue code generation for Spidermonkey (and C++)

During my master's thesis I created a general-purpose application for generating glue code, Bound. I started with binding code for bridging C++ and SpiderMonkey, all explained in the thesis (pdf!!). It is also based on Clang.

I didn't do anything on it the last months as I had to take a little break after the thesis. Also, it may be hacky at some points due to the limited time. Also, for simplicity of learning, I created a GUI application (though command-line was always planned).

I just thought it might be of interest to you, as you deal with the exact same topic. When I go back working on Bound, I will definitely take I a look at your project.

Good luck, with your project!!

JSB_jsval_to_NSObject not converts to some types: NSArray, NSValue, etc.

Some Obj-C methods takes arguments of type id or NSObject, but in both cases this also may be such subclasses as NSArray, NSValue, NSDicationary, etc.
As i understand JSB_jsval_to_NSObject doesn't convert values to that types, and instead of it should be used JSB_jsval_to_unknown. But in all autogenerated methods is used JSB_jsval_to_NSObject.

Example of such method, where conversion to NSObject is insufficiently: [CCBAnimationManager setBaseValue:forNode:propertyName:] - it may take NSArrays, NSNumbers as first argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.