⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmd.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 3 页
字号:
            }            else            {                pMvsis->Hst =                    CmdFileOpen( pMvsis, flag_value, "w", NIL( char * ), 0 );                if ( pMvsis->Hst == NULL )                {                    pMvsis->Hst = NIL( FILE );                }            }        }        return 0;    }  usage:    fprintf( pMvsis->Err, "usage: set [-h] [name] [value]\n" );    fprintf( pMvsis->Err, "\t        sets the value of parameter <name>\n" );    fprintf( pMvsis->Err, "\t-h    : print the command usage\n" );    return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandUnsetVariable( Mv_Frame_t * pMvsis, int argc, char **argv ){    int i;    char *key, *value;    int c;    util_getopt_reset();    while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF )    {        switch ( c )        {        case 'h':            goto usage;            break;        default:            goto usage;        }    }    if ( argc < 2 )    {        goto usage;    }    for ( i = 1; i < argc; i++ )    {        key = argv[i];        if ( avl_delete( pMvsis->tFlags, &key, &value ) )        {            FREE( key );            FREE( value );        }    }    return 0;  usage:    fprintf( pMvsis->Err, "usage: unset [-h] variables \n" );    fprintf( pMvsis->Err, "   -h \t\tprint the command usage\n" );    return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandUndo( Mv_Frame_t * pMvsis, int argc, char **argv ){    if ( pMvsis->pNetCur == NULL )    {        fprintf( pMvsis->Out, "Empty network.\n" );        return 0;    }    // if there are no arguments on the command line    // set the current network to be the network from the previous step    if ( argc == 1 )         return CmdCommandSnatch( pMvsis, argc, argv );    fprintf( pMvsis->Err, "usage: undo\n" );    fprintf( pMvsis->Err, "         sets the current network to be the previously saved network\n" );    return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandSnatch( Mv_Frame_t * pMvsis, int argc, char **argv ){    Ntk_Network_t * pNet;    int iStep, iStepFound;    int nNetsToSave, c;    char * pValue;    int iStepStart, iStepStop;    if ( pMvsis->pNetCur == NULL )    {        fprintf( pMvsis->Out, "Empty network.\n" );        return 0;    }        util_getopt_reset();    while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF )    {        switch ( c )        {            case 'h':                goto usage;            default:                goto usage;        }    }     // get the number of networks to save    pValue = Cmd_FlagReadByName( pMvsis, "savesteps" );    // if the value of steps to save is not set, assume 1-level undo    if ( pValue == NULL )        nNetsToSave = 1;    else         nNetsToSave = atoi(pValue);    // if there are no arguments on the command line    // set the current network to be the network from the previous step    if ( argc == 1 )     {        // get the previously saved network        pNet = Ntk_NetworkReadBackup(pMvsis->pNetCur);        if ( pNet == NULL )            fprintf( pMvsis->Out, "There is no previously saved network.\n" );        else // set the current network to be the copy of the previous one            Mv_FrameSetCurrentNetwork( pMvsis, Ntk_NetworkDup(pNet, Ntk_NetworkReadMan(pNet)) );         return 0;    }    if ( argc == 2 ) // the second argument is the number of the step to return to    {        // read the number of the step to return to        iStep = atoi(argv[1]);        // check whether it is reasonable        if ( iStep >= pMvsis->nSteps )        {            iStepStart = pMvsis->nSteps - nNetsToSave;            if ( iStepStart <= 0 )                iStepStart = 1;            iStepStop  = pMvsis->nSteps;            if ( iStepStop <= 0 )                iStepStop = 1;            if ( iStepStart == iStepStop )                fprintf( pMvsis->Out, "Can only snatch step %d.\n", iStepStop );            else                fprintf( pMvsis->Out, "Can only snatch steps %d-%d.\n", iStepStart, iStepStop );        }        else if ( iStep < 0 )            fprintf( pMvsis->Out, "Cannot snatch step %d.\n", iStep );        else if ( iStep == 0 )            Mv_FrameDeleteAllNetworks( pMvsis );        else         {            // scroll backward through the list of networks            // to determine if such a network exist            iStepFound = 0;            for ( pNet = pMvsis->pNetCur; pNet; pNet = Ntk_NetworkReadBackup(pNet) )                if ( (iStepFound = Ntk_NetworkReadStep(pNet)) == iStep )                     break;            if ( pNet == NULL )            {                iStepStart = iStepFound;                if ( iStepStart <= 0 )                    iStepStart = 1;                iStepStop  = pMvsis->nSteps;                if ( iStepStop <= 0 )                    iStepStop = 1;                if ( iStepStart == iStepStop )                    fprintf( pMvsis->Out, "Can only snatch step %d.\n", iStepStop );                else                    fprintf( pMvsis->Out, "Can only snatch steps %d-%d.\n", iStepStart, iStepStop );            }            else                Mv_FrameSetCurrentNetwork( pMvsis, Ntk_NetworkDup(pNet, Ntk_NetworkReadMan(pNet)) );        }        return 0;    }usage:    fprintf( pMvsis->Err, "usage: snatch <num>\n" );    fprintf( pMvsis->Err, "         set the current network to the network on the given step\n" );    fprintf( pMvsis->Err, "<num> :  level to return to [default = previous]\n" );    return 1;}#if 0/**Function********************************************************************  Synopsis    [Donald's version.]  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandUndo( Mv_Frame_t * pMvsis, int argc, char **argv ){    Ntk_Network_t * pNetTemp;    int id, c;    while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF )    {        switch ( c )        {        case 'h':            goto usage;            break;        default:            goto usage;        }    }    if (util_optind <= argc) {	pNetTemp = pMvsis->pNet;	pMvsis->pNet = pMvsis->pNetSaved;	pMvsis->pNetSaved = pNetTemp;    }    id = atoi(argv[util_optind]);    pNetTemp = Cmd_HistoryGetSnapshot(pMvsis, id);    if (!pNetTemp) 	fprintf( pMvsis->Err, "Snapshot %d does not exist\n", id);    else	pMvsis->pNet = Ntk_NetworkDup(pNetTemp, Ntk_NetworkReadMan(pNetTemp));    return 0;usage:    fprintf( pMvsis->Err, "usage: undo\n" );    fprintf( pMvsis->Err, "       swaps the current network and the backup network\n" );    return 1;}#endif#ifdef WIN32/**Function*************************************************************  Synopsis    [Command to print the contents of the current directory (Windows).]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/#include <io.h>// these structures are defined in <io.h> but are for some reason invisibletypedef unsigned long _fsize_t; // Could be 64 bits for Win32struct _finddata_t {    unsigned    attrib;    time_t      time_create;    // -1 for FAT file systems     time_t      time_access;    // -1 for FAT file systems     time_t      time_write;    _fsize_t    size;    char        name[260];};extern long _findfirst( char *filespec, struct _finddata_t *fileinfo );extern int  _findnext( long handle, struct _finddata_t *fileinfo );extern int  _findclose( long handle );int CmdCommandLs( Mv_Frame_t * pMvsis, int argc, char **argv ){	struct _finddata_t c_file;	long   hFile;	int    fLong = 0;	int    fOnlyBLIF = 0;	char   Buffer[25];	int    Counter = 0;	int    fPrintedNewLine;    char   c;	util_getopt_reset();	while ( (c = util_getopt(argc, argv, "lb") ) != EOF )	{		switch (c)		{			case 'l':			  fLong = 1;			  break;			case 'b':			  fOnlyBLIF = 1;			  break;			default:			  goto usage;		}	}	// find first .mv file in current directory	if( (hFile = _findfirst( ((fOnlyBLIF)? "*.mv": "*.*"), &c_file )) == -1L )	{		if ( fOnlyBLIF )			fprintf( pMvsis->Out, "No *.mv files in the current directory.\n" );		else			fprintf( pMvsis->Out, "No files in the current directory.\n" );	}	else	{		if ( fLong )		{			fprintf( pMvsis->Out, " File              Date           Size |  File             Date           Size \n" );			fprintf( pMvsis->Out, " ----------------------------------------------------------------------------- \n" );			do			{				strcpy( Buffer, ctime( &(c_file.time_write) ) );				Buffer[16] = 0;				fprintf( pMvsis->Out, " %-17s %.24s%7ld", c_file.name, Buffer+4, c_file.size );				if ( ++Counter % 2 == 0 )				{					fprintf( pMvsis->Out, "\n" );					fPrintedNewLine = 1;				}				else				{					fprintf( pMvsis->Out, " |" );					fPrintedNewLine = 0;				}			}			while( _findnext( hFile, &c_file ) == 0 );		}		else		{			do			{				fprintf( pMvsis->Out, " %-18s", c_file.name );				if ( ++Counter % 4 == 0 )				{					fprintf( pMvsis->Out, "\n" );					fPrintedNewLine = 1;				}				else				{					fprintf( pMvsis->Out, " " );					fPrintedNewLine = 0;				}			}			while( _findnext( hFile, &c_file ) == 0 );		}		if ( !fPrintedNewLine )			fprintf( pMvsis->Out, "\n" );		_findclose( hFile );	}	return 0;usage:	fprintf( pMvsis->Err, "Usage: ls [-l] [-b]\n" );	fprintf( pMvsis->Err, "       print the file names in the current directory\n" );	fprintf( pMvsis->Err, "        -l : print in the long format [default = short]\n" );	fprintf( pMvsis->Err, "        -b : print only .mv files [default = all]\n" );	return 1; }#endif///////////////////////////////////////////////////////////////////////////                       END OF FILE                                ///////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -