📄 analog.pl
字号:
################################################################################
#
# analog.pl
#
# This script creates the file analog.cfg. It contains:
# - the ANALOG value computed from ANLG_FAM and ANLG_PG
# - the macros to compute ANLG_FAM and ANLG_PG
# The current version of analog.cfg is updated only if there is a modification.
#
# (C) Texas Instruments 2003
#
################################################################################
$output_file = "config/analog.cfg";
$tmp_file = $output_file.".tmp";
$diff_file = "diff.tmp";
$anlg_fam = $ARGV[0];
$anlg_pg = $ARGV[1];
# Computation of ANALOG
$analog = ($anlg_pg << 7) | $anlg_fam;
# Create the temporary file
open (OUTPUT, ">$tmp_file") or die "Cannot open $output_file";
print OUTPUT "#ifndef __ANALOG_CFG__\n";
print OUTPUT "#define __ANALOG_CFG__\n";
print OUTPUT "#define ANLG_FAM(analog) (((analog) >> 0) & 0x007F)\n";
print OUTPUT "#define ANLG_PG(analog) (((analog) >> 7) & 0x0007)\n";
print OUTPUT "#define ANALOG $analog\n";
print OUTPUT "#endif /* __ANALOG_CFG__ */\n";
close (OUTPUT);
# If the output file does not exist, the temporary file is copied.
# If the output file exists, it is compared with the temporary file. If
# there is a difference, the temporary file is copied.
if (-e $output_file) {
system ("diff $output_file $tmp_file > $diff_file");
open (INPUT, $diff_file) or die "Cannot open $diff_file";
if (!eof (INPUT)) {
unlink $output_file;
rename ($tmp_file, $output_file);
} else {
unlink $tmp_file;
}
close (INPUT);
unlink $diff_file;
} else {
rename ($tmp_file, $output_file);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -