在TCL中使用多个参数启动问题程序(vcom) [英] Problem starting program (vcom) with multiple arguments in TCL

查看:271
本文介绍了在TCL中使用多个参数启动问题程序(vcom)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从带有附加选项的TCL脚本启动程序(vcom):

I'm trying to start a program (vcom) from a TCL script with extra options:

set compilationArgs "-quiet -93"
vcom $compilationArgs -work work polar2rect/sc_corproc.vhd

但是当我运行它时,出现以下错误消息:

But when I run this, I get following error message:

# Model Technology ModelSim ALTERA vcom 6.5e Compiler 2010.02 Feb 27 2010
# ** Error: (vcom-1902) Option "-quiet -93" is either unknown, requires an argument, or was given with a bad argument.
# Use the -help option for complete vcom usage.
# /opt/altera/10.0/modelsim_ase/linuxaloem/vcom failed.

TCL似乎将两个额外的选项(-quiet)和(-93)作为一个选项传递给vcom.如果我仅使用这两个选项之一,它将起作用.如果我运行(vcom -93 -quiet -work work polar2rect/sc_corproc.vhd),它也可以工作.

TCL seems to pass the two extra options (-quiet) and (-93) as one option to vcom. If I use only one of these two options it works. And if I run (vcom -93 -quiet -work work polar2rect/sc_corproc.vhd) it also works.

我该如何解决?

谢谢, 亨德里克.

推荐答案

问题"是Tcl在管理空间时非常小心.如果您输入的参数中带有空格(例如Windows计算机上的许多完整文件名),这将非常有用,但是如果您希望列表自动分解,有时可能会令人沮丧.解决方法是向Tcl指示您要将此 拆分为多个单词.

The "problem" is that Tcl's being careful about managing spaces. This is very useful if you've got arguments with spaces in (such as many full filenames on Windows machines) but can sometimes be frustrating if you wanted the list to be broken up automatically. The fix is to indicate to Tcl that this is something that you want split into multiple words.

最佳答案至少需要Tcl 8.5(找出info tclversioninfo patchlevelpackage require Tcl的版本).

The best answer requires at least Tcl 8.5 (find out what version you've got with info tclversion, info patchlevel, or package require Tcl).

vcom {*}$compilationArgs -work work polar2rect/sc_corproc.vhd

如果您是根据旧版本的Tcl构建的,则需要使用它:

If you're built against an older version of Tcl, you'll need this instead:

eval vcom $compilationArgs -work work polar2rect/sc_corproc.vhd

(或者,这是错误的纠正,但是几乎没有人因为明显的原因而烦恼)

(Or this, to be officiously correct, but hardly anyone bothers for obvious reasons)

eval [list vcom] $compilationArgs [list -work work polar2rect/sc_corproc.vhd]

如果支持,最上面带有扩展语法({*})的版本是最好的.您可以确定它是否足够容易;如果不是,那是语法错误.

The version at the top with the expansion syntax ({*}) is best if supported. You can determine if it is easily enough; if it isn't, it's a syntax error.

这篇关于在TCL中使用多个参数启动问题程序(vcom)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆