Skip to content

Commit 916f700

Browse files
committed
Updating script runner.
1 parent 0b1d7c6 commit 916f700

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/base/abci/abc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7698,9 +7698,9 @@ int Abc_CommandRunGen( Abc_Frame_t * pAbc, int argc, char ** argv )
76987698
***********************************************************************/
76997699
int Abc_CommandRunScript( Abc_Frame_t * pAbc, int argc, char ** argv )
77007700
{
7701-
int c, nIters = 10, nBeg = 1, nAdd = 1, fVerbose = 0; char * pScript = NULL, * pSpot = NULL;
7701+
int c, nIters = 10, nBeg = 1, nAdd = 1, fReverse = 0, fVerbose = 0; char * pScript = NULL, * pSpot = NULL;
77027702
Extra_UtilGetoptReset();
7703-
while ( ( c = Extra_UtilGetopt( argc, argv, "IBASvh" ) ) != EOF )
7703+
while ( ( c = Extra_UtilGetopt( argc, argv, "IBASrvh" ) ) != EOF )
77047704
{
77057705
switch ( c )
77067706
{
@@ -7740,6 +7740,9 @@ int Abc_CommandRunScript( Abc_Frame_t * pAbc, int argc, char ** argv )
77407740
pScript = argv[globalUtilOptind];
77417741
globalUtilOptind++;
77427742
break;
7743+
case 'r':
7744+
fReverse ^= 1;
7745+
break;
77437746
case 'v':
77447747
fVerbose ^= 1;
77457748
break;
@@ -7765,7 +7768,7 @@ int Abc_CommandRunScript( Abc_Frame_t * pAbc, int argc, char ** argv )
77657768
{
77667769
char pCommLine[1000] = {0};
77677770
char pNumber[10] = {0};
7768-
sprintf( pNumber, "%d", nBeg + c*nAdd );
7771+
sprintf( pNumber, "%d", fReverse ? nBeg - c*nAdd : nBeg + c*nAdd );
77697772
strcpy( pCommLine, pScript );
77707773
pCommLine[(int)(pSpot - pScript)] = 0;
77717774
strcat( pCommLine, pNumber );
@@ -7781,12 +7784,13 @@ int Abc_CommandRunScript( Abc_Frame_t * pAbc, int argc, char ** argv )
77817784
return 0;
77827785

77837786
usage:
7784-
Abc_Print( -2, "usage: runscript [-IBA num] [-S str] [-vh]\n" );
7787+
Abc_Print( -2, "usage: runscript [-IBA num] [-S str] [-rvh]\n" );
77857788
Abc_Print( -2, "\t running the script with different values\n" );
77867789
Abc_Print( -2, "\t-I <num> : the number of iterations [default = %d]\n", nIters );
77877790
Abc_Print( -2, "\t-B <num> : the starting number [default = %d]\n", nBeg );
77887791
Abc_Print( -2, "\t-A <num> : the increment added in each iteration [default = %d]\n", nAdd );
77897792
Abc_Print( -2, "\t-S <str> : the script to iterate [default = none]\n" );
7793+
Abc_Print( -2, "\t-r : toggle reversing the order of counting [default = %s]\n", fReverse? "yes": "no" );
77907794
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
77917795
Abc_Print( -2, "\t-h : print the command usage\n");
77927796
return 1;

0 commit comments

Comments
 (0)