|
|
@ -9,7 +9,7 @@ module.exports = { |
|
|
|
function formatData (key, data) { |
|
|
|
function formatData (key, data) { |
|
|
|
var style = fontColor(data) |
|
|
|
var style = fontColor(data) |
|
|
|
var type = '' |
|
|
|
var type = '' |
|
|
|
if (data.type !== 'array' && data.type !== 'struct') { |
|
|
|
if (!isArray(data.type) && !isStruct(data.type)) { |
|
|
|
type = data.type |
|
|
|
type = data.type |
|
|
|
} |
|
|
|
} |
|
|
|
return yo`<label>${key}: <label style=${style}>${data.self}</label><label style='font-style:italic'> ${type}</label></label>` |
|
|
|
return yo`<label>${key}: <label style=${style}>${data.self}</label><label style='font-style:italic'> ${type}</label></label>` |
|
|
@ -17,10 +17,10 @@ function formatData (key, data) { |
|
|
|
|
|
|
|
|
|
|
|
function extractData (item, key) { |
|
|
|
function extractData (item, key) { |
|
|
|
var ret = {} |
|
|
|
var ret = {} |
|
|
|
if (item.type === 'array') { |
|
|
|
if (isArray(item.type)) { |
|
|
|
ret.children = item.value || [] |
|
|
|
ret.children = item.value || [] |
|
|
|
ret.self = 'Array' + '[' + ret.children.length + ']' |
|
|
|
ret.self = item.type |
|
|
|
} else if (item.type === 'struct') { |
|
|
|
} else if (isStruct(item.type)) { |
|
|
|
ret.children = item.value || [] |
|
|
|
ret.children = item.value || [] |
|
|
|
ret.self = 'Struct' + '{' + Object.keys(ret.children).length + '}' |
|
|
|
ret.self = 'Struct' + '{' + Object.keys(ret.children).length + '}' |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -33,7 +33,7 @@ function extractData (item, key) { |
|
|
|
|
|
|
|
|
|
|
|
function fontColor (data) { |
|
|
|
function fontColor (data) { |
|
|
|
var color = '#124B46' |
|
|
|
var color = '#124B46' |
|
|
|
if (data.type === 'array' || data.type === 'struct') { |
|
|
|
if (isArray(data.type) || isStruct(data.type)) { |
|
|
|
color = '#847979' |
|
|
|
color = '#847979' |
|
|
|
} else if (data.type.indexOf('uint') === 0 || |
|
|
|
} else if (data.type.indexOf('uint') === 0 || |
|
|
|
data.type.indexOf('int') === 0 || |
|
|
|
data.type.indexOf('int') === 0 || |
|
|
@ -45,3 +45,11 @@ function fontColor (data) { |
|
|
|
} |
|
|
|
} |
|
|
|
return 'color:' + color |
|
|
|
return 'color:' + color |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isArray (type) { |
|
|
|
|
|
|
|
return type.lastIndexOf(']') === type.length - 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isStruct (type) { |
|
|
|
|
|
|
|
return type.indexOf('struct') === 0 |
|
|
|
|
|
|
|
} |
|
|
|