macros.pl
资源名称:nasm-0.98.zip [点击查看]
上传用户:yuppie_zhu
上传日期:2007-01-08
资源大小:535k
文件大小:1k
源码类别:
编译器/解释器
开发平台:
C/C++
- #!/usr/bin/perl
- #
- # macros.pl produce macros.c from standard.mac
- #
- # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
- # Julian Hall. All rights reserved. The software is
- # redistributable under the licence given in the file "Licence"
- # distributed in the NASM archive.
- $fname = "standard.mac" unless $fname = $ARGV[0];
- open INPUT,$fname || die "unable to open $fnamen";
- open OUTPUT,">macros.c" || die "unable to open macros.cn";
- print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
- " - don't edit it */nnstatic char *stdmac[] = {n";
- while (<INPUT>) {
- chomp;
- # this regexp ought to match anything at all, so why bother with
- # a sensible error message ;-)
- die "swirly thing alert" unless /^s*((s*([^"';s]+|"[^"]*"|'[^']*'))*)/;
- $_ = $1;
- s/\/\\/g;
- s/"/\"/g;
- print OUTPUT " "$_",n" if length > 0;
- }
- print OUTPUT " NULLn};n"