|
@ -32,6 +32,7 @@ |
|
|
height: 100vh; |
|
|
height: 100vh; |
|
|
overscroll-behavior: none; |
|
|
overscroll-behavior: none; |
|
|
background: #F0EAD6; |
|
|
background: #F0EAD6; |
|
|
|
|
|
padding-top: 10px; |
|
|
|
|
|
|
|
|
direction: ltr; |
|
|
direction: ltr; |
|
|
font: 16px HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; |
|
|
font: 16px HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; |
|
@ -119,6 +120,10 @@ |
|
|
width: 30px; |
|
|
width: 30px; |
|
|
height: 45px; |
|
|
height: 45px; |
|
|
} |
|
|
} |
|
|
|
|
|
.struct-info-byte-alignment { |
|
|
|
|
|
background-color: seagreen; |
|
|
|
|
|
opacity: 0.4; |
|
|
|
|
|
} |
|
|
.struct-info-byte-first { |
|
|
.struct-info-byte-first { |
|
|
border-left-width: 3px; |
|
|
border-left-width: 3px; |
|
|
} |
|
|
} |
|
@ -137,8 +142,206 @@ |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
color: white; |
|
|
color: white; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dialog { |
|
|
|
|
|
position: sticky; |
|
|
|
|
|
top: 50vh; |
|
|
|
|
|
left: 50vw; |
|
|
|
|
|
transform: translate(-50%, -50%); |
|
|
|
|
|
padding: 20px; |
|
|
|
|
|
|
|
|
|
|
|
border: none; |
|
|
|
|
|
border-radius: 3px; |
|
|
|
|
|
background-color: #F0EAD6; |
|
|
|
|
|
box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75); |
|
|
|
|
|
|
|
|
|
|
|
max-width: 80vw; |
|
|
|
|
|
max-height: 80vh; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
input:not([type=checkbox]):not([type=radio]) { |
|
|
|
|
|
display: block; |
|
|
|
|
|
height: 2em; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
p { |
|
|
|
|
|
margin: 20px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
input[type=checkbox] { |
|
|
|
|
|
width: 1.2rem; |
|
|
|
|
|
height: 1.2rem; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
label { |
|
|
|
|
|
display: block; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
label > input { |
|
|
|
|
|
margin: 5px 15px 15px 15px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.fix-missing-declaration-dialog-footer { |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: row; |
|
|
|
|
|
justify-content: space-between; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
button { |
|
|
|
|
|
width: 10rem; |
|
|
|
|
|
height: 2rem; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.help-idk { |
|
|
|
|
|
color: darkslategray; |
|
|
|
|
|
font-size: 0.9rem; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.help-idk-container { |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: row; |
|
|
|
|
|
justify-content: flex-end; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
<script> |
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<body> |
|
|
<body> |
|
|
<!-- c code will terminate the body and html tags --> |
|
|
|
|
|
|
|
|
<dialog |
|
|
|
|
|
id="fix-missing-declaration-dialog" |
|
|
|
|
|
> |
|
|
|
|
|
<p>What's the size and alignment of this type on your architecture?</p> |
|
|
|
|
|
<div class="help-idk-container"> |
|
|
|
|
|
<p class="help-idk"> |
|
|
|
|
|
Help, I don't know! |
|
|
|
|
|
</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<label> |
|
|
|
|
|
It's a bitfield! |
|
|
|
|
|
<input |
|
|
|
|
|
type="checkbox" |
|
|
|
|
|
/> |
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
|
|
|
|
<label> |
|
|
|
|
|
size (in bytes) |
|
|
|
|
|
<input |
|
|
|
|
|
type="number" |
|
|
|
|
|
min="1" |
|
|
|
|
|
value="8" |
|
|
|
|
|
/> |
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
|
|
|
|
<label> |
|
|
|
|
|
alignment (in bytes) |
|
|
|
|
|
<input |
|
|
|
|
|
type="number" |
|
|
|
|
|
value="8" |
|
|
|
|
|
/> |
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
|
|
|
|
<footer class="fix-missing-declaration-dialog-footer"> |
|
|
|
|
|
<button |
|
|
|
|
|
onclick="fixMissingDeclDialog.close()" |
|
|
|
|
|
> |
|
|
|
|
|
Confirm |
|
|
|
|
|
</button> |
|
|
|
|
|
</footer> |
|
|
|
|
|
</dialog> |
|
|
|
|
|
<script defer> |
|
|
|
|
|
const fixMissingDeclDialog = document.getElementById("fix-missing-declaration-dialog"); |
|
|
|
|
|
|
|
|
|
|
|
function createWithClasses(e, ...classes) { |
|
|
|
|
|
const elem = document.createElement(e); |
|
|
|
|
|
elem.classList.add(...classes); |
|
|
|
|
|
return elem; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function alignForward(a, b) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function renderStruct(structInfo, containingElement) { |
|
|
|
|
|
const div = createWithClasses("div", "struct-info"); |
|
|
|
|
|
|
|
|
|
|
|
const structInfoHeader = createWithClasses("label", "struct-info-header"); |
|
|
|
|
|
structInfoHeader.innerText = `struct ${structInfo.name} - alias: ${structInfo.alias}`; |
|
|
|
|
|
div.appendChild(structInfoHeader); |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < structInfo.declarations.length; i++) { |
|
|
|
|
|
const decl = structInfo.declarations[i]; |
|
|
|
|
|
|
|
|
|
|
|
const position = i % 2 == 0; |
|
|
|
|
|
const positionClass = position ? "struct-info-declaration-top" : "struct-info-declaration-bottom"; |
|
|
|
|
|
let bytesInStructSoFar = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (decl.size === -1) { |
|
|
|
|
|
const byteGroup = createWithClasses("struct-info-bytegroup"); |
|
|
|
|
|
byteGroup.onclick = fixMissingDeclDialog.showMoodal(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const unknownByte = createWithClasses("div", "struct-info-byte", "struct-info-byte-unknown"); |
|
|
|
|
|
unknownByte.innerText = "?"; |
|
|
|
|
|
byteGroup.appendChild(unknownByte); |
|
|
|
|
|
|
|
|
|
|
|
const declaration = createWithClasses("div", "struct-info-declaration", positionClass); |
|
|
|
|
|
declaration.innerHTML = `${decl.type} <span class="struct-info-declaration-name">${decl.name}</span>`; |
|
|
|
|
|
unknownByte.appendChild(declaration); |
|
|
|
|
|
|
|
|
|
|
|
const ellipsisByte = createWithClasses("div", "struct-info-byte", "struct_info_byte_ellipsis"); |
|
|
|
|
|
ellipsisByte.innerText = "..."; |
|
|
|
|
|
byteGroup.appendChild(ellipsisByte); |
|
|
|
|
|
|
|
|
|
|
|
div.appendChild(byteGroup); |
|
|
|
|
|
} else { |
|
|
|
|
|
// find if we need to align this field - pad some alignment bytes visually if we do. |
|
|
|
|
|
const aligned = alignForward(bytesInStructSoFar, decl.align); |
|
|
|
|
|
const needsAlign = aligned !== bytesInStructSoFar; |
|
|
|
|
|
if (needsAlign) { |
|
|
|
|
|
//sb_concatf("%s", "<div class='struct-info-bytegroup'>"); |
|
|
|
|
|
//for (int a = 0; a < (aligned - bytesInStructSoFar); a++) { |
|
|
|
|
|
// sb_concatf("%s", "<div class='struct-info-byte struct-info-byte-alignment'></div>"); |
|
|
|
|
|
//} |
|
|
|
|
|
//sb_concatf("%s", "</div>"); |
|
|
|
|
|
//bytesInStructSoFar += aligned - bytesInStructSoFar; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// now for the bytes representing the actual field. |
|
|
|
|
|
//sb_concatf("%s", "<div class='struct-info-bytegroup'>"); |
|
|
|
|
|
//for (int b = 0; b < decl->size; b++) { |
|
|
|
|
|
// if (b == 0) { |
|
|
|
|
|
// sb_concatf( |
|
|
|
|
|
// "<div class='struct-info-byte struct-info-byte-first'>" |
|
|
|
|
|
// "<div class='struct-info-declaration %s'>" |
|
|
|
|
|
// "%s <span class='struct-info-declaration-name'>%s</span>" |
|
|
|
|
|
// "</div>" |
|
|
|
|
|
// "</div>" |
|
|
|
|
|
// , positionClass, decl->type, decl->name); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// sb_concatf("%s", "<div class='struct-info-byte'></div>"); |
|
|
|
|
|
// } |
|
|
|
|
|
//} |
|
|
|
|
|
//bytesInStructSoFar += decl->size; |
|
|
|
|
|
//sb_concatf("%s", "</div>"); // end bytegroup |
|
|
|
|
|
} |
|
|
|
|
|
//sb_concatf("%s", "</div></div>"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
containingElement.appendChild(div); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function renderAllStructs() { |
|
|
|
|
|
for (let i = 0; i < window.structs.length; i++) { |
|
|
|
|
|
const structInfo = structs[i]; |
|
|
|
|
|
renderStruct(structInfo, document.body); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
<!-- c code will place a script tag containing all of the data structures in JSON format, and terminate the body and html tags --> |
|
|
|
|
|
|