Modified the "writeall" command to (1) raise an error message when
"writeall force <cell>" is used but <cell> doesn't exist, and (2) to add options "writeall modified" and "writeall noupdate" (which may or may not be useful).
This commit is contained in:
parent
93c4503fa8
commit
5dd0c97dce
|
|
@ -552,6 +552,10 @@ calmaParseStructure(filename)
|
||||||
DBW_ALLWINDOWS, &DBAllButSpaceBits);
|
DBW_ALLWINDOWS, &DBAllButSpaceBits);
|
||||||
DBCellSetModified(cifReadCellDef, TRUE);
|
DBCellSetModified(cifReadCellDef, TRUE);
|
||||||
|
|
||||||
|
/* Only mark cell as needing a timestamp update if the timestamp is zero */
|
||||||
|
if (cifReadCellDef->cd_timestamp != 0)
|
||||||
|
cifReadCellDef->cd_flags &= ~CDGETNEWSTAMP;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign use-identifiers to all the cell uses.
|
* Assign use-identifiers to all the cell uses.
|
||||||
* These identifiers are generated so as to be
|
* These identifiers are generated so as to be
|
||||||
|
|
|
||||||
|
|
@ -1807,26 +1807,52 @@ CmdWire(w, cmd)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define OPT_WRITEALL_FORCE 0
|
||||||
|
#define OPT_WRITEALL_MODIFIED 1
|
||||||
|
#define OPT_WRITEALL_NOUPDATE 2
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdWriteall(w, cmd)
|
CmdWriteall(w, cmd)
|
||||||
MagWindow *w;
|
MagWindow *w;
|
||||||
TxCommand *cmd;
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int cmdWriteallFunc();
|
int cmdWriteallFunc();
|
||||||
static char *force[] = { "force", 0 };
|
int option = -1;
|
||||||
|
static char *writeallOpts[] = { "force", "modified", "noupdate", 0 };
|
||||||
int argc;
|
int argc;
|
||||||
int flags = CDMODIFIED | CDBOXESCHANGED | CDSTAMPSCHANGED;
|
int flags = CDMODIFIED | CDBOXESCHANGED | CDSTAMPSCHANGED;
|
||||||
|
|
||||||
if (cmd->tx_argc >= 2)
|
if (cmd->tx_argc >= 2)
|
||||||
{
|
{
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (Lookup(cmd->tx_argv[1], force) < 0)
|
option = Lookup(cmd->tx_argv[1], writeallOpts);
|
||||||
|
if (option < 0)
|
||||||
{
|
{
|
||||||
TxError("Usage: %s [force [cellname ...]]\n", cmd->tx_argv[0]);
|
TxError("Usage: %s [force|modified|noupdate [cellname ...]]\n",
|
||||||
|
cmd->tx_argv[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (option == OPT_WRITEALL_MODIFIED) flags = CDMODIFIED;
|
||||||
|
|
||||||
|
/* Check if all cells exist */
|
||||||
|
if (cmd->tx_argc > 2)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int notfound = 0;
|
||||||
|
for (i = 2; i < cmd->tx_argc; i++)
|
||||||
|
{
|
||||||
|
if (DBCellLookDef(cmd->tx_argv[i]) == NULL)
|
||||||
|
{
|
||||||
|
TxError("No such cell \"%s\".\n", cmd->tx_argv[i]);
|
||||||
|
notfound++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (notfound == cmd->tx_argc - 2) return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DBUpdateStamps();
|
if (option != OPT_WRITEALL_NOUPDATE)
|
||||||
|
DBUpdateStamps();
|
||||||
|
|
||||||
argc = cmd->tx_argc;
|
argc = cmd->tx_argc;
|
||||||
(void) DBCellSrDefs(flags, cmdWriteallFunc, (ClientData)cmd);
|
(void) DBCellSrDefs(flags, cmdWriteallFunc, (ClientData)cmd);
|
||||||
cmd->tx_argc = argc;
|
cmd->tx_argc = argc;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Write out all modified cells to disk
|
||||||
|
|
||||||
<H3>Usage:</H3>
|
<H3>Usage:</H3>
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
<B>writeall</B> [<B>force</B> <I>cell1 cell2...</I>]<BR><BR>
|
<B>writeall</B> [<B>force</B>|<B>modified</B>|<B>noupdate</B> <I>cell1 cell2...</I>]<BR><BR>
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
<H3>Summary:</H3>
|
<H3>Summary:</H3>
|
||||||
|
|
@ -69,7 +69,16 @@ Write out all modified cells to disk
|
||||||
in the hierarchy with no prompting. If one or more cell names
|
in the hierarchy with no prompting. If one or more cell names
|
||||||
follows <B>write force</B>, the cells listed will be written
|
follows <B>write force</B>, the cells listed will be written
|
||||||
(action "write") and all other cells will be ignored (action
|
(action "write") and all other cells will be ignored (action
|
||||||
"skip").
|
"skip"). <P>
|
||||||
|
|
||||||
|
With the option <B>write modified</B>, the command writes all
|
||||||
|
cells in the hierarchy which have been modified, ignoring those
|
||||||
|
cells marked as needing only a bounding box or timestamp update. <P>
|
||||||
|
|
||||||
|
With the option <B>write noupdate</B>, the command writes all
|
||||||
|
cells in the hierarchy like it would for <B>write force</B>, but
|
||||||
|
it does not update timestamps. <P>
|
||||||
|
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
<H3>Implementation Notes:</H3>
|
<H3>Implementation Notes:</H3>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue