示例#1
0
        protected uint WriteData(StreamWriter output, byte[] value, string label = null, bool isGlobal = false)
        {
            uint fieldSize   = UpdateSize(output, value);
            var  symbolValue = new StringBuilder();
            bool first       = true;

            foreach (byte b in value)
            {
                if (!first)
                {
                    symbolValue.Append(", ");
                }
                else
                {
                    first = false;
                }

                symbolValue.Append($"0x{b:x02}");
            }
            WriteSymbol(output, TargetProvider.MapType <byte> (), symbolValue.ToString(), symbolName: label, size: 0, alignBits: 0, isGlobal: isGlobal, isObject: false, alwaysWriteSize: false);

            return(fieldSize);
        }
示例#2
0
 // `alignBits` indicates the number of lowest bits that have to be cleared to 0 in order to align the
 // following data structure, thus `2` would mean "align to 4 bytes", `3' would be "align to 8 bytes"
 // etc. In general, if the data field contains a pointer the alignment should be to the platform's
 // native pointer size, if not it should be 2 (for 4-byte alignment) in the case of the targets we
 // support. Alignment is not necessary for standalone fields (i.e. not parts of a structure)
 protected void WriteSymbol <T> (StreamWriter output, T symbolValue, string symbolName, ulong size, uint alignBits, bool isGlobal, bool isObject, bool alwaysWriteSize)
 {
     WriteSymbol(output, TargetProvider.MapType <T>(), QuoteValue(symbolValue), symbolName, size, alignBits, isGlobal, isObject, alwaysWriteSize);
 }