| @@ -10,21 +10,21 @@ | |||||
| <head> | <head> | ||||
| <style type="text/css"> | <style type="text/css"> | ||||
| body | |||||
| { | |||||
| font:12px Consolas; | |||||
| } | |||||
| body | |||||
| { | |||||
| font:12px Consolas; | |||||
| } | |||||
| #status_field | #status_field | ||||
| { | { | ||||
| font:12px Consolas; | |||||
| font:12px Consolas; | |||||
| } | } | ||||
| button | button | ||||
| { | { | ||||
| font:14px Consolas; | |||||
| font:14px Consolas; | |||||
| } | } | ||||
| textarea | textarea | ||||
| { | { | ||||
| font:14px Consolas; | |||||
| font:14px Consolas; | |||||
| } | } | ||||
| progress | progress | ||||
| { | { | ||||
| @@ -60,7 +60,7 @@ progress::-webkit-progress-value | |||||
| left: 40%; | left: 40%; | ||||
| z-index: 3; | z-index: 3; | ||||
| } | } | ||||
| nacl_div | |||||
| #DIV_nacl_div | |||||
| { | { | ||||
| position: absolute; | position: absolute; | ||||
| top: 2px; | top: 2px; | ||||
| @@ -81,9 +81,9 @@ nacl_div | |||||
| <script src="./TypeDictionnary.js"></script> | <script src="./TypeDictionnary.js"></script> | ||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| var EasyMeshDict = new TypeDictionnary("EasyMesh"); | |||||
| function GetCmdDictionnary() { return EasyMeshDict; } | |||||
| </script> | |||||
| var EasyMeshDict = new TypeDictionnary("EasyMesh"); | |||||
| function GetCmdDictionnary() { return EasyMeshDict; } | |||||
| </script> | |||||
| <script src="./EasyMeshDictionnary.js"></script> | <script src="./EasyMeshDictionnary.js"></script> | ||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| @@ -100,168 +100,168 @@ nacl_div | |||||
| window.setTimeout("Tick()", 100); | window.setTimeout("Tick()", 100); | ||||
| window.setTimeout("Init()", 100); | window.setTimeout("Init()", 100); | ||||
| function Init() | |||||
| { | |||||
| nacl_div = document.getElementById('DIV_nacl_div'); | |||||
| mesh_code_module = document.getElementById('DIV_MeshCode'); | |||||
| code_helper_cmd[0] = document.getElementById('DIV_command0'); | |||||
| code_helper_cmd[1] = document.getElementById('DIV_command1'); | |||||
| code_helper_arg = document.getElementById('DIV_args'); | |||||
| code_helper_cmt = document.getElementById('DIV_comment'); | |||||
| code_helper_var = document.getElementById('DIV_var_usage'); | |||||
| code_helper_alpha = document.getElementById('DIV_alphabet'); | |||||
| code_helper_alpha.innerHTML = ' ['; | |||||
| for (var a = 'a'.charCodeAt(0); a <= 'z'.charCodeAt(0); a++) | |||||
| { | |||||
| var stop = false; | |||||
| for (var i = 0; !stop && i < EasyMeshDict.m_cmds.length; i++) | |||||
| { | |||||
| for (var j = 0; j < EasyMeshDict.m_cmds[i].m_name.length; j++) | |||||
| { | |||||
| if (EasyMeshDict.m_cmds[i].m_name[j][0] == String.fromCharCode(a)) | |||||
| { | |||||
| code_helper_alpha.innerHTML += '<b>' + String.fromCharCode(a) + '</b>'; | |||||
| stop = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| if (!stop) | |||||
| code_helper_alpha.innerHTML += '.'; | |||||
| } | |||||
| code_helper_alpha.innerHTML += '] <br> '; | |||||
| } | |||||
| function Tick() | |||||
| { | |||||
| window.setTimeout("Tick()", 100); | |||||
| /* -- cmd lookup code. */ | |||||
| if (mesh_code_module != undefined) | |||||
| { | |||||
| var cmd_size = 8; | |||||
| var found = FindMatchingCommand(mesh_code_module); | |||||
| if (found.match_list.length > 0) | |||||
| { | |||||
| var type_list = new Array(); | |||||
| code_helper_cmd[0].innerHTML = ""; | |||||
| code_helper_cmd[1].innerHTML = ""; | |||||
| code_helper_arg.innerHTML = ""; | |||||
| code_helper_cmt.innerHTML = ""; | |||||
| //Go through the found matches and show them. | |||||
| for (var i = 0; i < found.match_list.length; i++) | |||||
| { | |||||
| var cur_match = EasyMeshDict.m_cmds[found.match_list[i]]; | |||||
| code_helper_cmd[0].innerHTML += '['; | |||||
| var max = cur_match.m_name.length; | |||||
| var word = 0; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| var mth = found.match; | |||||
| var cmd = cur_match.m_name[j]; | |||||
| //Matching start caracters should be bold | |||||
| if (mth == cmd.slice(0, mth.length)) | |||||
| { | |||||
| code_helper_cmd[word].innerHTML += ' '; | |||||
| code_helper_cmd[word].innerHTML += '<b>' + mth + '</b>'; | |||||
| code_helper_cmd[word].innerHTML += cmd.slice(mth.length, cmd.length); | |||||
| word++; | |||||
| } | |||||
| } | |||||
| //Complete empty command by <br> so commands in the two columns are on the same line | |||||
| word = (word > 0)?(2):(0); | |||||
| while (word-- > 0) | |||||
| code_helper_cmd[word].innerHTML += "<br>"; | |||||
| //Go through the arguments and show them | |||||
| if (found.match_list.length < 4 && i == 0) | |||||
| { | |||||
| code_helper_arg.innerHTML += " > "; | |||||
| if (cur_match.m_arg != undefined) | |||||
| { | |||||
| max = cur_match.m_arg.length; | |||||
| var found_optional = false; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| if (cur_match.m_arg[j].m_optional != undefined && found_optional == false) | |||||
| { | |||||
| var tab = '<br>'; for (var l = 0; l < 5; l++) tab += ' '; | |||||
| code_helper_arg.innerHTML += tab + 'Opt: ['; | |||||
| found_optional = true; | |||||
| } | |||||
| else if (j > 0) | |||||
| code_helper_arg.innerHTML += ', '; | |||||
| //Types are bold | |||||
| code_helper_arg.innerHTML += '<b>' + cur_match.m_arg[j].m_type + '</b> '; | |||||
| type_list[type_list.length] = cur_match.m_arg[j].m_type; | |||||
| //Names are not | |||||
| code_helper_arg.innerHTML += cur_match.m_arg[j].m_name; | |||||
| if (cur_match.m_arg[j].m_optional != undefined) | |||||
| code_helper_arg.innerHTML += ' = <b>' + cur_match.m_arg[j].m_optional + '</b>'; | |||||
| } | |||||
| if (found_optional == true) | |||||
| code_helper_arg.innerHTML += '] '; | |||||
| code_helper_arg.innerHTML += ' <br>'; | |||||
| } | |||||
| //Add the comment | |||||
| if (cur_match.m_comment != undefined) | |||||
| { | |||||
| var tb_i = 16; var in_i = 8; | |||||
| var tab = '<br>'; | |||||
| if (cur_match.m_arg == undefined) { tb_i -= 8; in_i -= 8; } | |||||
| for (var l = 0; l < in_i; l++) code_helper_arg.innerHTML += ' '; | |||||
| for (var l = 0; l < tb_i; l++) tab += ' '; | |||||
| code_helper_arg.innerHTML += cur_match.m_comment + ' '; | |||||
| while (code_helper_arg.innerHTML.indexOf('\n') > -1) | |||||
| code_helper_arg.innerHTML = code_helper_arg.innerHTML.replace('\n', tab); | |||||
| } | |||||
| } | |||||
| } | |||||
| //Go through the type list and bold the used ones. | |||||
| if (EasyMeshDict.m_vars != undefined) | |||||
| { | |||||
| code_helper_var.innerHTML = ""; | |||||
| var max = EasyMeshDict.m_vars.length; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| var cur_var = EasyMeshDict.m_vars[j]; | |||||
| code_helper_var.innerHTML += " > "; | |||||
| var k = 0; | |||||
| for (; k < type_list.length; k++) | |||||
| if (cur_var.m_type == type_list[k]) | |||||
| break; | |||||
| //Bold the used variables | |||||
| if (k < type_list.length) | |||||
| code_helper_var.innerHTML += "<b>" + cur_var.m_type + "</b>"; | |||||
| else | |||||
| code_helper_var.innerHTML += cur_var.m_type; | |||||
| if (cur_var.m_syntax != undefined) | |||||
| { | |||||
| var align_size = 9; | |||||
| var cmd_size = cur_var.m_type.length + 3; | |||||
| for (var m = 0; m < cur_var.m_syntax.length; m++) | |||||
| { | |||||
| for (var l = 0; l < align_size - cmd_size; l++) | |||||
| code_helper_var.innerHTML += " "; | |||||
| code_helper_var.innerHTML += cur_var.m_syntax[m] + "<br>"; | |||||
| cmd_size = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| code_helper_cmd[0].innerHTML = "[ ... "; | |||||
| code_helper_cmd[1].innerHTML = ""; | |||||
| code_helper_arg.innerHTML = ""; | |||||
| code_helper_cmt.innerHTML = ""; | |||||
| } | |||||
| } | |||||
| /* -- */ | |||||
| function Init() | |||||
| { | |||||
| nacl_div = document.getElementById('DIV_nacl_div'); | |||||
| mesh_code_module = document.getElementById('DIV_MeshCode'); | |||||
| code_helper_cmd[0] = document.getElementById('DIV_command0'); | |||||
| code_helper_cmd[1] = document.getElementById('DIV_command1'); | |||||
| code_helper_arg = document.getElementById('DIV_args'); | |||||
| code_helper_cmt = document.getElementById('DIV_comment'); | |||||
| code_helper_var = document.getElementById('DIV_var_usage'); | |||||
| code_helper_alpha = document.getElementById('DIV_alphabet'); | |||||
| code_helper_alpha.innerHTML = ' ['; | |||||
| for (var a = 'a'.charCodeAt(0); a <= 'z'.charCodeAt(0); a++) | |||||
| { | |||||
| var stop = false; | |||||
| for (var i = 0; !stop && i < EasyMeshDict.m_cmds.length; i++) | |||||
| { | |||||
| for (var j = 0; j < EasyMeshDict.m_cmds[i].m_name.length; j++) | |||||
| { | |||||
| if (EasyMeshDict.m_cmds[i].m_name[j][0] == String.fromCharCode(a)) | |||||
| { | |||||
| code_helper_alpha.innerHTML += '<b>' + String.fromCharCode(a) + '</b>'; | |||||
| stop = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| if (!stop) | |||||
| code_helper_alpha.innerHTML += '.'; | |||||
| } | |||||
| code_helper_alpha.innerHTML += '] <br> '; | |||||
| } | |||||
| function Tick() | |||||
| { | |||||
| window.setTimeout("Tick()", 100); | |||||
| /* -- cmd lookup code. */ | |||||
| if (mesh_code_module != undefined) | |||||
| { | |||||
| var cmd_size = 8; | |||||
| var found = FindMatchingCommand(mesh_code_module); | |||||
| if (found.match_list.length > 0) | |||||
| { | |||||
| var type_list = new Array(); | |||||
| code_helper_cmd[0].innerHTML = ""; | |||||
| code_helper_cmd[1].innerHTML = ""; | |||||
| code_helper_arg.innerHTML = ""; | |||||
| code_helper_cmt.innerHTML = ""; | |||||
| //Go through the found matches and show them. | |||||
| for (var i = 0; i < found.match_list.length; i++) | |||||
| { | |||||
| var cur_match = EasyMeshDict.m_cmds[found.match_list[i]]; | |||||
| code_helper_cmd[0].innerHTML += '['; | |||||
| var max = cur_match.m_name.length; | |||||
| var word = 0; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| var mth = found.match; | |||||
| var cmd = cur_match.m_name[j]; | |||||
| //Matching start caracters should be bold | |||||
| if (mth == cmd.slice(0, mth.length)) | |||||
| { | |||||
| code_helper_cmd[word].innerHTML += ' '; | |||||
| code_helper_cmd[word].innerHTML += '<b>' + mth + '</b>'; | |||||
| code_helper_cmd[word].innerHTML += cmd.slice(mth.length, cmd.length); | |||||
| word++; | |||||
| } | |||||
| } | |||||
| //Complete empty command by <br> so commands in the two columns are on the same line | |||||
| word = (word > 0)?(2):(0); | |||||
| while (word-- > 0) | |||||
| code_helper_cmd[word].innerHTML += "<br>"; | |||||
| //Go through the arguments and show them | |||||
| if (found.match_list.length < 4 && i == 0) | |||||
| { | |||||
| code_helper_arg.innerHTML += " > "; | |||||
| if (cur_match.m_arg != undefined) | |||||
| { | |||||
| max = cur_match.m_arg.length; | |||||
| var found_optional = false; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| if (cur_match.m_arg[j].m_optional != undefined && found_optional == false) | |||||
| { | |||||
| var tab = '<br>'; for (var l = 0; l < 5; l++) tab += ' '; | |||||
| code_helper_arg.innerHTML += tab + 'Opt: ['; | |||||
| found_optional = true; | |||||
| } | |||||
| else if (j > 0) | |||||
| code_helper_arg.innerHTML += ', '; | |||||
| //Types are bold | |||||
| code_helper_arg.innerHTML += '<b>' + cur_match.m_arg[j].m_type + '</b> '; | |||||
| type_list[type_list.length] = cur_match.m_arg[j].m_type; | |||||
| //Names are not | |||||
| code_helper_arg.innerHTML += cur_match.m_arg[j].m_name; | |||||
| if (cur_match.m_arg[j].m_optional != undefined) | |||||
| code_helper_arg.innerHTML += ' = <b>' + cur_match.m_arg[j].m_optional + '</b>'; | |||||
| } | |||||
| if (found_optional == true) | |||||
| code_helper_arg.innerHTML += '] '; | |||||
| code_helper_arg.innerHTML += ' <br>'; | |||||
| } | |||||
| //Add the comment | |||||
| if (cur_match.m_comment != undefined) | |||||
| { | |||||
| var tb_i = 16; var in_i = 8; | |||||
| var tab = '<br>'; | |||||
| if (cur_match.m_arg == undefined) { tb_i -= 8; in_i -= 8; } | |||||
| for (var l = 0; l < in_i; l++) code_helper_arg.innerHTML += ' '; | |||||
| for (var l = 0; l < tb_i; l++) tab += ' '; | |||||
| code_helper_arg.innerHTML += cur_match.m_comment + ' '; | |||||
| while (code_helper_arg.innerHTML.indexOf('\n') > -1) | |||||
| code_helper_arg.innerHTML = code_helper_arg.innerHTML.replace('\n', tab); | |||||
| } | |||||
| } | |||||
| } | |||||
| //Go through the type list and bold the used ones. | |||||
| if (EasyMeshDict.m_vars != undefined) | |||||
| { | |||||
| code_helper_var.innerHTML = ""; | |||||
| var max = EasyMeshDict.m_vars.length; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| var cur_var = EasyMeshDict.m_vars[j]; | |||||
| code_helper_var.innerHTML += " > "; | |||||
| var k = 0; | |||||
| for (; k < type_list.length; k++) | |||||
| if (cur_var.m_type == type_list[k]) | |||||
| break; | |||||
| //Bold the used variables | |||||
| if (k < type_list.length) | |||||
| code_helper_var.innerHTML += "<b>" + cur_var.m_type + "</b>"; | |||||
| else | |||||
| code_helper_var.innerHTML += cur_var.m_type; | |||||
| if (cur_var.m_syntax != undefined) | |||||
| { | |||||
| var align_size = 9; | |||||
| var cmd_size = cur_var.m_type.length + 3; | |||||
| for (var m = 0; m < cur_var.m_syntax.length; m++) | |||||
| { | |||||
| for (var l = 0; l < align_size - cmd_size; l++) | |||||
| code_helper_var.innerHTML += " "; | |||||
| code_helper_var.innerHTML += cur_var.m_syntax[m] + "<br>"; | |||||
| cmd_size = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| code_helper_cmd[0].innerHTML = "[ ... "; | |||||
| code_helper_cmd[1].innerHTML = ""; | |||||
| code_helper_arg.innerHTML = ""; | |||||
| code_helper_cmt.innerHTML = ""; | |||||
| } | |||||
| } | |||||
| /* -- */ | |||||
| } | } | ||||
| @@ -270,8 +270,8 @@ nacl_div | |||||
| nacl_module = document.getElementById('ID_NaClModule'); | nacl_module = document.getElementById('ID_NaClModule'); | ||||
| mesh_code_module = document.getElementById('DIV_MeshCode'); | mesh_code_module = document.getElementById('DIV_MeshCode'); | ||||
| updateStatus('Rock n\' Roll !!'); | updateStatus('Rock n\' Roll !!'); | ||||
| var progress_bar = document.getElementById('progress_bar'); | |||||
| progress_bar.style.visibility = "hidden"; | |||||
| var progress_bar = document.getElementById('progress_bar'); | |||||
| progress_bar.style.visibility = "hidden"; | |||||
| } | } | ||||
| // The 'message' event handler. This handler is fired when the NaCl module | // The 'message' event handler. This handler is fired when the NaCl module | ||||
| @@ -325,9 +325,9 @@ nacl_div | |||||
| { | { | ||||
| progressBar.max = event.total; | progressBar.max = event.total; | ||||
| progressBar.value = event.loaded; | progressBar.value = event.loaded; | ||||
| var load_progress = ((event.loaded / event.total) * 100.0); | |||||
| status_field.innerHTML = 'Please wait, loading [' + load_progress.toFixed(0) + '%]'; | |||||
| var load_progress = ((event.loaded / event.total) * 100.0); | |||||
| status_field.innerHTML = 'Please wait, loading [' + load_progress.toFixed(0) + '%]'; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -359,14 +359,12 @@ nacl_div | |||||
| <progress id="p" align="left" width="200"></progress> | <progress id="p" align="left" width="200"></progress> | ||||
| </div> | </div> | ||||
| <div id="DIV_nacl_div"> | <div id="DIV_nacl_div"> | ||||
| <!-- | |||||
| <param name="wmode" value="opaque"/> | <param name="wmode" value="opaque"/> | ||||
| <embed name="nacl_module" | <embed name="nacl_module" | ||||
| id="ID_NaClModule" | id="ID_NaClModule" | ||||
| width=770 height=200 | width=770 height=200 | ||||
| src="meshviewer_nacl.nmf" | src="meshviewer_nacl.nmf" | ||||
| type="application/x-nacl" /> | type="application/x-nacl" /> | ||||
| --> | |||||
| </div> | </div> | ||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| var listener = document.getElementById('listener'); | var listener = document.getElementById('listener'); | ||||