def add_table(self, table, table_name, table_type, table_descr): self.__data.append(table_descr) self.__data.append("static const %s lit_%s[] JERRY_ATTR_CONST_DATA =" % (table_type, table_name)) self.__data.append("{") self.__data.append(format_code(table, 1)) self.__data.append("};") self.__data.append("") # for an extra empty line
def add_table(self, table, table_name, table_type, table_descr): self.__data.append(table_descr) self.__data.append("static const %s lit_%s[] JERRY_CONST_DATA =" % (table_type, table_name)) self.__data.append("{") self.__data.append(format_code(table, 1)) self.__data.append("};") self.__data.append("") # for an extra empty line
def add_table(self, table, description, table_type, category, table_name): if table and sum(table) != 0: self._data.append(description) self._data.append( "static const %s lit_unicode_%s%s%s[] JERRY_ATTR_CONST_DATA =" % (table_type, category.lower(), "_" + table_name if table_name else "", self._table_name_suffix)) self._data.append("{") self._data.append( format_code(table, 1, 6 if self._table_name_suffix else 4)) self._data.append("};") self._data.append("") # for an extra empty line
def js_to_native_code(path, name, build_type): with open(path, 'r') as js_source: code = js_source.read() if build_type != 'debug': code = reduce_code(code) data = format_code(code, 1, 2) native_code = """const static char {0}_n[] = "{0}"; const static char {0}_s[] = {{ {1} }}; const static int {0}_l = {2}; """.format(name, data, len(code)) return native_code