青菜肉丝's Blog

Programming and More

win32下noweb的Line directive格式的注意事项

青菜肉丝 posted @ 2011年1月20日 00:47 in 未分类 , 7764 阅读

在linux下使用notangle时,-L[格式]将在输出中插入line directive,比如-L'#line %L %N'就表示line directive的格式为#line [line number in nw file]\n。

但在windows下却不能这么输入,这是因为windows的console非常愚蠢,只会以空格键来区分参数。因此,-L'#line %L %N'这个在linux下分为两个参数的格式,却因为里面的空格键被windows识别为-L'#line、%L、%N'三个参数!

因此需要一些力气来避免这个问题:比如用特殊字符来代替空格,然后再用sed把这些特殊字符替换为空格:

notangle -R* -L#line!@#%L!@#%N|sed "s/!@#/ /g"

Avatar_small
kj 说:
2012年3月27日 15:35 这个貌似只要前后加一个半角引号就好了吧....

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter