Avoid tabs in C output.

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Maarten De Braekeleer 2019-10-04 21:10:53 -04:00 committed by Wilson Snyder
parent 771a301f66
commit 977a767477
3 changed files with 6 additions and 24 deletions

View File

@ -325,7 +325,7 @@ void VerilatedVcd::printQuad(vluint64_t n) {
void VerilatedVcd::printTime(vluint64_t timeui) {
// 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)) {
timeui = m_timeLastDump;
static VL_THREAD_LOCAL bool backTime = false;

View File

@ -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) {
// Indent the specified number of spaces. Use spaces.
static char str[MAXSPACE+20];
@ -639,6 +620,8 @@ int V3OutFormatter::endLevels(const char *strg) {
const char* cp = strg;
while (isspace(*cp)) 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
return (0);
case '#': // Preproc directive
@ -680,7 +663,7 @@ int V3OutFormatter::endLevels(const char *strg) {
void V3OutFormatter::puts(const char *strg) {
if (m_prependIndent) {
putsNoTracking(indentStr(endLevels(strg)));
putsNoTracking(indentSpaces(endLevels(strg)));
m_prependIndent = false;
}
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
} else {
m_prependIndent = false;
putsNoTracking(indentStr(endLevels(cp+1)));
putsNoTracking(indentSpaces(endLevels(cp+1)));
}
break;
case ' ':
@ -808,7 +791,7 @@ void V3OutFormatter::putBreak() {
//char s[1000]; sprintf(s, "{%d,%d}", m_column, m_parenVec.top()); putsNoTracking(s);
if (exceededWidth()) {
putcNoTracking('\n');
if (!m_parenVec.empty()) putsNoTracking(indentStr(m_parenVec.top()));
if (!m_parenVec.empty()) putsNoTracking(indentSpaces(m_parenVec.top()));
}
}
}

View File

@ -129,7 +129,6 @@ private:
int m_bracketLevel; // Intenting = { block, indicates number of {'s seen.
int endLevels(const char* strg);
const char* indentStr(int num);
void putcNoTracking(char chr);
public: