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

📄 cmd.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 3 页
字号:
            CmdCommandAliasPrint( pMvsis, ( Mv_Alias * ) value );        }        return 0;    }    /* delete any existing alias */    key = argv[1];    if ( avl_delete( pMvsis->tAliases, &key, &value ) )    {        CmdCommandAliasFree( ( Mv_Alias * ) value );    }    CmdCommandAliasAdd( pMvsis, argv[1], argc - 2, argv + 2 );    return 0;  usage:    fprintf( pMvsis->Err, "usage: alias [-h] [command [string]]\n" );    fprintf( pMvsis->Err, "   -h \t\tprint the command usage\n" );    return ( 1 );}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandUnalias( 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->tAliases, &key, &value ) )        {            CmdCommandAliasFree( ( Mv_Alias * ) value );        }    }    return 0;  usage:    fprintf( pMvsis->Err, "usage: unalias [-h] alias_names\n" );    fprintf( pMvsis->Err, "   -h \t\tprint the command usage\n" );    return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandHelp( Mv_Frame_t * pMvsis, int argc, char **argv ){    bool fPrintAll;    int c;    fPrintAll = 0;    util_getopt_reset();    while ( ( c = util_getopt( argc, argv, "ah" ) ) != EOF )    {        switch ( c )        {        case 'a':            case 'v':                fPrintAll ^= 1;                break;            break;        case 'h':            goto usage;            break;        default:            goto usage;        }    }    if ( argc != util_optind )        goto usage;    CmdCommandPrint( pMvsis, fPrintAll );    return 0;usage:    fprintf( pMvsis->Err, "usage: help [-a] [-h]\n" );    fprintf( pMvsis->Err, "       prints the list of available commands by group\n" );    fprintf( pMvsis->Err, " -a       toggle printing hidden commands [default = %s]\n", fPrintAll? "yes": "no" );    fprintf( pMvsis->Err, " -h       print the command usage\n" );    return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandSource( Mv_Frame_t * pMvsis, int argc, char **argv ){    int c, echo, prompt, silent, interactive, quit_count, lp_count;    int status = 0;             /* initialize so that lint doesn't complain */    int lp_file_index, did_subst;    char *prompt_string, *real_filename, line[MAX_STR], *command;    FILE *fp;    interactive = silent = prompt = echo = 0;    util_getopt_reset();    while ( ( c = util_getopt( argc, argv, "hipsx" ) ) != EOF )    {        switch ( c )        {        case 'h':            goto usage;            break;        case 'i':               /* a hack to distinguish EOF from stdin */            interactive = 1;            break;        case 'p':            prompt = 1;            break;        case 's':            silent = 1;            break;        case 'x':            echo = 1;            break;        default:            goto usage;        }    }    /* added to avoid core-dumping when no script file is specified */    if ( argc == util_optind )    {        goto usage;    }    lp_file_index = util_optind;    lp_count = 0;    /*     * FIX (Tom, 5/7/95):  I'm not sure what the purpose of this outer do loop     * is. In particular, lp_file_index is never modified in the loop, so it     * looks it would just read the same file over again.  Also, SIS had     * lp_count initialized to -1, and hence, any file sourced by SIS (if -l or     * -t options on "source" were used in SIS) would actually be executed     * twice.     */    do    {        lp_count++;             /* increment the loop counter */        fp = CmdFileOpen( pMvsis, argv[lp_file_index], "r", &real_filename, silent );        if ( fp == NULL )        {            FREE( real_filename );            return !silent;     /* error return if not silent */        }        quit_count = 0;        do        {            if ( prompt )            {                prompt_string = Cmd_FlagReadByName( pMvsis, "prompt" );                if ( prompt_string == NIL( char ) )                {                    prompt_string = "vis> ";                }            }            else            {                prompt_string = NIL( char );            }            /* clear errors -- e.g., EOF reached from stdin */            clearerr( fp );            /* read another command line *///      if (CmdFgetsFilec(line, MAX_STR, fp, prompt_string) == NULL) {//      Mv_UtilsPrintPrompt(prompt_string);//      fflush(stdout);            if ( fgets( line, MAX_STR, fp ) == NULL )            {                if ( interactive )                {                    if ( quit_count++ < 5 )                    {                        fprintf( pMvsis->Err,                                          "\nUse \"quit\" to leave VIS.\n" );                        continue;                    }                    status = -1;    /* fake a 'quit' */                }                else                {                    status = 0; /* successful end of 'source' ; loop? */                }                break;            }            quit_count = 0;            if ( echo )            {                fprintf( pMvsis->Out, "%s", line );            }            command = CmdHistorySubstitution( pMvsis, line, &did_subst );            if ( command == NIL( char ) )            {                status = 1;                break;            }            if ( did_subst )            {                if ( interactive )                {                    fprintf( pMvsis->Out, "%s\n", command );                }            }            if ( command != line )            {                ( void ) strcpy( line, command );            }            if ( interactive && *line != '\0' )            {                array_insert_last( char *, pMvsis->aHistory,  util_strsav( line ) );                if ( pMvsis->Hst != NIL( FILE ) )                {                    fprintf( pMvsis->Hst, "%s\n", line );                    ( void ) fflush( pMvsis->Hst );                }            }            status = Cmd_CommandExecute( pMvsis, line );        }        while ( status == 0 );        if ( fp != stdin )        {            if ( status > 0 )            {                fprintf( pMvsis->Err,                                  "** cmd error: aborting 'source %s'\n",                                  real_filename );            }            ( void ) fclose( fp );        }        FREE( real_filename );    }    while ( ( status == 0 ) && ( lp_count <= 0 ) );    return status;  usage:    fprintf( pMvsis->Err, "usage: source [-h] [-p] [-s] [-x] file_name\n" );    fprintf( pMvsis->Err, "\t-h     print the command usage\n" );    fprintf( pMvsis->Err, "\t-p     supply prompt before reading each line\n" );    fprintf( pMvsis->Err, "\t-s     silently ignore nonexistant file\n" );    fprintf( pMvsis->Err, "\t-x     echo each line as it is executed\n" );    return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/int CmdCommandSetVariable( Mv_Frame_t * pMvsis, int argc, char **argv ){    char *flag_value, *key, *value;    avl_generator *gen;    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 == 0 || argc > 3 )    {        goto usage;    }    else if ( argc == 1 )    {        avl_foreach_item( pMvsis->tFlags, gen, AVL_FORWARD, &key, &value )        {            fprintf( pMvsis->Out, "%s\t%s\n", key, value );        }        return 0;    }    else    {        key = argv[1];        if ( avl_delete( pMvsis->tFlags, &key, &value ) )        {            FREE( key );            FREE( value );        }        flag_value = argc == 2 ? util_strsav( "" ) : util_strsav( argv[2] );        ( void ) avl_insert( pMvsis->tFlags, util_strsav( argv[1] ),                             flag_value );        if ( strcmp( argv[1], "mvsisout" ) == 0 )        {            if ( pMvsis->Out != stdout )            {                ( void ) fclose( pMvsis->Out );            }            if ( strcmp( flag_value, "" ) == 0 )            {                flag_value = "-";            }            pMvsis->Out = CmdFileOpen( pMvsis, flag_value, "w", NIL( char * ), 0 );            if ( pMvsis->Out == NULL )            {                pMvsis->Out = stdout;            }#if HAVE_SETVBUF            setvbuf( pMvsis->Out, ( char * ) NULL, _IOLBF, 0 );#endif        }        if ( strcmp( argv[1], "mvsiserr" ) == 0 )        {            if ( pMvsis->Err != stderr )            {                ( void ) fclose( pMvsis->Err );            }            if ( strcmp( flag_value, "" ) == 0 )            {                flag_value = "-";            }            pMvsis->Err = CmdFileOpen( pMvsis, flag_value, "w", NIL( char * ), 0 );            if ( pMvsis->Err == NULL )            {                pMvsis->Err = stderr;            }#if HAVE_SETVBUF            setvbuf( pMvsis->Err, ( char * ) NULL, _IOLBF, 0 );#endif        }        if ( strcmp( argv[1], "history" ) == 0 )        {            if ( pMvsis->Hst != NIL( FILE ) )            {                ( void ) fclose( pMvsis->Hst );            }            if ( strcmp( flag_value, "" ) == 0 )            {                pMvsis->Hst = NIL( FILE );

⌨️ 快捷键说明

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