Adding switch 'show -d' to keep (not delete) the .dot file after generating the .ps file.

This commit is contained in:
Alan Mishchenko 2023-03-01 19:00:44 +07:00
parent a79dc18eb2
commit 3370370101
7 changed files with 30 additions and 24 deletions

View File

@ -340,7 +340,7 @@ void Aig_WriteDotAig( Aig_Man_t * pMan, char * pFileName, int fHaig, Vec_Ptr_t *
***********************************************************************/
void Aig_ManShow( Aig_Man_t * pMan, int fHaig, Vec_Ptr_t * vBold )
{
extern void Abc_ShowFile( char * FileNameDot );
extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
char FileNameDot[200];
FILE * pFile;
// create the file name
@ -355,7 +355,7 @@ void Aig_ManShow( Aig_Man_t * pMan, int fHaig, Vec_Ptr_t * vBold )
// generate the file
Aig_WriteDotAig( pMan, FileNameDot, fHaig, vBold );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}

View File

@ -1125,7 +1125,7 @@ void Gia_ShowProcess( Gia_Man_t * p, char * pFileName, Vec_Int_t * vBold, Vec_In
}
void Gia_ManShow( Gia_Man_t * pMan, Vec_Int_t * vBold, int fAdders, int fFadds, int fPath )
{
extern void Abc_ShowFile( char * FileNameDot );
extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
char FileNameDot[200];
FILE * pFile;
Vec_Int_t * vXors = NULL, * vAdds = fAdders ? Ree_ManComputeCuts( pMan, &vXors, 0 ) : NULL;
@ -1145,7 +1145,7 @@ void Gia_ManShow( Gia_Man_t * pMan, Vec_Int_t * vBold, int fAdders, int fFadds,
else
Gia_WriteDotAigSimple( pMan, FileNameDot, vBold );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
Vec_IntFreeP( &vAdds );
Vec_IntFreeP( &vXors );

View File

@ -46,7 +46,7 @@ static void Ivy_WriteDotAig( Ivy_Man_t * pMan, char * pFileName, int fHaig, Vec_
***********************************************************************/
void Ivy_ManShow( Ivy_Man_t * pMan, int fHaig, Vec_Ptr_t * vBold )
{
extern void Abc_ShowFile( char * FileNameDot );
extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
static int Counter = 0;
char FileNameDot[200];
FILE * pFile;
@ -63,7 +63,7 @@ void Ivy_ManShow( Ivy_Man_t * pMan, int fHaig, Vec_Ptr_t * vBold )
// generate the file
Ivy_WriteDotAig( pMan, FileNameDot, fHaig, vBold );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}
/**Function*************************************************************

View File

@ -40,7 +40,7 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
extern void Abc_ShowFile( char * FileNameDot );
extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
static void Abc_ShowGetFileName( char * pName, char * pBuffer );
////////////////////////////////////////////////////////////////////////
@ -71,7 +71,7 @@ void Abc_NodeShowBddOne( DdManager * dd, DdNode * bFunc )
}
Cudd_DumpDot( dd, 1, (DdNode **)&bFunc, NULL, NULL, pFile );
fclose( pFile );
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}
/**Function*************************************************************
@ -119,7 +119,7 @@ void Abc_NodeShowBdd( Abc_Obj_t * pNode, int fCompl )
fclose( pFile );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}
void Abc_NtkShowBdd( Abc_Ntk_t * pNtk, int fCompl, int fReorder )
{
@ -181,7 +181,7 @@ void Abc_NtkShowBdd( Abc_Ntk_t * pNtk, int fCompl, int fReorder )
Abc_NtkCleanCopy( pNtk );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}
#else
@ -246,7 +246,7 @@ void Abc_NodeShowCut( Abc_Obj_t * pNode, int nNodeSizeMax, int nConeSizeMax )
Abc_NtkManCutStop( p );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}
/**Function*************************************************************
@ -260,7 +260,7 @@ void Abc_NodeShowCut( Abc_Obj_t * pNode, int nNodeSizeMax, int nConeSizeMax )
SeeAlso []
***********************************************************************/
void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse )
void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse, int fKeepDot )
{
FILE * pFile;
Abc_Ntk_t * pNtk;
@ -307,7 +307,7 @@ void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse )
Vec_PtrFree( vNodes );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, fKeepDot );
Abc_NtkDelete( pNtk );
}
@ -323,7 +323,7 @@ void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse )
SeeAlso []
***********************************************************************/
void Abc_ShowFile( char * FileNameDot )
void Abc_ShowFile( char * FileNameDot, int fKeepDot )
{
FILE * pFile;
char * FileGeneric;
@ -386,7 +386,7 @@ void Abc_ShowFile( char * FileNameDot )
// spawn the viewer
#ifdef WIN32
_unlink( FileNameDot );
if ( !fKeepDot ) _unlink( FileNameDot );
if ( _spawnl( _P_NOWAIT, pGsNameWin, pGsNameWin, FileNamePs, NULL ) == -1 )
if ( _spawnl( _P_NOWAIT, "C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe",
"C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe", FileNamePs, NULL ) == -1 )
@ -399,7 +399,7 @@ void Abc_ShowFile( char * FileNameDot )
#else
{
char CommandPs[1000];
unlink( FileNameDot );
if ( !fKeepDot ) unlink( FileNameDot );
sprintf( CommandPs, "%s %s &", pGsNameUnix, FileNamePs );
if ( system( CommandPs ) == -1 )
{
@ -516,7 +516,7 @@ void Abc_NtkShowFlopDependency( Abc_Ntk_t * pNtk )
// write the DOT file
Abc_NtkWriteFlopDependency( pNtk, FileNameDot );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}

View File

@ -3160,7 +3160,8 @@ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv )
int fGateNames;
int fUseReverse;
int fFlopDep;
extern void Abc_NtkShow( Abc_Ntk_t * pNtk, int fGateNames, int fSeq, int fUseReverse );
int fKeepDot;
extern void Abc_NtkShow( Abc_Ntk_t * pNtk, int fGateNames, int fSeq, int fUseReverse, int fKeepDot );
extern void Abc_NtkShowFlopDependency( Abc_Ntk_t * pNtk );
// set defaults
@ -3168,8 +3169,9 @@ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv )
fGateNames = 0;
fUseReverse = 1;
fFlopDep = 0;
fKeepDot = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "rsgfh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "rsgfdh" ) ) != EOF )
{
switch ( c )
{
@ -3185,6 +3187,9 @@ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'f':
fFlopDep ^= 1;
break;
case 'd':
fKeepDot ^= 1;
break;
default:
goto usage;
}
@ -3199,11 +3204,11 @@ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( fFlopDep )
Abc_NtkShowFlopDependency( pNtk );
else
Abc_NtkShow( pNtk, fGateNames, fSeq, fUseReverse );
Abc_NtkShow( pNtk, fGateNames, fSeq, fUseReverse, fKeepDot );
return 0;
usage:
Abc_Print( -2, "usage: show [-srgfh]\n" );
Abc_Print( -2, "usage: show [-srgfdh]\n" );
Abc_Print( -2, " visualizes the network structure using DOT and GSVIEW\n" );
#ifdef WIN32
Abc_Print( -2, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" );
@ -3213,6 +3218,7 @@ usage:
Abc_Print( -2, "\t-r : toggles ordering nodes in reverse order [default = %s].\n", fUseReverse? "yes": "no" );
Abc_Print( -2, "\t-g : toggles printing gate names for mapped network [default = %s].\n", fGateNames? "yes": "no" );
Abc_Print( -2, "\t-f : toggles visualizing flop dependency graph [default = %s].\n", fFlopDep? "yes": "no" );
Abc_Print( -2, "\t-d : toggles keeping the .dot file used to produce the .ps file [default = %s].\n", fKeepDot? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}

View File

@ -340,7 +340,7 @@ Abc_Ntk_t * Abc_NtkReachability( Abc_Ntk_t * pNtkRel, int nIters, int fVerbose )
// compute the network composed of the initial states
pNtkFront = Abc_NtkInitialState( pNtkRel );
pNtkReached = Abc_NtkDup( pNtkFront );
//Abc_NtkShow( pNtkReached, 0, 0, 0 );
//Abc_NtkShow( pNtkReached, 0, 0, 0, 0 );
// if ( fVerbose )
// printf( "Transition relation = %6d.\n", Abc_NtkNodeNum(pNtkRel) );

View File

@ -358,7 +358,7 @@ void Wlc_NtkDumpDot( Wlc_Ntk_t * p, char * pFileName, Vec_Int_t * vBold )
***********************************************************************/
void Wlc_NtkShow( Wlc_Ntk_t * p, Vec_Int_t * vBold )
{
extern void Abc_ShowFile( char * FileNameDot );
extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
FILE * pFile;
char FileNameDot[200];
char * pName = Extra_FileDesignName(p->pName);
@ -377,7 +377,7 @@ void Wlc_NtkShow( Wlc_Ntk_t * p, Vec_Int_t * vBold )
// generate the file
Wlc_NtkDumpDot( p, FileNameDot, vBold );
// visualize the file
Abc_ShowFile( FileNameDot );
Abc_ShowFile( FileNameDot, 0 );
}
////////////////////////////////////////////////////////////////////////