mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-05-20 22:52:09 +02:00
Add "-c" option to "dump" to show constness when dumping variables.
This commit is contained in:
+1
-1
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
|
|||||||
DoReminders();
|
DoReminders();
|
||||||
|
|
||||||
if (DebugFlag & DB_DUMP_VARS) {
|
if (DebugFlag & DB_DUMP_VARS) {
|
||||||
DumpVarTable();
|
DumpVarTable(0);
|
||||||
DumpSysVarByName(NULL);
|
DumpSysVarByName(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ int GetVarValue (char const *str, Value *val);
|
|||||||
int DoSet (Parser *p);
|
int DoSet (Parser *p);
|
||||||
int DoUnset (Parser *p);
|
int DoUnset (Parser *p);
|
||||||
int DoDump (ParsePtr p);
|
int DoDump (ParsePtr p);
|
||||||
void DumpVarTable (void);
|
void DumpVarTable (int dump_constness);
|
||||||
void DestroyVars (int all);
|
void DestroyVars (int all);
|
||||||
int PreserveVar (char const *name);
|
int PreserveVar (char const *name);
|
||||||
int DoPreserve (Parser *p);
|
int DoPreserve (Parser *p);
|
||||||
|
|||||||
@@ -705,17 +705,25 @@ int DoDump(ParsePtr p)
|
|||||||
int r;
|
int r;
|
||||||
Var *v;
|
Var *v;
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
|
int dump_constness = 0;
|
||||||
|
|
||||||
if (PurgeMode) return OK;
|
if (PurgeMode) return OK;
|
||||||
|
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
r = ParseToken(p, &buf);
|
r = ParseToken(p, &buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
if (!strcmp(DBufValue(&buf), "-c")) {
|
||||||
|
dump_constness = 1;
|
||||||
|
DBufFree(&buf);
|
||||||
|
DBufInit(&buf);
|
||||||
|
r = ParseToken(p, &buf);
|
||||||
|
if (r) return r;
|
||||||
|
}
|
||||||
if (!*DBufValue(&buf) ||
|
if (!*DBufValue(&buf) ||
|
||||||
*DBufValue(&buf) == '#' ||
|
*DBufValue(&buf) == '#' ||
|
||||||
*DBufValue(&buf) == ';') {
|
*DBufValue(&buf) == ';') {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
DumpVarTable();
|
DumpVarTable(dump_constness);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
fprintf(ErrFp, "%s %s\n\n", VARIABLE, VALUE);
|
fprintf(ErrFp, "%s %s\n\n", VARIABLE, VALUE);
|
||||||
@@ -730,9 +738,11 @@ int DoDump(ParsePtr p)
|
|||||||
else {
|
else {
|
||||||
fprintf(ErrFp, "%s ", v->name);
|
fprintf(ErrFp, "%s ", v->name);
|
||||||
PrintValue(&(v->v), ErrFp);
|
PrintValue(&(v->v), ErrFp);
|
||||||
/* if (!v->nonconstant) {
|
if (dump_constness) {
|
||||||
fprintf(ErrFp, " .");
|
if (!v->nonconstant) {
|
||||||
} */
|
fprintf(ErrFp, " <const>");
|
||||||
|
}
|
||||||
|
}
|
||||||
fprintf(ErrFp, "\n");
|
fprintf(ErrFp, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,7 +764,7 @@ int DoDump(ParsePtr p)
|
|||||||
/* Dump the variable table to ErrFp. */
|
/* Dump the variable table to ErrFp. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void DumpVarTable(void)
|
void DumpVarTable(int dump_constness)
|
||||||
{
|
{
|
||||||
Var *v;
|
Var *v;
|
||||||
|
|
||||||
@@ -763,9 +773,11 @@ void DumpVarTable(void)
|
|||||||
hash_table_for_each(v, &VHashTbl) {
|
hash_table_for_each(v, &VHashTbl) {
|
||||||
fprintf(ErrFp, "%s ", v->name);
|
fprintf(ErrFp, "%s ", v->name);
|
||||||
PrintValue(&(v->v), ErrFp);
|
PrintValue(&(v->v), ErrFp);
|
||||||
/* if (!v->nonconstant) {
|
if (dump_constness) {
|
||||||
fprintf(ErrFp, " .");
|
if (!v->nonconstant) {
|
||||||
} */
|
fprintf(ErrFp, " <const>");
|
||||||
|
}
|
||||||
|
}
|
||||||
fprintf(ErrFp, "\n");
|
fprintf(ErrFp, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user