improve script binding

This commit is contained in:
xianjimli 2019-12-13 12:16:14 +08:00
parent 691241f7c5
commit ac715579b3
5 changed files with 2954 additions and 2835 deletions

View File

@ -32,6 +32,7 @@ typedef ret_t (*bitmap_destroy_t)(bitmap_t* bitmap);
/**
* @class bitmap_t
* @order -9
* @annotation ["scriptable"]
*
*/

View File

@ -29,6 +29,7 @@ BEGIN_C_DECLS
/**
* @class point_t
* @annotation ["scriptable"]
* @order -10
* x坐标和一个y坐标
*/
typedef struct _point_t {
@ -48,6 +49,7 @@ typedef struct _point_t {
/**
* @class pointf_t
* @order -10
* @annotation ["scriptable"]
* ()x坐标和一个y坐标
*/
@ -68,6 +70,7 @@ typedef struct _pointf_t {
/**
* @class rect_t
* @order -10
* @annotation ["scriptable"]
* x坐标y坐标
*/

View File

@ -151,6 +151,7 @@ typedef struct _sized_str_t {
/**
* @class value_t
* @order -10
* @annotation ["scriptable"]
*
*

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,10 @@ class IDLGenerator {
parseAlias(str) {
return this.getValue(str);
}
parseOrder(str) {
return parseInt(this.getValue(str));
}
parsePrefix(str) {
return this.getValue(str);
@ -222,6 +226,8 @@ class IDLGenerator {
cls.annotation = this.parseAnnotation(iter);
}else if (iter.indexOf('@alias') >= 0) {
cls.alias = this.parseAlias(iter);
}else if (iter.indexOf('@order') >= 0) {
cls.order = this.parseOrder(iter);
} else if (iter.indexOf('@parent') >= 0) {
cls.parent = this.parseParent(iter);
} else {
@ -380,7 +386,10 @@ class IDLGenerator {
sort() {
this.result.sort((a, b) => {
return a.level - b.level;
let aLevel = a.order || a.level;
let bLevel = b.order || b.level;
return aLevel - bLevel;
});
}