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

查看:32
本文介绍了在 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.

我该如何解决这个问题?

How can I fix this?

谢谢,亨德里克.

推荐答案

问题"在于 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天全站免登陆