Line endings

This commit is contained in:
kobalicek
2014-06-07 19:23:35 +02:00
parent c87814b225
commit 0dbd42f350
5 changed files with 1901 additions and 1901 deletions

472
Doxyfile
View File

@@ -1,236 +1,236 @@
# Doxyfile 1.8.7 # Doxyfile 1.8.7
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Project related configuration options # Project related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8 DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "AsmJit" PROJECT_NAME = "AsmJit"
PROJECT_NUMBER = "1.1" PROJECT_NUMBER = "1.1"
PROJECT_BRIEF = "Complete Remote and JIT Assembler for x86/x64" PROJECT_BRIEF = "Complete Remote and JIT Assembler for x86/x64"
OUTPUT_DIRECTORY = . OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English
FULL_PATH_NAMES = YES FULL_PATH_NAMES = YES
STRIP_FROM_PATH = STRIP_FROM_PATH =
STRIP_FROM_INC_PATH = STRIP_FROM_INC_PATH =
SHORT_NAMES = NO SHORT_NAMES = NO
BRIEF_MEMBER_DESC = YES BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES REPEAT_BRIEF = YES
QT_AUTOBRIEF = NO QT_AUTOBRIEF = NO
JAVADOC_AUTOBRIEF = YES JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = YES MULTILINE_CPP_IS_BRIEF = YES
ALWAYS_DETAILED_SEC = NO ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO INLINE_INHERITED_MEMB = NO
INHERIT_DOCS = YES INHERIT_DOCS = YES
TAB_SIZE = 2 TAB_SIZE = 2
MARKDOWN_SUPPORT = YES MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = NO AUTOLINK_SUPPORT = NO
IDL_PROPERTY_SUPPORT = NO IDL_PROPERTY_SUPPORT = NO
SEPARATE_MEMBER_PAGES = NO SEPARATE_MEMBER_PAGES = NO
DISTRIBUTE_GROUP_DOC = NO DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO INLINE_SIMPLE_STRUCTS = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Build related configuration options # Build related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
EXTRACT_ALL = NO EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO EXTRACT_PRIVATE = NO
EXTRACT_PACKAGE = NO EXTRACT_PACKAGE = NO
EXTRACT_STATIC = NO EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO EXTRACT_LOCAL_CLASSES = NO
HIDE_UNDOC_CLASSES = YES HIDE_UNDOC_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_MEMBERS = NO
HIDE_FRIEND_COMPOUNDS = YES HIDE_FRIEND_COMPOUNDS = YES
HIDE_IN_BODY_DOCS = YES HIDE_IN_BODY_DOCS = YES
INTERNAL_DOCS = NO INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO CASE_SENSE_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
# their full class and namespace scopes in the documentation. If set to YES the # their full class and namespace scopes in the documentation. If set to YES the
# scope will be hidden. # scope will be hidden.
# The default value is: NO. # The default value is: NO.
HIDE_SCOPE_NAMES = NO HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = NO SHOW_INCLUDE_FILES = NO
SHOW_GROUPED_MEMB_INC = NO SHOW_GROUPED_MEMB_INC = NO
INLINE_INFO = YES INLINE_INFO = YES
SORT_MEMBER_DOCS = NO SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = NO SORT_BRIEF_DOCS = NO
SORT_GROUP_NAMES = NO SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = YES SORT_BY_SCOPE_NAME = YES
STRICT_PROTO_MATCHING = NO STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = NO GENERATE_TODOLIST = NO
GENERATE_TESTLIST = NO GENERATE_TESTLIST = NO
GENERATE_BUGLIST = NO GENERATE_BUGLIST = NO
GENERATE_DEPRECATEDLIST= NO GENERATE_DEPRECATEDLIST= NO
MAX_INITIALIZER_LINES = 0 MAX_INITIALIZER_LINES = 0
SHOW_USED_FILES = NO SHOW_USED_FILES = NO
SHOW_FILES = NO SHOW_FILES = NO
SHOW_NAMESPACES = NO SHOW_NAMESPACES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to warning and progress messages # Configuration options related to warning and progress messages
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
QUIET = YES QUIET = YES
WARNINGS = YES WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text" WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = WARN_LOGFILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the input files # Configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = src/asmjit INPUT = src/asmjit
INPUT_ENCODING = UTF-8 INPUT_ENCODING = UTF-8
RECURSIVE = YES RECURSIVE = YES
EXCLUDE = EXCLUDE =
USE_MDFILE_AS_MAINPAGE = README.md USE_MDFILE_AS_MAINPAGE = README.md
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to source browsing # Configuration options related to source browsing
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
SOURCE_BROWSER = NO SOURCE_BROWSER = NO
INLINE_SOURCES = NO INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES STRIP_CODE_COMMENTS = YES
SOURCE_TOOLTIPS = YES SOURCE_TOOLTIPS = YES
VERBATIM_HEADERS = NO VERBATIM_HEADERS = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index # Configuration options related to the alphabetical class index
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO ALPHABETICAL_INDEX = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to outputs # Configuration options related to outputs
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_HTML = YES GENERATE_HTML = YES
GENERATE_LATEX = NO GENERATE_LATEX = NO
GENERATE_RTF = NO GENERATE_RTF = NO
GENERATE_MAN = NO GENERATE_MAN = NO
GENERATE_XML = YES GENERATE_XML = YES
XML_OUTPUT = build_xml XML_OUTPUT = build_xml
XML_PROGRAMLISTING = NO XML_PROGRAMLISTING = NO
HTML_OUTPUT = build_doc HTML_OUTPUT = build_doc
HTML_FILE_EXTENSION = .html HTML_FILE_EXTENSION = .html
LAYOUT_FILE = tools/doc-layout.xml LAYOUT_FILE = tools/doc-layout.xml
HTML_HEADER = tools/doc-header.html HTML_HEADER = tools/doc-header.html
HTML_FOOTER = tools/doc-footer.html HTML_FOOTER = tools/doc-footer.html
HTML_STYLESHEET = tools/doc-style.css HTML_STYLESHEET = tools/doc-style.css
HTML_EXTRA_STYLESHEET = HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES = HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80 HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO HTML_TIMESTAMP = NO
HTML_DYNAMIC_SECTIONS = NO HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 0 HTML_INDEX_NUM_ENTRIES = 0
SEARCHENGINE = NO SEARCHENGINE = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the CHM output # Configuration options related to the CHM output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The # additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# Windows. # Windows.
# #
# The HTML Help Workshop contains a compiler that can convert all HTML output # The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
# files are now used as the Windows 98 help format, and will replace the old # files are now used as the Windows 98 help format, and will replace the old
# Windows help format (.hlp) on all Windows platforms in the future. Compressed # Windows help format (.hlp) on all Windows platforms in the future. Compressed
# HTML files also contain an index, a table of contents, and you can search for # HTML files also contain an index, a table of contents, and you can search for
# words in the documentation. The HTML workshop also contains a viewer for # words in the documentation. The HTML workshop also contains a viewer for
# compressed HTML files. # compressed HTML files.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_HTMLHELP = NO GENERATE_HTMLHELP = NO
# The CHM_FILE tag can be used to specify the file name of the resulting .chm # The CHM_FILE tag can be used to specify the file name of the resulting .chm
# file. You can add a path in front of the file if the result should not be # file. You can add a path in front of the file if the result should not be
# written to the html output directory. # written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
CHM_FILE = CHM_FILE =
# The HHC_LOCATION tag can be used to specify the location (absolute path # The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler ( hhc.exe). If non-empty # including file name) of the HTML help compiler ( hhc.exe). If non-empty
# doxygen will try to run the HTML help compiler on the generated index.hhp. # doxygen will try to run the HTML help compiler on the generated index.hhp.
# The file has to be specified with full path. # The file has to be specified with full path.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
HHC_LOCATION = HHC_LOCATION =
# The BINARY_TOC flag controls whether a binary table of contents is generated ( # The BINARY_TOC flag controls whether a binary table of contents is generated (
# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it # YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
# enables the Previous and Next buttons. # enables the Previous and Next buttons.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
BINARY_TOC = NO BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members to # The TOC_EXPAND flag can be set to YES to add extra items for group members to
# the table of contents of the HTML help documentation and to the tree view. # the table of contents of the HTML help documentation and to the tree view.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
TOC_EXPAND = NO TOC_EXPAND = NO
DISABLE_INDEX = NO DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 0 ENUM_VALUES_PER_LINE = 0
TREEVIEW_WIDTH = 250 TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO EXT_LINKS_IN_WINDOW = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the preprocessor # Configuration options related to the preprocessor
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO EXPAND_ONLY_PREDEF = NO
EXPAND_AS_DEFINED = EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES SKIP_FUNCTION_MACROS = YES
PREDEFINED = ASMJIT_DOCGEN \ PREDEFINED = ASMJIT_DOCGEN \
ASMJIT_BUILD_X86 \ ASMJIT_BUILD_X86 \
ASMJIT_BUILD_X64 \ ASMJIT_BUILD_X64 \
ASMJIT_API ASMJIT_API
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO CLASS_DIAGRAMS = NO
CLASS_GRAPH = NO CLASS_GRAPH = NO

View File

@@ -1,21 +1,21 @@
<!--BEGIN GENERATE_TREEVIEW--> <!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul> <ul>
$navpath $navpath
<li class="footer">$generatedby <li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html"> <a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li> <img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul> </ul>
</div> </div>
<!--END GENERATE_TREEVIEW--> <!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW--> <!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small> <hr class="footer"/><address class="footer"><small>
$generatedby &#160;<a href="http://www.doxygen.org/index.html"> $generatedby &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/> <img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
</a> $doxygenversion </a> $doxygenversion
</small></address> </small></address>
<!--END !GENERATE_TREEVIEW--> <!--END !GENERATE_TREEVIEW-->
</body> </body>
</html> </html>

View File

@@ -1,37 +1,37 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>$projectname: $title</title> <title>$projectname: $title</title>
<script type="text/javascript" src="$relpath^jquery.js"></script> <script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script> <script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview $treeview
$search $search
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" /> <link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet $extrastylesheet
</head> </head>
<body> <body>
<!-- do not remove this div, it is closed by doxygen! --> <!-- do not remove this div, it is closed by doxygen! -->
<div id="top"> <div id="top">
<!--BEGIN TITLEAREA--> <!--BEGIN TITLEAREA-->
<div id="titlearea"> <div id="titlearea">
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tbody> <tbody>
<tr style="height: 56px;"> <tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO--> <!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td> <td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
<!--END PROJECT_LOGO--> <!--END PROJECT_LOGO-->
<td style="padding-left: 0.5em;"> <td style="padding-left: 0.5em;">
<div id="projectname">$projectname&#160;<span id="projectnumber">$projectnumber</span> API</div> <div id="projectname">$projectname&#160;<span id="projectnumber">$projectnumber</span> API</div>
<div id="projectbrief">$projectbrief</div> <div id="projectbrief">$projectbrief</div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<!--END TITLEAREA--> <!--END TITLEAREA-->

File diff suppressed because it is too large Load Diff

View File

@@ -1,213 +1,213 @@
// [GenDefs] // [GenDefs]
// //
// The purpose of this script is to fetch all instructions' names into a single // The purpose of this script is to fetch all instructions' names into a single
// string. It prevents relocation that has to be done by linked to make all // string. It prevents relocation that has to be done by linked to make all
// pointers the binary application/library uses valid. This approach decreases // pointers the binary application/library uses valid. This approach decreases
// the final size of AsmJit binary. // the final size of AsmJit binary.
var fs = require("fs"); var fs = require("fs");
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// [Configuration] // [Configuration]
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
var injectStartMarker = "// ${kInstData:Begin}\n" var injectStartMarker = "// ${kInstData:Begin}\n"
var injectEndMarker = "// ${kInstData:End}\n" var injectEndMarker = "// ${kInstData:End}\n"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// [Utilities] // [Utilities]
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
var uppercaseFirst = function(s) { var uppercaseFirst = function(s) {
if (!s) if (!s)
return s; return s;
return s[0].toUpperCase() + s.substr(1); return s[0].toUpperCase() + s.substr(1);
}; };
var inject = function(s, start, end, code) { var inject = function(s, start, end, code) {
var iStart = s.indexOf(start); var iStart = s.indexOf(start);
var iEnd = s.indexOf(end); var iEnd = s.indexOf(end);
if (iStart === -1) if (iStart === -1)
throw new Error("Couldn't locate start mark."); throw new Error("Couldn't locate start mark.");
if (iEnd === -1) if (iEnd === -1)
throw new Error("Couldn't locate end mark."); throw new Error("Couldn't locate end mark.");
return s.substr(0, iStart + start.length) + code + s.substr(iEnd); return s.substr(0, iStart + start.length) + code + s.substr(iEnd);
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// [Database] // [Database]
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// FullIndex - Index of the name of the instruction in one big string (no // FullIndex - Index of the name of the instruction in one big string (no
// prefix/suffix concept). // prefix/suffix concept).
// PrefixIndex - Index to a prefix string. // PrefixIndex - Index to a prefix string.
// SuffixIndex - Index to a suffix string. // SuffixIndex - Index to a suffix string.
var Database = (function() { var Database = (function() {
var IndexedString = function() { var IndexedString = function() {
this.array = []; this.array = [];
this.index = 0; this.index = 0;
this.map = {}; this.map = {};
}; };
IndexedString.prototype.add = function(s) { IndexedString.prototype.add = function(s) {
var index = this.map[s]; var index = this.map[s];
if (typeof index === "number") if (typeof index === "number")
return index; return index;
index = this.index; index = this.index;
this.array.push(s); this.array.push(s);
this.index += s.length + 1; this.index += s.length + 1;
this.map[s] = index; this.map[s] = index;
return index; return index;
}; };
IndexedString.prototype.get = function(s) { IndexedString.prototype.get = function(s) {
return this.map[s]; return this.map[s];
}; };
IndexedString.prototype.format = function(indent) { IndexedString.prototype.format = function(indent) {
var s = ""; var s = "";
var array = this.array; var array = this.array;
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
s += indent + "\"" + array[i] + "\\0\""; s += indent + "\"" + array[i] + "\\0\"";
if (i === array.length - 1) if (i === array.length - 1)
s += ";"; s += ";";
s += "\n"; s += "\n";
} }
return s; return s;
}; };
IndexedString.prototype.getSize = function() { IndexedString.prototype.getSize = function() {
return this.index; return this.index;
}; };
var Database = function() { var Database = function() {
this.map = {}; this.map = {};
this.alphabetical = new Array(26); this.alphabetical = new Array(26);
this.fullString = new IndexedString(); this.fullString = new IndexedString();
}; };
Database.prototype.add = function(name, id) { Database.prototype.add = function(name, id) {
this.map[name] = { this.map[name] = {
id: id, id: id,
fullIndex: 0, fullIndex: 0,
prefixIndex: 0, prefixIndex: 0,
hasV: 0 hasV: 0
}; };
}; };
Database.prototype.index = function() { Database.prototype.index = function() {
var map = this.map; var map = this.map;
var alphabetical = this.alphabetical; var alphabetical = this.alphabetical;
for (var name in map) { for (var name in map) {
var inst = map[name]; var inst = map[name];
inst.fullIndex = this.fullString.add(name); inst.fullIndex = this.fullString.add(name);
var aIndex = name.charCodeAt(0) - 'a'.charCodeAt(0); var aIndex = name.charCodeAt(0) - 'a'.charCodeAt(0);
if (aIndex < 0 || aIndex >= 26) if (aIndex < 0 || aIndex >= 26)
throw new Error("Alphabetical index error"); throw new Error("Alphabetical index error");
if (alphabetical[aIndex] === undefined) if (alphabetical[aIndex] === undefined)
alphabetical[aIndex] = inst.id; alphabetical[aIndex] = inst.id;
if (name.indexOf("v") === 0) { if (name.indexOf("v") === 0) {
inst.hasV = 1; inst.hasV = 1;
name = name.substr(1); name = name.substr(1);
} }
} }
}; };
return Database; return Database;
})(); })();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// [Generate] // [Generate]
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
var generate = function(fileName, arch) { var generate = function(fileName, arch) {
var oldData = fs.readFileSync(fileName, "utf8").replace(/\r\n/g, "\n"); var oldData = fs.readFileSync(fileName, "utf8").replace(/\r\n/g, "\n");
var data = oldData; var data = oldData;
var code = ""; var code = "";
var Arch = uppercaseFirst(arch); var Arch = uppercaseFirst(arch);
// Create database. // Create database.
var db = new Database(); var db = new Database();
var re = new RegExp("INST\\(([A-Za-z0-9_]+)\\s*,\\s*\\\"([A-Za-z0-9_ ]*)\\\"", "g"); var re = new RegExp("INST\\(([A-Za-z0-9_]+)\\s*,\\s*\\\"([A-Za-z0-9_ ]*)\\\"", "g");
while (m = re.exec(data)) { while (m = re.exec(data)) {
var id = m[1]; var id = m[1];
var name = m[2]; var name = m[2];
db.add(name, id); db.add(name, id);
} }
db.index(); db.index();
console.log("Full size: " + db.fullString.getSize()); console.log("Full size: " + db.fullString.getSize());
// Generate InstName[] string. // Generate InstName[] string.
code += "const char _instName[] =\n"; code += "const char _instName[] =\n";
for (var k in db.map) { for (var k in db.map) {
var inst = db.map[k]; var inst = db.map[k];
code += " \"" + k + "\\0\"\n"; code += " \"" + k + "\\0\"\n";
} }
code = code.substr(code, code.length - 1) + ";\n\n"; code = code.substr(code, code.length - 1) + ";\n\n";
// Generate AlphaIndex. // Generate AlphaIndex.
code += "enum kInstAlphaIndex {\n"; code += "enum kInstAlphaIndex {\n";
code += " kInstAlphaIndexFirst = 'a',\n"; code += " kInstAlphaIndexFirst = 'a',\n";
code += " kInstAlphaIndexLast = 'z',\n"; code += " kInstAlphaIndexLast = 'z',\n";
code += " kInstAlphaIndexInvalid = 0xFFFF\n"; code += " kInstAlphaIndexInvalid = 0xFFFF\n";
code += "};\n"; code += "};\n";
code += "\n"; code += "\n";
// Generate NameIndex. // Generate NameIndex.
code += "static const uint16_t _instAlphaIndex[26] = {\n"; code += "static const uint16_t _instAlphaIndex[26] = {\n";
for (var i = 0; i < db.alphabetical.length; i++) { for (var i = 0; i < db.alphabetical.length; i++) {
var id = db.alphabetical[i]; var id = db.alphabetical[i];
code += " " + (id === undefined ? "0xFFFF" : id); code += " " + (id === undefined ? "0xFFFF" : id);
if (i !== db.alphabetical.length - 1) if (i !== db.alphabetical.length - 1)
code += ","; code += ",";
code += "\n"; code += "\n";
} }
code += "};\n\n"; code += "};\n\n";
code += "enum kInstData_NameIndex {\n"; code += "enum kInstData_NameIndex {\n";
for (var k in db.map) { for (var k in db.map) {
var inst = db.map[k]; var inst = db.map[k];
code += " " + inst.id + "_NameIndex = " + inst.fullIndex + ",\n"; code += " " + inst.id + "_NameIndex = " + inst.fullIndex + ",\n";
} }
code = code.substr(code, code.length - 2) + "\n};\n"; code = code.substr(code, code.length - 2) + "\n};\n";
// Inject. // Inject.
data = inject(data, injectStartMarker, injectEndMarker, code); data = inject(data, injectStartMarker, injectEndMarker, code);
// Save only if modified. // Save only if modified.
if (data !== oldData) if (data !== oldData)
fs.writeFileSync(fileName, data, "utf8"); fs.writeFileSync(fileName, data, "utf8");
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// [Main] // [Main]
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
var main = function(files) { var main = function(files) {
files.forEach(function(file) { files.forEach(function(file) {
generate(file.name, file.arch); generate(file.name, file.arch);
}); });
}; };
main([ main([
{ {
name: "../src/asmjit/x86/x86inst.cpp", name: "../src/asmjit/x86/x86inst.cpp",
arch: "x86" arch: "x86"
} }
]); ]);