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

📄 macros.pl

📁 nasm的全套源代码,有些我做了些修改,以方便您更方便更容易调试成功,方便学习做编译器
💻 PL
字号:
#!/usr/bin/perl -w
# 
# 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.

use strict;

my $fname;
my $line = 0;
my $index      = 0;
my $tasm_count;

undef $tasm_count;

open(OUTPUT,">macros.c") or die "unable to open macros.c\n";
    
print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
" - don't edit it */\n\n#include <stddef.h>\n\nstatic const char *stdmac[] = {\n";
    
foreach $fname ( @ARGV ) {
    open(INPUT,$fname) or die "unable to open $fname\n";
    while (<INPUT>) {
	$line++;
	chomp;
	if (m/^\s*\*END\*TASM\*MACROS\*\s*$/) {
	    $tasm_count = $index;
	} elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) {
	    $_ = $1;
	    s/\\/\\\\/g;
	    s/"/\\"/g;
	    if (length > 0) {
		print OUTPUT "    \"$_\",\n";
		$index++;
	    } 
	} else {
	    die "$fname:$line:  error unterminated quote";
	}
    }
    close(INPUT);
}
print OUTPUT "    NULL\n};\n";
$tasm_count = $index unless ( defined($tasm_count) );
print OUTPUT "#define TASM_MACRO_COUNT $tasm_count\n";
close(OUTPUT);

⌨️ 快捷键说明

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