Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Gear2CC: Replaced JSCC with CodeAze, an unpublished project of mine. …

…The only changes to the .gear format are getter->get and setter->set.
  • Loading branch information...
commit 06e20367fa534fe4fe417adb74aa6fce7fa553fd 1 parent 7baa36e
Eduard Burtescu authored
View
6 SConstruct
@@ -64,7 +64,7 @@ if sys.platform == 'win32' or not hasattr(os.environ, 'TERM') or os.environ['TER
env['NMCOMSTR'] = ' Creating map $SOURCES -> $TARGET'
env['DOCCOMSTR'] = ' Documenting $SOURCES -> $TARGET'
env['TARCOMSTR'] = ' Creating $SOURCES -> $TARGET'
- env['JSCCCOMSTR'] = ' Compiling $SOURCES -> $TARGET'
+ env['AZE2JSCOMSTR'] = ' Converting $SOURCES -> $TARGET'
env['GEAR2CCCOMSTR'] =' Converting $SOURCES -> $TARGETS'
else:
env['CCCOMSTR'] = ' Compiling \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGET\033[0m'
@@ -76,13 +76,13 @@ else:
env['NMCOMSTR'] = ' Creating map \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGET\033[0m'
env['DOCCOMSTR'] = ' Documenting \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGET\033[0m'
env['TARCOMSTR'] = ' Creating \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGET\033[0m'
- env['JSCCCOMSTR'] = ' Compiling \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGET\033[0m'
+ env['AZE2JSCOMSTR'] = ' Converting \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGET\033[0m'
env['GEAR2CCCOMSTR'] =' Converting \033[32m$SOURCES\033[0m\033[1m -> \033[0m\033[32m$TARGETS\033[0m'
env['BUILD_DIR'] = 'build'
env['GEARBOX'] = env['BUILD_DIR'] + os.sep + 'gearbox' + env['PROGSUFFIX']
env['GEARBOX_EXISTS'] = os.path.exists(env['GEARBOX'])
-env['BUILDERS']['JsCC'] = Builder(action=Action(env['GEARBOX']+' gear2cc'+os.sep+'jscc.js -o $TARGET -p v8 -t gear2cc'+os.sep+'driver_v8.js_ $SOURCE', cmdstr=env['JSCCCOMSTR']))
+env['BUILDERS']['Aze2JS'] = Builder(action=Action(env['GEARBOX']+' gear2cc'+os.sep+'aze2js.js $SOURCE $TARGET', cmdstr=env['AZE2JSCOMSTR']))
env['BUILDERS']['Gear2CC'] = Builder(action=Action(env['GEARBOX']+' gear2cc'+os.sep+'gear2cc.js $SOURCE', cmdstr=env['GEAR2CCCOMSTR']))
SConscript('src/SConscript', variant_dir = env['BUILD_DIR'], exports = ['env'], duplicate = 0)
View
269 gear2cc/Codeaze.js
@@ -0,0 +1,269 @@
+//"use strict";
+
+var exports = {}; // TODO: Remove this later when it becomes a module
+
+exports.Codeaze = function Codeaze(options) {
+ options = options || {};
+ this.symbols = options.symbols || {};
+ this.mainSymbol = options.mainSymbol || "main";
+ this.spaceSymbol = options.spaceSymbol || "space";
+ this.spaceDefault = options.spaceDefault || "*";
+ this.spaceIgnore = options.spaceIgnore === undefined ? true : options.spaceIgnore;
+ this.init = options.init || function(){};
+};
+
+exports.Codeaze.prototype.parse = function parse(text) {
+ if(!this.hasSymbolsFixed) {
+ this.fixSymbols();
+ this.hasSymbolsFixed = true;
+ }
+ var state = {text:text, offset:0, symbols:this.symbols, main:this.symbols[this.mainSymbol], space:this.symbols[this.spaceSymbol]};
+ this.init.call(state);
+ return state.main.parse(state);
+};
+
+exports.Codeaze.prototype.fixSymbols = function fixSymbols() {
+ // The special space symbol
+ this.symbols[" "] = {symbol:this.symbols[this.spaceSymbol], ignore:this.spaceIgnore, min:0, max:Infinity};
+ if(this.spaceDefault == "?")
+ this.symbols[" "].max = 1;
+ if(this.spaceDefault == "+")
+ this.symbols[" "].min = 1;
+
+ for(var i in this.symbols) {
+ if(i == " ")
+ continue;
+ if(this.symbols[i].fixSymbol)
+ this.symbols[i] = this.symbols[i].fixSymbol;
+ else
+ this.symbols[i].fixSymbols(this.symbols);
+ }
+
+ delete this.symbols[" "];
+};
+
+exports.Symbol = function Symbol(sym, proc) {
+ // Reference to another symbol, to be fixed later
+ if(typeof sym == "string" && /^([a-zA-Z_]\w*| )$/.test(sym))
+ return {fixSymbol:sym};
+
+ // Forward Symbol(...) to new Symbol(...)
+ if(!(this instanceof exports.Symbol))
+ return new exports.Symbol(sym, proc);
+
+ this.proc = proc;
+
+ // RegExp Symbols
+ if(sym instanceof RegExp) {
+ this.regexp = RegExp("^"+sym.source);
+ return;
+ }
+
+ // Parse the Symbol
+ var state = {text:sym, offset:0, choiceLists:[], choiceList:new exports.ChoiceList()};
+
+ state.makeChoice = function(obj, defaults) {
+ if(this.offset >= this.text.length)
+ return defaults ? new exports.Choice(obj, defaults.min, defaults.max) : obj;
+ if(this.text[this.offset] == "?")
+ return new exports.Choice(obj, 0, 1);
+ if(this.text[this.offset] == "*")
+ return new exports.Choice(obj, 0, Infinity);
+ if(this.text[this.offset] == "+")
+ return new exports.Choice(obj, 1, Infinity);
+ if(this.text[this.offset] == "{") {
+ var min = "", max = "";
+ for(this.offset++; this.offset < text.length && this.text[this.offset] != ","; this.offset++)
+ min += this.text[this.offset];
+ for(this.offset++; this.offset < text.length && this.text[this.offset] != "}"; this.offset++)
+ max += this.text[this.offset];
+ return new exports.Choice(obj, +min, max.length ? +max : Infinity);
+ }
+ this.offset--;
+ return defaults ? new exports.Choice(obj, defaults.min, defaults.max) : obj;
+ };
+
+ for(state.offset = 0; state.offset < state.text.length; state.offset++) {
+ var c = state.text[state.offset];
+
+ // RegExps
+ if(c == "/") {
+ var regexp = "";
+ for(state.offset++; state.offset < state.text.length; state.offset++) {
+ if(state.text[state.offset] == "/")
+ break;
+ regexp += state.text[state.offset];
+ if(state.text[state.offset] == "\\")
+ regexp += state.text[++state.offset];
+ }
+ state.offset++;
+ state.choiceList.push(state.makeChoice(new exports.Symbol(new RegExp(regexp))));
+ continue;
+ }
+
+ // References to other symbols
+ if(/[a-zA-Z_]/.test(c)) {
+ var symbol = c;
+ for(state.offset++; state.offset < state.text.length && /\w/.test(state.text[state.offset]); state.offset++)
+ symbol += state.text[state.offset];
+ state.choiceList.push(state.makeChoice(exports.Symbol(symbol)));
+ continue;
+ }
+
+ // Any kinds of space
+ if(/\s/.test(c)) {
+ for(state.offset++; state.offset < state.text.length && /\s/.test(state.text[state.offset]); state.offset++);
+ state.choiceList.push(state.makeChoice(exports.Symbol(" "), {min:-Infinity, max:Infinity}));
+ continue;
+ }
+
+ // Parallel choices
+ if(c == "|") {
+ if(!state.choiceLists.length || !state.choiceLists[state.choiceLists.length - 1].parallel)
+ state.choiceLists.push(new exports.ChoiceList(true));
+ state.choiceLists[state.choiceLists.length - 1].push(state.choiceList);
+ state.choiceList = new exports.ChoiceList();
+ continue;
+ }
+
+ // Start of serial choices
+ if(c == "(") {
+ state.choiceLists.push(state.choiceList);
+ state.choiceList = new exports.ChoiceList();
+ continue;
+ }
+
+ // End of serial choices
+ if(c == ")") {
+ var closingChoiceList = state.choiceList;
+ state.choiceList = state.choiceLists.pop();
+ if(state.choiceList.parallel) {
+ state.choiceList.push(closingChoiceList);
+ closingChoiceList = state.choiceList;
+ state.choiceList = state.choiceLists.pop();
+ }
+ state.offset++;
+ state.choiceList.push(state.makeChoice(closingChoiceList));
+ continue;
+ }
+
+ // Separator
+ if(c == ",")
+ continue;
+
+ throw new Error("Unrecognized token '" + c + "' in '" + state.text + "'");
+ }
+
+ if(state.choiceLists.length > 1)
+ throw new Error("Too many choice lists left ("+state.choiceLists.length+")");
+
+ if(state.choiceLists.length && state.choiceLists[0].parallel) {
+ state.choiceLists[0].push(state.choiceList);
+ state.choiceList = state.choiceLists[0];
+ }
+ this.choiceList = state.choiceList;
+};
+
+exports.Symbol.prototype.parse = function parse(state) {
+ if(this.regexp) {
+ var match = this.regexp.exec(state.text.substr(state.offset));
+ if(!match)
+ return false;
+ state.offset += match[0].length;
+ if(this.proc)
+ return this.proc(match);
+ return match;
+ }
+ if(this.choiceList) {
+ var match = this.choiceList.parse(state);
+ if(match === false)
+ return false;
+ if(this.proc)
+ return this.proc(match);
+ return match;
+ }
+};
+
+exports.Symbol.prototype.fixSymbols = function fixSymbols(symbols) {
+ if(this.choiceList)
+ this.choiceList.fixSymbols(symbols);
+};
+
+exports.Choice = function Choice(obj, min, max) {
+ this.obj = obj;
+ this.min = min;
+ this.max = max;
+};
+
+exports.Choice.prototype.parse = function parse(state) {
+ var matches = [], oldOffset = state.offset;
+ while(matches.length < this.max) {
+ var match = this.obj.parse(state);
+ if(match === false)
+ break;
+ matches.push(match);
+ }
+ if(matches.length < this.min) {
+ state.offset = oldOffset;
+ return false;
+ }
+
+ // Let's not make X? return [X] but X or null
+ if(this.min === 0 && this.max === 1)
+ return matches[0] || null;
+ return matches;
+};
+
+exports.Choice.prototype.fixSymbols = function fixSymbols(symbols) {
+ if(this.obj.fixSymbol) {
+ if(this.obj.fixSymbol == " ") {
+ this.obj = symbols[" "].symbol;
+ this.ignore = symbols[" "].ignore;
+ if(this.min === -Infinity && this.max === Infinity) {
+ this.min = symbols[" "].min;
+ this.max = symbols[" "].max;
+ }
+ } else
+ this.obj = symbols[this.obj.fixSymbol];
+ } else
+ this.obj.fixSymbols(symbols);
+};
+
+exports.ChoiceList = function ChoiceList(parallel) {
+ this.parallel = !!parallel;
+};
+
+exports.ChoiceList.prototype = [];
+
+exports.ChoiceList.prototype.parse = function parse(state) {
+ if(this.parallel) {
+ var match = false;
+ for(var i = 0; i < this.length; i++)
+ if((match = this[i].parse(state)) !== false)
+ return match;
+ return false;
+ }
+
+ var matches = [], oldOffset = state.offset;
+ for(var i = 0; i < this.length; i++) {
+ var match = this[i].parse(state);
+ if(match === false) {
+ state.offset = oldOffset;
+ return false;
+ }
+ if(!this[i].ignore)
+ matches.push(match);
+ }
+ return matches;
+};
+
+exports.ChoiceList.prototype.fixSymbols = function fixSymbols(symbols) {
+ for(var i = 0; i < this.length; i++) {
+ if(this[i].fixSymbol)
+ this[i] = symbols[this[i].fixSymbol];
+ else
+ this[i].fixSymbols(symbols);
+ }
+};
+
+exports; // TODO: Remove this later when it becomes a module
View
0  gear2cc/driver_v8.js_ → gear2cc/_jscc_deprecated/driver_v8.js_
File renamed without changes
View
2,066 gear2cc/_jscc_deprecated/gear2cc.js
2,066 additions, 0 deletions not shown
View
0  gear2cc/gear2cc.par → gear2cc/_jscc_deprecated/gear2cc.par
File renamed without changes
View
0  gear2cc/jscc.js → gear2cc/_jscc_deprecated/jscc.js
File renamed without changes
View
164 gear2cc/aze2js.js
@@ -0,0 +1,164 @@
+if(arguments.length <= 2)
+ exit(print('Usage: '+arguments[0]+' <Codeaze source file> <JavaScript output file>'));
+
+var sourceFile = arguments[1], outputFile = arguments[2];
+
+var Io = require('Io');
+var source = Io.read(sourceFile), output = 'try {var codeaze = load("Codeaze.js");}catch(e){var codeaze = load("gear2cc/Codeaze.js");} /** @todo require("./Codeaze.js") */\nvar $aze = new codeaze.Codeaze();\n\n';
+
+function scanRegExp(flags) {
+ var regexp = '/';
+ for(i++; i < source.length; i++) {
+ regexp += source[i]
+ if(source[i] == '/')
+ break;
+ if(source[i] == '[')
+ for(i++; i < source.length; i++) {
+ regexp += source[i];
+ if(source[i] == ']')
+ break;
+ if(source[i] == '\\' && source[i+1] == ']')
+ regexp += source[++i];
+ }
+ if(source[i] == '\\')
+ regexp += source[++i];
+ }
+ if(flags) {
+ for(i++; i < source.length && /\w/.test(source[i]); i++)
+ regexp += source[i];
+ i--;
+ }
+ return regexp;
+}
+
+function scanPattern() {
+ var pattern = '';
+ for(i++; i < source.length; i++) {
+ if(source[i] == '/') {
+ pattern += scanRegExp();
+ continue;
+ }
+ if(source[i] == '`')
+ break;
+ pattern += source[i];
+ }
+ return "'"+pattern.replace(/(['\\])/g, '\\$1')+"'";
+}
+
+function scanCode() {
+ var code = '', depth = 0;
+ for(i++; i < source.length; i++) {
+ if(source[i] == '}')
+ depth--;
+ if(depth < 0)
+ break;
+
+ // Single line comments
+ if(source[i] == '/' && source[i+1] == '/') {
+ for(; i < source.length-1 && source[i] != '\n'; i++)
+ code += source[i];
+ code += source[i];
+ continue;
+ }
+ // Multi line comments
+ if(source[i] == '/' && source[i+1] == '*') {
+ code += source[i++];
+ for(; i < source.length-1 && !(source[i] == '*' && source[i+1] == '/'); i++)
+ code += source[i];
+ code += source[i];
+ code += source[++i];
+ continue;
+ }
+
+ // RegExps
+ if(source[i] == '/' && !/(\w|\))\s*$/.test(source)) {
+ code += scanRegExp(true);
+ continue;
+ }
+
+ code += source[i];
+
+ if(source[i] == '{')
+ depth++;
+
+ // Single quote strings
+ if(source[i] == "'") {
+ for(i++; i < source.length; i++) {
+ code += source[i];
+ if(source[i] == "'" || source[i] == '\n')
+ break;
+ if(source[i] == '\\')
+ code += source[++i];
+ }
+ continue;
+ }
+ // Double quote strings
+ if(source[i] == '"') {
+ for(i++; i < source.length; i++) {
+ code += source[i];
+ if(source[i] == '"')
+ break;
+ if(source[i] == '\\')
+ code += source[++i];
+ }
+ continue;
+ }
+ }
+ return code;
+}
+
+for(var i = 0; i < source.length; i++) {
+ var c = source[i];
+
+ // Any kinds of space
+ if(/\s/.test(c)) {
+ for(i++; i < source.length && /\s/.test(source[i]); i++);
+ i--;
+ continue;
+ }
+
+ // JavaScript code
+ if(c == '{') {
+ output += scanCode().replace(/^ /gm,'');
+ continue;
+ }
+
+ // Rule definition
+ if(/[a-zA-Z_]/.test(c)) {
+ var ruleName = c, pattern, proc = '';
+ for(i++; i < source.length && /\w/.test(source[i]); i++)
+ ruleName += source[i];
+ for(; i < source.length && /\s/.test(source[i]); i++);
+ if(source[i] != ':')
+ throw new Error('Expected : after rule indentifier, got \''+source[i]+'\'');
+ for(i++; i < source.length && /\s/.test(source[i]); i++);
+ if(source[i] == '/')
+ pattern = scanRegExp();
+ else if(source[i] == '`')
+ pattern = scanPattern();
+ else
+ throw new Error('Expected ` or / after :, got \''+source[i]+'\'');
+ for(i++; i < source.length && /\s/.test(source[i]); i++);
+ if(source[i] == '{') {
+ proc = ', function($){var $$;'+scanCode().replace(/\$(\d+)/g, '$[$1]').replace(/([^;])$/, '$1;')+'return $$;}';
+ i++;
+ }
+ for(; i < source.length && /\s/.test(source[i]); i++);
+ if(source[i] != ';')
+ throw new Error('Expected ; after rule declaration, got \''+source[i]+'\'');
+ output += '$aze.symbols.'+ruleName+' = new codeaze.Symbol('+pattern+proc+');\n';
+ continue;
+ }
+
+ // Parallel choices
+ /*if(c == '|') {
+ if(!state.choiceLists.length || !state.choiceLists[state.choiceLists.length - 1].parallel)
+ state.choiceLists.push(new exports.ChoiceList(true));
+ state.choiceLists[state.choiceLists.length - 1].push(state.choiceList);
+ state.choiceList = new exports.ChoiceList();
+ continue;
+ }*/
+ throw new Error('Unrecognized token \'' + c + '\' in "' + source + '"');
+}
+
+Io.write(outputFile, output);
View
347 gear2cc/gear2cc.aze
@@ -0,0 +1,347 @@
+{
+ function createClass(name, childs, line, inheritList) {
+ var out = {type:'class', name:name, inheritList:inheritList, classes:{}, vars:{}, staticVars:{}, functions:{}, staticFunctions:{}, accessors:{}};
+ for(c in childs) {
+ var node = childs[c];
+ switch(node.type) {
+ case 'class':
+ out.classes[node.name] = {classes:node.classes, vars:node.vars, staticVars:node.staticVars, functions:node.functions, staticFunctions:node.staticFunctions, accessors:node.accessors};
+ break;
+ case 'function':
+ if(!out.functions[node.name])
+ out.functions[node.name] = [{args:node.args, code:node.code, line:node.line}];
+ else
+ out.functions[node.name].push({args:node.args, code:node.code, line:node.line});
+ break;
+ case 'static-function':
+ if(!out.staticFunctions[node.name])
+ out.staticFunctions[node.name] = [{args:node.args, code:node.code, line:node.line}];
+ else
+ out.staticFunctions[node.name].push({args:node.args, code:node.code, line:node.line});
+ break;
+ case 'var':
+ out.vars[node.name] = {val:node.val};
+ break;
+ case 'static-var':
+ out.staticVars[node.name] = {val:node.val};
+ break;
+ case 'getter':
+ if(!out.accessors[node.name])
+ out.accessors[node.name] = {};
+ out.accessors[node.name].getter = {args:node.args, code:node.code, line:node.line};
+ break;
+ case 'setter':
+ if(!out.accessors[node.name])
+ out.accessors[node.name] = {};
+ out.accessors[node.name].setter = {args:node.args, code:node.code, line:node.line};
+ break;
+ case 'native-block':
+ throw Error('TODO: Native blocks in classes');
+ }
+ }
+
+ if(!out.functions.hasOwnProperty(name))
+ out.functions[name] = [{args:[], code:'', line:line}];
+
+ return out;
+ }
+
+ function createObject(name, childs, line, isModule) {
+ var out = {type:isModule?'module':'object', name:name, objects:{}, modules:{}, classes:{}, vars:{}, functions:{}, header:'', top:'', license:'', postSetup:''};
+ for(c in childs) {
+ var node = childs[c];
+ switch(node.type) {
+ case 'object':
+ out.objects[node.name] = {objects:node.objects, classes:node.classes, vars:node.vars, functions:node.functions, header:node.header};
+ break;
+ case 'module':
+ out.modules[node.name] = {objects:node.objects, classes:node.classes, vars:node.vars, functions:node.functions, header:node.header, postSetup:node.postSetup};
+ break;
+ case 'class':
+ if(node.inheritList) {
+ var baseNode = {classes:{}, vars:{}, staticVars:{}, functions:{}, staticFunctions:{}, accessors:{}};
+ function extend(x, nn) {
+ for(var j in x)
+ if(j in baseNode)
+ for(var k in x[j])
+ if(!(j == 'functions' && k == nn))
+ baseNode[j][k] = x[j][k];
+ }
+ for(var i = 0; i < node.inheritList.length; i++)
+ extend(out.classes[node.inheritList[i]], node.inheritList[i]);
+ extend(node);
+ out.classes[node.name] = baseNode;
+ }
+ else
+ out.classes[node.name] = {classes:node.classes, vars:node.vars, staticVars:node.staticVars, functions:node.functions, staticFunctions:node.staticFunctions, accessors:node.accessors};
+ break;
+ case 'function':
+ if(!out.functions.hasOwnProperty(node.name))
+ out.functions[node.name] = [{args:node.args, code:node.code, line:node.line}];
+ else
+ out.functions[node.name].push({args:node.args, code:node.code, line:node.line});
+ break;
+ case 'var':
+ out.vars[node.name] = {val:node.val};
+ break;
+ case 'native-block':
+ if(node.which == 'header')
+ out.header += node.code + '\n';
+ else if(node.which == 'top')
+ out.top += node.code + '\n';
+ else if(node.which == 'license')
+ out.license += node.code + '\n';
+ else if(isModule && node.which == 'postSetup')
+ out.postSetup += node.code + '\n';
+ else
+ throw Error('TODO: Native block `' + node.which + '`');
+ }
+ }
+
+ if(!out.functions.hasOwnProperty('toString'))
+ out.functions['toString'] = [{args:[], code:'return String("['+(isModule?'module':'object')+' '+name+']");', line:line}];
+
+ return out;
+ }
+
+ function nLines(s){return s.replace(/[^\n]/g,'').length;}
+ function nCols(s){return s.replace(/^(.*\n)+/,'').length;}
+
+ function sum(a,b) {
+ return a+b;
+ }
+
+ var l = 1;
+}
+space: `/\s/|/\/\*.*?\*\//` {l+=nLines($0[0]);$$=$0[0]};
+l: /(?:)/ {$$=l};
+identifier: /~?[A-Za-z_]\w*/ {$$=$0};
+identifierList: `(identifier( /,/ identifier)*)?` {$$=$0?[$0[0]].concat($0[1].map(function(x){return x[3]})):[]};
+
+bulkCode: /[^;{}()]+/ {l+=nLines($0);$$=$0};
+nativeCodeInline: `(bulkCode|/\(/nativeCodeInline/\)/)*` {$$=$0.map(function(x){return x.length>1?x[0][0]+x[1]+x[2][0]:x[0]}).reduce(sum,'')};
+nativeCode: `(bulkCode|/;/|/{/nativeCode/}/|/\(/nativeCode/\)/)*` {$$=$0.map(function(x){return x.length>1?x[0][0]+x[1]+x[2][0]:(x[0][0]==';'?';':x[0])}).reduce(sum,'')};
+
+module: `l/module/ +identifier /{/ objectContents /}/` {$$=createObject($3, $7, $0, true)};
+object: `l/object/ +identifier /{/ objectContents /}/` {$$=createObject($3, $7, $0, false)};
+class: `l/class/ +identifier( /:/ identifierList)? /{/ objectContents /}/` {$$=createClass($3, $8, $0, $4&&$4[3])};
+variableDef: `l(/static/ )?/var/ +identifier /=/ nativeCodeInline /;/` {$$={type:$1?'static-var':'var', name:$4, val:$8}};
+function: `l(/static/ )?/function/ +identifier /\(/ identifierList /\)/ /{/nativeCode/}/` {$$={type:$1?'static-function':'function', name:$4, args:$8, code:$13, line:$0}};
+getter: `l/get/ +identifier /\(/ /\)/ /{/nativeCode/}/` {$$={type:'getter', name:$3, args:[], code:$10, line:$0}};
+setter: `l/set/ +identifier /\(/ identifier /\)/ /{/nativeCode/}/` {$$={type:'setter', name:$3, args:[$7], code:$12, line:$0}};
+nativeBlock: `l,identifier /{/nativeCode/}/` {$$={type:'native-block', which:$1, code:$4, line:$0}};
+
+objectContents: `( +|object|class|variableDef|function|getter|setter|nativeBlock)*` {$$=$0.map(function(x){return x[0]}).filter(function(x){return !x.length})};
+main: `( +|module|nativeBlock)*` {$$=$0.map(function(x){return x[0]}).filter(function(x){return !x.length})};
+
+{
+
+ function makeTabs(n, ch) {
+ var s = '';
+ for(var i = 0; i < n; i++)
+ s += ch;
+ return s;
+ }
+
+ function makeLine(tbs, line) {
+ return '\n' + tbs + '#line ' + line + ' "' + gear.gear + '"';
+ }
+
+ var lineNumber = 1;
+ function generateFunctionCode(functions, name, parentPrefix, parentPath, code, _class, ctor, dest) {
+ var prefix = parentPrefix + '_' + name, path = parentPath + '["' + name + '"]', replaces = [], funcCode = '', hasNoArgsVer = false;
+ functions.sort(function(a, b) {return b.args.length - a.args.length;});
+ for(f in functions) {
+ var func = functions[f], replaces = [], tbs = (!dest && func.args.length ? '\t\t' : '\t');
+ var actualCode = '\n' + tbs + func.code.trim() + '\n';
+
+ var argsLine = '';
+ if(dest=='setter')
+ argsLine = func.args[0]+'(_'+func.args[0]+')';
+ else
+ for(var _arg in func.args)
+ argsLine += (argsLine ? ', ' : '') + func.args[_arg] + '(args[' + _arg + '])';
+ if(argsLine)
+ actualCode = makeLine(tbs, func.line) + '\n' + tbs + 'Value ' + argsLine + ';' + actualCode;
+ else
+ actualCode = makeLine(tbs, func.line + 1) + actualCode;
+
+ replaces.push({regex:'\n' + makeTabs(prefix.split('_').length-1, ' '), replace:'\n' + tbs});
+ if(dest!='setter')
+ replaces.push({regex:'\\breturn\\b\\s*;', replace:'return undefined;'});
+ replaces.push({regex:'\\bthis\\b', replace:'This'});
+
+ for(r in replaces) {
+ var replace = replaces[r];
+ actualCode = actualCode.replace(new RegExp(replace.regex, 'g'), replace.replace);
+ }
+ if(dest!='setter' && !RegExp('\n'+tbs+'\\breturn\\b[^;]*;\\s*$').exec(actualCode))
+ actualCode += tbs + 'return undefined;\n';
+
+ if(!dest && func.args.length)
+ funcCode += '\n\tif(args.Length() >= ' + func.args.length + ') {' + actualCode + '\t}\n';
+ else {
+ funcCode += actualCode;
+ hasNoArgsVer = true;
+ }
+ }
+
+ if(_class)
+ funcCode = '\n\tValue This(args.This());'+funcCode;
+
+ if(!hasNoArgsVer)
+ funcCode += '\tTHROW_ERROR("Invalid call to ' + parentPrefix.replace(/_/g, '.').replace(/^\./, '') + (ctor ? '' : (_class?'.prototype':'') + '.' + name) + '");\n';
+ if(dest=='getter')
+ code.func += 'static v8::Handle<v8::Value> ' + prefix + '(v8::Local<v8::String>, const v8::AccessorInfo &args) {' + funcCode + '}\n\n';
+ else if(dest=='setter')
+ code.func += 'static void ' + prefix + '(v8::Local<v8::String>, v8::Local<v8::Value> _'+func.args[0]+', const v8::AccessorInfo &args) {' + funcCode + '}\n\n';
+ else
+ code.func += 'static v8::Handle<v8::Value> ' + prefix + '(const v8::Arguments &args) {' + funcCode + '}\n\n';
+ }
+
+ function generateClassCode(_class, name, parentPrefix, parentPath, code) {
+ var prefix = parentPrefix + '_' + name, path = parentPath + '["' + name + '"]';
+
+ code.addClass(prefix, name);
+
+ for(funcName in _class.functions) {
+ if(funcName != name)
+ code.setPrototype(prefix, funcName, code.makeFunction(prefix + '_' + funcName, funcName));
+ generateFunctionCode(_class.functions[funcName], funcName, prefix, prefix, code, _class, funcName == name);
+ }
+
+ for(accName in _class.accessors) {
+ if(!_class.accessors[accName].getter)
+ throw new Error('No getter');
+ generateFunctionCode([_class.accessors[accName].getter], accName, prefix, prefix, code, _class, false, 'getter');
+ if(_class.accessors[accName].setter)
+ generateFunctionCode([_class.accessors[accName].setter], accName, prefix, prefix, code, _class, false, 'setter');
+ code.setPrototypeAccessor(prefix, accName, prefix + '_' + accName, !!_class.accessors[accName].setter);
+ }
+
+ for(varName in _class.vars) {
+ var val = _class.vars[varName].val;
+ code.setPrototype(prefix, varName, /^\s*\b[A-Z]\w+\b\(.+\)$/.test(val) ? val : 'Value(' + val + ')');
+ }
+
+ code.setStatic(parentPath, name, prefix + '->GetFunction()');
+
+ for(className in _class.classes)
+ generateClassCode(_class.classes[className], className, prefix, path, code);
+ for(varName in _class.staticVars) {
+ var val = _class.staticVars[varName].val;
+ code.setStatic(path, varName, /^\s*\b[A-Z]\w+\b\(.+\)$/.test(val) ? val : 'Value(' + val + ')');
+ }
+ for(funcName in _class.staticFunctions) {
+ code.setStatic(path, funcName, code.makeFunction(prefix + '_' + funcName, funcName));
+ generateFunctionCode(_class.staticFunctions[funcName], funcName, prefix, path, code);
+ }
+ }
+
+ function generateObjectCode(object, name, parentPrefix, parentPath, code) {
+ var prefix = parentPrefix + '_' + name, path = parentPath + '["' + name + '"]';
+
+ for(className in object.classes)
+ generateClassCode(object.classes[className], className, prefix, path, code);
+
+ for(funcName in object.functions) {
+ code.setStatic(path, funcName, code.makeFunction(prefix + '_' + funcName, funcName));
+ generateFunctionCode(object.functions[funcName], funcName, prefix, path, code);
+ }
+
+ for(varName in object.vars) {
+ var val = object.vars[varName].val;
+ code.setStatic(path, varName, /^\s*\b[A-Z]\w+\b\(.+\)$/.test(val) ? val : 'Value(' + val + ')');
+ }
+ }
+
+ function generateModuleCode(object, name, parentPrefix, parentPath, code) {
+ var prefix = parentPrefix + '_' + name, path = parentPath;
+
+ for(className in object.classes)
+ generateClassCode(object.classes[className], className, prefix, path, code);
+
+ for(funcName in object.functions) {
+ code.setStatic(path, funcName, code.makeFunction(prefix + '_' + funcName, funcName));
+ generateFunctionCode(object.functions[funcName], funcName, prefix, path, code);
+ }
+
+ for(varName in object.vars) {
+ var val = object.vars[varName].val;
+ code.setStatic(path, varName, /^\s*\b[A-Z]\w+\b\(.+\)$/.test(val) ? val : 'Value(' + val + ')');
+ }
+
+ if(object.postSetup)
+ code.init += object.postSetup;
+ }
+
+ function generateCode(global) {
+ var code = {
+ func:'', init:'',
+ addObject: function(path) {
+ this.init += '\tvar ' + path + ' = Object();\n';
+ },
+ addClass: function(objName, ctor) {
+ this.init += '\tv8::Handle<v8::FunctionTemplate> ' + objName + ' = v8::FunctionTemplate::New(' + objName + '_' + ctor + ');\n';
+ this.init += '\t' + objName + '->SetClassName(String("' + ctor + '"));\n';
+ },
+ makeFunction: function(prefix, name) {
+ return 'Function(' + prefix + ', "' + name + '")';
+ },
+ setStatic: function(parentObjName, name, value) {
+ this.init += '\t' + parentObjName + '["' + name + '"] = ' + value + ';\n';
+ },
+ setPrototype: function(parentObjName, name, value) {
+ this.init += '\t' + parentObjName + '->PrototypeTemplate()->Set("' + name + '", ' + value + ');\n';
+ },
+ setPrototypeAccessor: function(parentObjName, name, getter, setter) {
+ this.init += '\t' + parentObjName + '->PrototypeTemplate()->SetAccessor(String("' + name + '"), ' + getter + (setter?', '+getter:'') + ');\n';
+ },
+ };
+
+ var modules = Object.keys(global.modules);
+
+ if(!modules.length)
+ throw Error('No modules');
+ else if(modules.length > 1)
+ throw Error('More than one module');
+ else {
+ var moduleName = modules[0], module = global.modules[moduleName];
+ generateModuleCode(module, moduleName, '', '_exports', code);
+
+ var license = global.license.trim().replace(/\n /g, '\n') + (global.license.trim()?'\n\n':'\n'),
+ top = global.top.trim().replace(/\n /g, '\n') + (global.top.trim()?'\n\n':'\n'),
+ header = global.header.trim().replace(/\n /g, '\n') + (global.header.trim()?'\n\n':'\n');
+ var ccCode = license+'\
+ #include <v8-gearbox.h>\n\
+ #include "'+baseName+'.h"\n\
+ \n\
+ using namespace Gearbox;\n\
+ \n\
+ /** \\file '+baseName+'.cc converted from '+baseName+'.gear */\n'+
+ makeLine('',1) + '\n' + top + code.func;
+
+ ccCode += makeLine('',nLines(ccCode)+2).replace('.gear','.cc') + '\nstatic void _setup_' + moduleName + '(Value _exports) {\n' + code.init + '}\nstatic Module _module_' + moduleName + '("'+moduleName+'", _setup_' + moduleName + ');';
+ ccCode = ccCode.replace(/\t/g, ' ');
+ io.write(gear.cc, ccCode);
+
+ var hCode = license+'\
+ #ifndef V8_GEARBOX_MODULES_'+baseName.toUpperCase()+'_H\n\
+ #define V8_GEARBOX_MODULES_'+baseName.toUpperCase()+'_H\n\n\
+ #include <v8-gearbox.h>\n\n'+header+
+ //void Setup'+baseName+'(v8::Handle<v8::Object> global);\n\n\
+ '#endif\n';
+ io.write(gear.h, hCode);
+ }
+ }
+
+ $aze.spaceIgnore = false;
+ var io = require('Io');
+ var lastSlash = arguments[1].lastIndexOf('/')+1, baseDir = arguments[1].substr(0, lastSlash), baseName = arguments[1].substr(lastSlash).replace(/\.gear$/, '');
+ var gear = {gear:baseDir+baseName+'.gear', cc:baseDir+baseName+'.cc', h:baseDir+baseName+'.h'};
+ if(arguments.length == 2)
+ generateCode(createObject('', $aze.parse(io.read(gear.gear)), 1));
+ else
+ print('Usage: ' + arguments[0] + ' <file>');
+ exit(); // Just in case v8-gearbox is a (bit) broken
+}
View
1,934 gear2cc/gear2cc.js
106 additions, 1,828 deletions not shown
View
8 src/SConscript
@@ -12,7 +12,7 @@ gearboxSources = [
# Invocation of gear2cc in case gearbox exists
if env['GEARBOX_EXISTS'] and not env['USING_CROSSMINGW']:
# Make sure we have gear2cc built
- gear2cc = env.JsCC('#gear2cc/gear2cc.js', '#gear2cc/gear2cc.par')
+ gear2cc = env.Aze2JS('#gear2cc/gear2cc.js', '#gear2cc/gear2cc.aze')
# Build all gear files
for gearFile in Glob('modules/*.gear', strings=True):
@@ -20,7 +20,9 @@ if env['GEARBOX_EXISTS'] and not env['USING_CROSSMINGW']:
gear = env.Gear2CC(['#src/'+gearBase+'.cc', '#src/'+gearBase+'.h'], gearFile)
env.Depends(gear, gear2cc)
env.Precious(gear)
- gearboxSources += Glob(gearBase+'.cc')
+ gear_cc = Glob(gearBase+'.cc')
+ gearboxSources += gear_cc
+ env.Depends(gear_cc, gear) # FIXME Fails to work
else:
gearboxSources += Glob('modules/*.cc')
@@ -32,4 +34,4 @@ env.Default(gearbox)
# Install target (not on windows or cross mingw)
if sys.platform != 'win32' and not env['USING_CROSSMINGW']:
install = env.Install('/usr/bin', gearbox)
- env.Alias('install', install)
+ env.Alias('install', install)
View
376 src/modules/Elm.gear
@@ -47,115 +47,115 @@ module Elm {
class EvasObject {
- getter x() {
+ get x() {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
return Number(x);
}
- setter x(_x) {
+ set x(_x) {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
evas_object_move(this["eo"], _x, y);
}
- getter y() {
+ get y() {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
return Number(y);
}
- setter y(_y) {
+ set y(_y) {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
evas_object_move(this["eo"], x, _y);
}
- getter height() {
+ get height() {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
return Number(height);
}
- setter height(_height) {
+ set height(_height) {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
evas_object_resize(this["eo"], width, _height);
}
- getter width() {
+ get width() {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
return Number(width);
}
- setter width(_width) {
+ set width(_width) {
Evas_Coord x, y, width, height;
evas_object_geometry_get(this["eo"], &x, &y, &width, &height);
evas_object_resize(this["eo"], _width, height);
}
- getter label() {
+ get label() {
return String(elm_object_text_get(this["eo"]));
}
- setter label(label) {
+ set label(label) {
elm_object_text_set(this["eo"], label.to<String>());
}
- getter text() {
+ get text() {
return String(elm_object_text_get(this["eo"]));
}
- setter text(text) {
+ set text(text) {
elm_object_text_set(this["eo"], text.to<String>());
}
- getter scale() {
+ get scale() {
return Number(elm_object_scale_get(this["eo"]));
}
- setter scale(scale) {
+ set scale(scale) {
elm_object_scale_set(this["eo"], scale);
}
- getter xalign() {
+ get xalign() {
double x, y;
evas_object_size_hint_align_get(this["eo"], &x, &y);
return Number(x);
}
- setter xalign(_x) {
+ set xalign(_x) {
double x, y;
evas_object_size_hint_align_get(this["eo"], &x, &y);
evas_object_size_hint_align_set(this["eo"], _x, y);
}
- getter yalign() {
+ get yalign() {
double x, y;
evas_object_size_hint_align_get(this["eo"], &x, &y);
return Number(y);
}
- setter yalign(_y) {
+ set yalign(_y) {
double x, y;
evas_object_size_hint_align_get(this["eo"], &x, &y);
evas_object_size_hint_align_set(this["eo"], x, _y);
}
- getter style() {
+ get style() {
return String(elm_object_style_get(this["eo"]));
}
- setter style(style) {
+ set style(style) {
elm_object_style_set(this["eo"], style.to<String>());
}
- getter visible() {
+ get visible() {
return Value(evas_object_visible_get(this["eo"]));
}
- setter visible(visible) {
+ set visible(visible) {
if(visible)
evas_object_show(this["eo"]);
else
@@ -176,20 +176,20 @@ module Elm {
evas_object_resize(this["eo"], width, height);
}
- getter title() {
+ get title() {
return String(elm_win_title_get(this["eo"]));
}
- setter title(title) {
+ set title(title) {
elm_win_title_set(this["eo"], title.to<String>());
}
- getter autodel() {
+ get autodel() {
bool _autodel = elm_win_autodel_get(this["eo"]);
return Value(_autodel);
}
- setter autodel(_autodel) {
+ set autodel(_autodel) {
elm_win_autodel_set(this["eo"], _autodel);
}
@@ -205,69 +205,69 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter red() {
+ get red() {
int r;
elm_bg_color_get(this["eo"], &r, NULL, NULL);
return Integer(r);
}
- setter red(_r) {
+ set red(_r) {
int r, g, b;
elm_bg_color_get(this["eo"], &r, &g, &b);
elm_bg_color_set(this["eo"], _r, g, b);
}
- getter green() {
+ get green() {
int g;
elm_bg_color_get(this["eo"], NULL, &g, NULL);
return Integer(g);
}
- setter green(_g) {
+ set green(_g) {
int r, g, b;
elm_bg_color_get(this["eo"], &r, &g, &b);
elm_bg_color_set(this["eo"], r, _g, b);
}
- getter blue() {
+ get blue() {
int b;
elm_bg_color_get(this["eo"], NULL, NULL, &b);
return Integer(b);
}
- setter blue(_b) {
+ set blue(_b) {
int r, g, b;
elm_bg_color_get(this["eo"], &r, &g, &b);
elm_bg_color_set(this["eo"], r, g, _b);
}
- getter file() {
+ get file() {
const char *file, *group;
elm_bg_file_get(this["eo"], &file, &group);
return String(file);
}
- setter file(file) {
+ set file(file) {
elm_bg_file_set(this["eo"], file.to<String>(), NULL);
}
- getter group() {
+ get group() {
const char *file, *group;
elm_bg_file_get(this["eo"], &file, &group);
return String(group);
}
- setter group(group) {
+ set group(group) {
elm_bg_file_set(this["eo"], NULL, group.to<String>());
}
- getter bgOption() {
+ get bgOption() {
int option;
option = elm_bg_option_get(this["eo"]);
return Integer(option);
}
- setter bgOption(_option) {
+ set bgOption(_option) {
Elm_Bg_Option _opt = (Elm_Bg_Option)(_option.to<int>());
elm_bg_option_set(this["eo"], _opt);
}
@@ -284,19 +284,19 @@ module Elm {
elm_box_pack_end(this["eo"], child["eo"]);
}
- getter homogenous() {
+ get homogenous() {
return Value(elm_box_homogeneous_get(this["eo"]));
}
- setter homogenous(homogenous) {
+ set homogenous(homogenous) {
elm_box_homogeneous_set(this["eo"], homogenous);
}
- getter horizontal() {
+ get horizontal() {
return Value(elm_box_horizontal_get(this["eo"]));
}
- setter horizontal(horizontal) {
+ set horizontal(horizontal) {
elm_box_horizontal_set(this["eo"], horizontal);
}
@@ -309,85 +309,85 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter file() {
+ get file() {
const char *file, *group;
elm_icon_file_get(this["eo"], &file, &group);
return String(file);
}
- setter file(file) {
+ set file(file) {
elm_icon_file_set(this["eo"], file.to<String>(), NULL);
}
- getter scaleDown() {
+ get scaleDown() {
Eina_Bool sd, su;
elm_icon_scale_get(this["eo"], &su, &sd);
return Integer(sd);
}
- setter scaleDown(_sd) {
+ set scaleDown(_sd) {
Eina_Bool sd, su;
elm_icon_scale_get(this["eo"], &su, &sd);
elm_icon_scale_set(this["eo"], su, _sd);
}
- getter scaleUp() {
+ get scaleUp() {
Eina_Bool sd, su;
elm_icon_scale_get(this["eo"], &su, &sd);
return Integer(su);
}
- setter scaleUp(_su) {
+ set scaleUp(_su) {
Eina_Bool sd, su;
elm_icon_scale_get(this["eo"], &su, &sd);
elm_icon_scale_set(this["eo"], _su, sd);
}
- getter prescale() {
+ get prescale() {
return Integer(elm_icon_prescale_get(this["eo"]));
}
- setter prescale(_arit) {
+ set prescale(_arit) {
elm_icon_prescale_set(this["eo"], _arit);
}
- getter animated() {
+ get animated() {
return Integer(elm_icon_animated_get(this["eo"]));
}
- setter animated(_anim) {
+ set animated(_anim) {
elm_icon_animated_set(this["eo"], _anim);
}
- getter animPlay() {
+ get animPlay() {
return Integer(elm_icon_animated_play_get(this["eo"]));
}
- setter animPlay(_ap) {
+ set animPlay(_ap) {
elm_icon_animated_play_set(this["eo"], _ap);
}
- getter smooth() {
+ get smooth() {
return Integer(elm_icon_smooth_get(this["eo"]));
}
- setter smooth(_smooth) {
+ set smooth(_smooth) {
elm_icon_smooth_set(this["eo"], _smooth);
}
- getter standard() {
+ get standard() {
return String(elm_icon_standard_get(this["eo"]));
}
- setter standard(_std) {
+ set standard(_std) {
elm_icon_standard_set(this["eo"],_std);
}
- getter fillOutside() {
+ get fillOutside() {
return Integer(elm_icon_fill_outside_get(this["eo"]));
}
- setter fillOutside(_fo) {
+ set fillOutside(_fo) {
elm_icon_fill_outside_set(this["eo"], _fo);
}
@@ -400,39 +400,39 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter autorepeat() {
+ get autorepeat() {
bool autorepeat = elm_button_autorepeat_get(this["eo"]);
return Integer(autorepeat);
}
- setter autorepeat(autorepeat) {
+ set autorepeat(autorepeat) {
elm_button_autorepeat_set(this["eo"], autorepeat);
}
- getter autorepeatInitTimeout() {
+ get autorepeatInitTimeout() {
double arit = elm_button_autorepeat_initial_timeout_get(this["eo"]);
return Number(arit);
}
- setter autorepeatInitTimeout(_arit) {
+ set autorepeatInitTimeout(_arit) {
elm_button_autorepeat_initial_timeout_set(this["eo"], _arit);
}
- getter autorepeatGapTimeout() {
+ get autorepeatGapTimeout() {
double argt = elm_button_autorepeat_gap_timeout_get(this["eo"]);
return Number(argt);
}
- setter autorepeatGapTimeout(_argt) {
+ set autorepeatGapTimeout(_argt) {
elm_button_autorepeat_gap_timeout_set(this["eo"], _argt);
}
- setter onClick(arg) {
+ set onClick(arg) {
this["_onClick"] = arg;
evas_object_smart_callback_add(this["eo"], "clicked", elmOnClick, new Value(this));
}
- getter onClick() {
+ get onClick() {
return this["_onClick"];
}
}
@@ -444,31 +444,31 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter group() {
+ get group() {
// TODO : Not implemented in EFL
//elm_radio_group_get(this["eo"]);
return this["eo"];
}
- setter group(group) {
+ set group(group) {
elm_radio_group_add(this["eo"], group["eo"]);
}
- getter state() {
+ get state() {
int state = elm_radio_state_value_get(this["eo"]);
return Integer(state);
}
- setter state(_state) {
+ set state(_state) {
elm_radio_state_value_set(this["eo"], _state);
}
- getter value() {
+ get value() {
int value = elm_radio_value_get(this["eo"]);
return Integer(value);
}
- setter value(_value) {
+ set value(_value) {
elm_radio_value_set(this["eo"], _value);
}
@@ -481,61 +481,61 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter wrap() {
+ get wrap() {
int wrap = elm_label_line_wrap_get (this["eo"]);
return Integer(wrap);
}
- setter wrap(_wrap) {
+ set wrap(_wrap) {
Elm_Wrap_Type _wt = (Elm_Wrap_Type)(_wrap.to<int>());
elm_label_line_wrap_set(this["eo"], _wt);
}
- getter wrapWidth() {
+ get wrapWidth() {
Evas_Coord w = elm_label_wrap_width_get (this["eo"]);
return Integer(w);
}
- setter wrapWidth(_wrap) {
+ set wrapWidth(_wrap) {
elm_label_wrap_width_set(this["eo"], (Evas_Coord)(_wrap));
}
- getter wrapHeight() {
+ get wrapHeight() {
Evas_Coord h = elm_label_wrap_height_get (this["eo"]);
return Integer(h);
}
- setter wrapHeight(_height) {
+ set wrapHeight(_height) {
elm_label_wrap_height_set(this["eo"], (Evas_Coord)(_height));
}
- getter fontSize() {
+ get fontSize() {
int fs = 0;
// TODO : Not implemented in EFL
//elm_label_fontsize_get(this["eo"], &fs);
return Integer(fs);
}
- setter fontSize(_fs) {
+ set fontSize(_fs) {
elm_label_fontsize_set(this["eo"], _fs);
}
- getter textAlign() {
+ get textAlign() {
// TODO : Not implemented in EFL
return String("center");
}
- setter textAlign(_align) {
+ set textAlign(_align) {
elm_label_text_align_set(this["eo"],_align);
}
- getter ellipsis() {
+ get ellipsis() {
// TODO : Not implemented in EFL
//bool ellipsis = elm_label_ellipsis_get(this["eo"]);
return Value(false);
}
- setter ellipsis(_ellipsis) {
+ set ellipsis(_ellipsis) {
elm_label_ellipsis_set(this["eo"], _ellipsis);
}
@@ -548,19 +548,19 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter front() {
+ get front() {
return Value(elm_flip_content_front_get(this["eo"]));
}
- setter front(_front) {
+ set front(_front) {
elm_flip_content_front_set(this["eo"], _front);
}
- getter back() {
+ get back() {
return Value(elm_flip_content_back_get(this["eo"]));
}
- setter back(_back) {
+ set back(_back) {
elm_flip_content_back_set(this["eo"], _back);
}
@@ -568,11 +568,11 @@ module Elm {
elm_flip_go(this["eo"], (Elm_Flip_Mode)(mode.to<int>()));
}
- getter interaction() {
+ get interaction() {
return Integer(elm_flip_interaction_get(this["eo"]));
}
- setter interaction(_interact) {
+ set interaction(_interact) {
elm_flip_interaction_set (this["eo"], (Elm_Flip_Interaction)(_interact.to<int>()));
}
@@ -585,35 +585,35 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter selectedLabel() {
+ get selectedLabel() {
return String(elm_actionslider_selected_label_get(this["eo"]));
}
- setter selectedLabel(_sl) {
+ set selectedLabel(_sl) {
// TODO : Not implemented in EFL
}
- getter indicatorPos() {
+ get indicatorPos() {
return Integer(elm_actionslider_indicator_pos_get(this["eo"]));
}
- setter indicatorPos(_ip) {
+ set indicatorPos(_ip) {
elm_actionslider_indicator_pos_set(this["eo"], (Elm_Actionslider_Pos)(_ip.to<int>()));
}
- getter enabledPos() {
+ get enabledPos() {
return Integer(elm_actionslider_enabled_pos_get(this["eo"]));
}
- setter enabledPos(_ip) {
+ set enabledPos(_ip) {
elm_actionslider_enabled_pos_set(this["eo"], (Elm_Actionslider_Pos)(_ip.to<int>()));
}
- getter magnetPos() {
+ get magnetPos() {
return Integer(elm_actionslider_magnet_pos_get(this["eo"]));
}
- setter magnetPos(_ip) {
+ set magnetPos(_ip) {
elm_actionslider_magnet_pos_set(this["eo"], (Elm_Actionslider_Pos)(_ip.to<int>()));
}
@@ -626,57 +626,57 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter content() {
+ get content() {
return Value(elm_scroller_content_get(this["eo"]));
}
- setter content(_content) {
+ set content(_content) {
elm_scroller_content_set(this["eo"], _content["eo"]);
}
- getter hBounce() {
+ get hBounce() {
Eina_Bool hb, vb;
elm_scroller_bounce_get(this["eo"], &hb, &vb);
return Integer(hb);
}
- setter hBounce(_hb) {
+ set hBounce(_hb) {
Eina_Bool hb, vb;
elm_scroller_bounce_get(this["eo"], &hb, &vb);
elm_scroller_bounce_set(this["eo"], _hb.to<int>(), vb);
}
- getter vBounce() {
+ get vBounce() {
Eina_Bool hb, vb;
elm_scroller_bounce_get(this["eo"], &hb, &vb);
return Integer(vb);
}
- setter vBounce(_vb) {
+ set vBounce(_vb) {
Eina_Bool hb, vb;
elm_scroller_bounce_get(this["eo"], &hb, &vb);
elm_scroller_bounce_set(this["eo"], hb, _vb.to<int>());
}
- getter xPolicy() {
+ get xPolicy() {
Elm_Scroller_Policy xp, yp;
elm_scroller_policy_get(this["eo"], &xp, &yp);
return Integer(xp);
}
- setter xPolicy(_xp) {
+ set xPolicy(_xp) {
Elm_Scroller_Policy xp, yp;
elm_scroller_policy_get(this["eo"], &xp, &yp);
elm_scroller_policy_set(this["eo"], (Elm_Scroller_Policy)(_xp.to<int>()), yp);
}
- getter yPolicy() {
+ get yPolicy() {
Elm_Scroller_Policy xp, yp;
elm_scroller_policy_get(this["eo"], &xp, &yp);
return Integer(yp);
}
- setter yPolicy(_yp) {
+ set yPolicy(_yp) {
Elm_Scroller_Policy xp, yp;
elm_scroller_policy_get(this["eo"], &xp, &yp);
elm_scroller_policy_set(this["eo"], xp, (Elm_Scroller_Policy)(_yp.to<int>()));
@@ -709,11 +709,11 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter state() {
+ get state() {
return Integer(elm_check_state_get(this["eo"]));
}
- setter state(_state) {
+ set state(_state) {
elm_check_state_set(this["eo"], (Eina_Bool)(_state.to<int>()));
}
}
@@ -725,80 +725,80 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter hour() {
+ get hour() {
int h,m,s;
elm_clock_time_get(this["eo"], &h, &m, &s);
return Integer(h);
}
- setter hour(_h) {
+ set hour(_h) {
int h,m,s;
elm_clock_time_get(this["eo"], &h, &m, &s);
elm_clock_time_set(this["eo"], _h.to<int>(), m, s);
}
- getter minute() {
+ get minute() {
int h,m,s;
elm_clock_time_get(this["eo"], &h, &m, &s);
return Integer(m);
}
- setter minute(_m) {
+ set minute(_m) {
int h,m,s;
elm_clock_time_get(this["eo"], &h, &m, &s);
elm_clock_time_set(this["eo"], h, _m.to<int>(), s);
}
- getter second() {
+ get second() {
int h,m,s;
elm_clock_time_get(this["eo"], &h, &m, &s);
return Integer(s);
}
- setter second(_s) {
+ set second(_s) {
int h,m,s;
elm_clock_time_get(this["eo"], &h, &m, &s);
elm_clock_time_set(this["eo"], h, m, _s.to<int>());
}
- getter edit() {
+ get edit() {
Eina_Bool ed;
return Integer(elm_clock_edit_get(this["eo"]));
}
- setter edit(_ed) {
+ set edit(_ed) {
elm_clock_edit_set(this["eo"], (Eina_Bool)_ed.to<int>());
}
- getter digitEdit() {
+ get digitEdit() {
return Integer(elm_clock_digit_edit_get(this["eo"]));
}
- setter digitEdit(_de) {
+ set digitEdit(_de) {
elm_clock_digit_edit_set(this["eo"], (Elm_Clock_Digedit)(_de.to<int>()));
}
- getter showAMPM() {
+ get showAMPM() {
return Integer(elm_clock_show_am_pm_get(this["eo"]));
}
- setter showAMPM(_ampm) {
+ set showAMPM(_ampm) {
elm_clock_show_am_pm_set(this["eo"], (Elm_Clock_Digedit)(_ampm.to<int>()));
}
- getter showSeconds() {
+ get showSeconds() {
return Integer(elm_clock_show_seconds_get(this["eo"]));
}
- setter showSeconds(_secs) {
+ set showSeconds(_secs) {
elm_clock_show_seconds_set(this["eo"], (Eina_Bool)(_secs.to<int>()));
}
- getter interval() {
+ get interval() {
return Number(elm_clock_interval_get(this["eo"]));
}
- setter interval(_intvl) {
+ set interval(_intvl) {
elm_clock_interval_set(this["eo"], (double)(_intvl.to<int>()));
}
@@ -811,51 +811,51 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter pulse() {
+ get pulse() {
return Integer(elm_progressbar_pulse_get(this["eo"]));
}
- setter pulse(_pulse) {
+ set pulse(_pulse) {
elm_progressbar_pulse_set(this["eo"], (Eina_Bool)(_pulse.to<int>()));
}
- getter value() {
+ get value() {
return Integer(elm_progressbar_value_get(this["eo"]));
}
- setter value(_value) {
+ set value(_value) {
elm_progressbar_value_set(this["eo"], (double)(_value.to<int>()));
}
- getter spanSize() {
+ get spanSize() {
return Integer(elm_progressbar_span_size_get(this["eo"]));
}
- setter spanSize(_ss) {
+ set spanSize(_ss) {
elm_progressbar_span_size_set(this["eo"], (Evas_Coord)(_ss.to<int>()));
}
- getter unitFormat() {
+ get unitFormat() {
return String(elm_progressbar_unit_format_get(this["eo"]));
}
- setter unitFormat(_value) {
+ set unitFormat(_value) {
elm_progressbar_unit_format_set(this["eo"], _value);
}
- getter horizontal() {
+ get horizontal() {
return Integer(elm_progressbar_horizontal_get(this["eo"]));
}
- setter horizontal(_value) {
+ set horizontal(_value) {
elm_progressbar_horizontal_set(this["eo"], (Eina_Bool)(_value.to<int>()));
}
- getter inverted() {
+ get inverted() {
return Integer(elm_progressbar_inverted_get(this["eo"]));
}
- setter inverted(_value) {
+ set inverted(_value) {
elm_progressbar_inverted_set(this["eo"], (Eina_Bool)(_value.to<int>()));
}
}
@@ -867,39 +867,39 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter image() {
+ get image() {
// TODO : Not implemented in EFL
return String("");
}
- setter image(_image) {
+ set image(_image) {
elm_photo_file_set(this["eo"], _image);
}
- getter size() {
+ get size() {
// TODO : Not implemented in EFL
return Integer(0);
}
- setter size(_value) {
+ set size(_value) {
elm_photo_size_set(this["eo"], (_value.to<int>()));
}
- getter fill() {
+ get fill() {
// TODO : Not implemented in EFL
return Integer(0);
}
- setter fill(_value) {
+ set fill(_value) {
elm_photo_fill_inside_set(this["eo"], (Eina_Bool)(_value.to<int>()));
}
- getter editable() {
+ get editable() {
// TODO : Not implemented in EFL
return Integer(0);
}
- setter editable(_value) {
+ set editable(_value) {
elm_photo_editable_set(this["eo"], (Eina_Bool)(_value.to<int>()));
}
@@ -912,75 +912,75 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter labelFormat() {
+ get labelFormat() {
return String(elm_spinner_label_format_get(this["eo"]));
}
- setter labelFormat(_value) {
+ set labelFormat(_value) {
elm_spinner_label_format_set(this["eo"], _value);
}
- getter min() {
+ get min() {
double min, max;
elm_spinner_min_max_get(this["eo"], &min, &max);
return Number(min);
}
- setter min(_min) {
+ set min(_min) {
double min, max;
elm_spinner_min_max_get(this["eo"], &min, &max);
elm_spinner_min_max_set(this["eo"], _min, max);
}
- getter max() {
+ get max() {
double min, max;
elm_spinner_min_max_get(this["eo"], &min, &max);
return Number(max);
}
- setter max(_max) {
+ set max(_max) {
double min, max;
elm_spinner_min_max_get(this["eo"], &min, &max);
elm_spinner_min_max_set(this["eo"], min, _max);
}
- getter step() {
+ get step() {
return Number(elm_spinner_step_get(this["eo"]));
}
- setter step(_step) {
+ set step(_step) {
elm_spinner_step_set(this["eo"], (double)(_step.to<int>()));
}
- getter value() {
+ get value() {
return Number(elm_spinner_value_get(this["eo"]));
}
- setter value(_value) {
+ set value(_value) {
elm_spinner_value_set(this["eo"], (double)(_value.to<int>()));
}
- getter wrap() {
+ get wrap() {
return Integer(elm_spinner_wrap_get(this["eo"]));
}
- setter wrap(_wrap) {
+ set wrap(_wrap) {
elm_spinner_wrap_set(this["eo"], (Eina_Bool)(_wrap.to<int>()));
}
- getter editable() {
+ get editable() {
return Integer(elm_spinner_editable_get(this["eo"]));
}
- setter editable(_editable) {
+ set editable(_editable) {
elm_spinner_editable_set(this["eo"], (Eina_Bool)(_editable.to<int>()));
}
- getter interval() {
+ get interval() {
return Number(elm_spinner_interval_get(this["eo"]));
}
- setter interval(_interval) {
+ set interval(_interval) {
elm_spinner_interval_set(this["eo"], (double)(_interval.to<int>()));
}
@@ -993,35 +993,35 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter contentLeft() {
+ get contentLeft() {
return Value(elm_panes_content_left_get(this["eo"]));
}
- setter contentLeft(_left) {
+ set contentLeft(_left) {
elm_panes_content_left_set(this["eo"], _left["eo"]);
}
- getter contentRight() {
+ get contentRight() {
return Value(elm_panes_content_right_get(this["eo"]));
}
- setter contentRight(_right) {
+ set contentRight(_right) {
elm_panes_content_right_set(this["eo"], _right["eo"]);
}
- getter leftSize() {
+ get leftSize() {
return Number(elm_panes_content_left_size_get(this["eo"]));
}
- setter leftSize(_ls) {
+ set leftSize(_ls) {
elm_panes_content_left_size_set(this["eo"], (double)(_ls.to<int>()));
}
- getter horizontal() {
+ get horizontal() {
return Number(elm_panes_horizontal_get(this["eo"]));
}
- setter leftSize(_h) {
+ set leftSize(_h) {
elm_panes_horizontal_set(this["eo"], (double)(_h.to<int>()));
}
@@ -1034,19 +1034,19 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter content() {
+ get content() {
return Value(elm_bubble_content_get(this["eo"]));
}
- setter content(_c) {
+ set content(_c) {
elm_bubble_content_set(this["eo"], _c["eo"]);
}
- getter corner() {
+ get corner() {
return String(elm_bubble_corner_get(this["eo"]));
}
- setter corner(_c) {
+ set corner(_c) {
elm_bubble_corner_set(this["eo"], _c.to<String>());
}
@@ -1059,60 +1059,60 @@ module Elm {
evas_object_show(this["eo"]);
}
- getter red() {
+ get red() {
int r;
elm_colorselector_color_get(this["eo"], &r, NULL, NULL, NULL);
return Integer(r);
}
- setter red(_r) {
+ set red(_r) {
int r, g, b, a;
elm_colorselector_color_get(this["eo"], &r, &g, &b, &a);
elm_colorselector_color_set(this["eo"], _r, g, b, a);
}
- getter green() {
+ get green() {
int g;
elm_colorselector_color_get(this["eo"], NULL, &g, NULL, NULL);
return Integer(g);
}
- setter green(_g) {
+ set green(_g) {
int r, g, b, a;
elm_colorselector_color_get(this["eo"], &r, &g, &b, &a);
elm_colorselector_color_set(this["eo"], r, _g, b, a);
}
- getter blue() {
+ get blue() {
int b;
elm_colorselector_color_get(this["eo"], NULL, NULL, &b, NULL);
return Integer(b);
}
- setter blue(_b) {
+ set blue(_b) {
int r, g, b, a;
elm_colorselector_color_get(this["eo"], &r, &g, &b, &a);
elm_colorselector_color_set(this["eo"], r, g, _b, a);
}
- getter alpha() {
+ get alpha() {
int a;
elm_colorselector_color_get(this["eo"], NULL, NULL, NULL, &a);
return Integer(a);
}
- setter alpha(_a) {
+ set alpha(_a) {
int r, g, b, a;
elm_colorselector_color_get(this["eo"], &r, &g, &b, &a);
elm_colorselector_color_set(this["eo"], r, g, b, _a);
}
- setter onChanged(arg) {
+ set onChanged(arg) {
this["_onChanged"] = arg;
evas_object_smart_callback_add(this["eo"], "changed", elmOnChanged, new Value(this));
}
- getter onChanged() {
+ get onChanged() {
return this["_onChanged"];
}
@@ -1133,12 +1133,12 @@ module Elm {
evas_object_show(this["eo"]);
}
- setter entry(text) {
+ set entry(text) {
this["entry"] = text;
elm_entry_entry_set(this["eo"], text);
}
- getter entry() {
+ get entry() {
const char *entry;
entry = elm_entry_entry_get(this["eo"]);
return String(entry);
Please sign in to comment.
Something went wrong with that request. Please try again.