Avoid tabs in C output.
Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
parent
771a301f66
commit
977a767477
|
|
@ -325,7 +325,7 @@ void VerilatedVcd::printQuad(vluint64_t n) {
|
||||||
|
|
||||||
void VerilatedVcd::printTime(vluint64_t timeui) {
|
void VerilatedVcd::printTime(vluint64_t timeui) {
|
||||||
// VCD file format specification does not allow non-integers for timestamps
|
// VCD file format specification does not allow non-integers for timestamps
|
||||||
// Dinotrace doesn't mind, but Cadence vvision seems to choke
|
// Dinotrace doesn't mind, but Cadence Vision seems to choke
|
||||||
if (VL_UNLIKELY(timeui < m_timeLastDump)) {
|
if (VL_UNLIKELY(timeui < m_timeLastDump)) {
|
||||||
timeui = m_timeLastDump;
|
timeui = m_timeLastDump;
|
||||||
static VL_THREAD_LOCAL bool backTime = false;
|
static VL_THREAD_LOCAL bool backTime = false;
|
||||||
|
|
|
||||||
|
|
@ -587,25 +587,6 @@ V3OutFormatter::V3OutFormatter(const string& filename, V3OutFormatter::Language
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
const char* V3OutFormatter::indentStr(int num) {
|
|
||||||
// Indent the specified number of spaces. Use tabs as possible.
|
|
||||||
static char str[MAXSPACE+20];
|
|
||||||
char* cp = str;
|
|
||||||
if (num>MAXSPACE) num = MAXSPACE;
|
|
||||||
if (m_lang!=LA_VERILOG && m_lang!=LA_XML) { // verilogPrefixedTree doesn't want tabs
|
|
||||||
while (num>=8) {
|
|
||||||
*cp++ = '\t';
|
|
||||||
num -= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (num>0) {
|
|
||||||
*cp++ = ' ';
|
|
||||||
num --;
|
|
||||||
}
|
|
||||||
*cp++ = '\0';
|
|
||||||
return (str);
|
|
||||||
}
|
|
||||||
|
|
||||||
const string V3OutFormatter::indentSpaces(int num) {
|
const string V3OutFormatter::indentSpaces(int num) {
|
||||||
// Indent the specified number of spaces. Use spaces.
|
// Indent the specified number of spaces. Use spaces.
|
||||||
static char str[MAXSPACE+20];
|
static char str[MAXSPACE+20];
|
||||||
|
|
@ -639,6 +620,8 @@ int V3OutFormatter::endLevels(const char *strg) {
|
||||||
const char* cp = strg;
|
const char* cp = strg;
|
||||||
while (isspace(*cp)) cp++;
|
while (isspace(*cp)) cp++;
|
||||||
switch (*cp) {
|
switch (*cp) {
|
||||||
|
case '\0': // End of string... No need for whitespace before it
|
||||||
|
return (0);
|
||||||
case '\n': // Newlines.. No need for whitespace before it
|
case '\n': // Newlines.. No need for whitespace before it
|
||||||
return (0);
|
return (0);
|
||||||
case '#': // Preproc directive
|
case '#': // Preproc directive
|
||||||
|
|
@ -680,7 +663,7 @@ int V3OutFormatter::endLevels(const char *strg) {
|
||||||
|
|
||||||
void V3OutFormatter::puts(const char *strg) {
|
void V3OutFormatter::puts(const char *strg) {
|
||||||
if (m_prependIndent) {
|
if (m_prependIndent) {
|
||||||
putsNoTracking(indentStr(endLevels(strg)));
|
putsNoTracking(indentSpaces(endLevels(strg)));
|
||||||
m_prependIndent = false;
|
m_prependIndent = false;
|
||||||
}
|
}
|
||||||
bool wordstart = true;
|
bool wordstart = true;
|
||||||
|
|
@ -695,7 +678,7 @@ void V3OutFormatter::puts(const char *strg) {
|
||||||
m_prependIndent = true; // Add the indent later, may be a indentInc/indentDec called between now and then
|
m_prependIndent = true; // Add the indent later, may be a indentInc/indentDec called between now and then
|
||||||
} else {
|
} else {
|
||||||
m_prependIndent = false;
|
m_prependIndent = false;
|
||||||
putsNoTracking(indentStr(endLevels(cp+1)));
|
putsNoTracking(indentSpaces(endLevels(cp+1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ' ':
|
case ' ':
|
||||||
|
|
@ -808,7 +791,7 @@ void V3OutFormatter::putBreak() {
|
||||||
//char s[1000]; sprintf(s, "{%d,%d}", m_column, m_parenVec.top()); putsNoTracking(s);
|
//char s[1000]; sprintf(s, "{%d,%d}", m_column, m_parenVec.top()); putsNoTracking(s);
|
||||||
if (exceededWidth()) {
|
if (exceededWidth()) {
|
||||||
putcNoTracking('\n');
|
putcNoTracking('\n');
|
||||||
if (!m_parenVec.empty()) putsNoTracking(indentStr(m_parenVec.top()));
|
if (!m_parenVec.empty()) putsNoTracking(indentSpaces(m_parenVec.top()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,6 @@ private:
|
||||||
int m_bracketLevel; // Intenting = { block, indicates number of {'s seen.
|
int m_bracketLevel; // Intenting = { block, indicates number of {'s seen.
|
||||||
|
|
||||||
int endLevels(const char* strg);
|
int endLevels(const char* strg);
|
||||||
const char* indentStr(int num);
|
|
||||||
void putcNoTracking(char chr);
|
void putcNoTracking(char chr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue