1 Star 0 Fork 0

yishengjingcai/cpuminer-opt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
nomacro.pl 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
Jay D Dee 提交于 2016-09-22 13:16 . Initial upload v3.4.7
#!/usr/bin/perl
# Copyright 2012 [email protected]
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version. See COPYING for more details.
#
# nomacro.pl - convert assembler macros to C preprocessor macros.
use strict;
foreach my $f (<*.S>) {
rename $f, "$f.orig";
open FIN, "$f.orig";
open FOUT, ">$f";
my $inmacro = 0;
my %macros = ();
while (<FIN>) {
if (m/^\.macro\s+([_0-9A-Z]+)(?:\s*)(.*)$/i) {
print FOUT "#define $1($2) \\\n";
$macros{$1} = 1;
$inmacro = 1;
next;
}
if (m/^\.endm/) {
print FOUT "\n";
$inmacro = 0;
next;
}
for my $m (keys %macros) {
s/^([ \t]*)($m)(?:[ \t]+([^#\n]*))?([;\n])/\1\2(\3)\4/;
}
if ($inmacro) {
if (m/^\s*#if/) {
$_ = <FIN> while (!m/^\s*#endif/);
next;
}
next if (m/^\s*$/);
s/\\//g;
s/$/; \\/;
}
print FOUT;
}
close FOUT;
close FIN;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/zhangzq/cpuminer-opt.git
[email protected]:zhangzq/cpuminer-opt.git
zhangzq
cpuminer-opt
cpuminer-opt
master

搜索帮助