teach mdgrep.* about NH_DEVEL_STATUS

This commit is contained in:
nhkeni
2024-03-20 11:51:55 -04:00
parent 6e43ea1635
commit 41bdaa348a
2 changed files with 53 additions and 14 deletions
+18 -6
View File
@@ -1,11 +1,12 @@
/* /*
* NetHack 3.7 mdgrep.h $NHDT-Date: 1693083351 2023/08/26 20:55:51 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.24 $ * NetHack 3.7 mdgrep.h $NHDT-Date: 1710949914 2024/03/20 15:51:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.20 $
* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008 * Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008
* NetHack may be freely redistributed. See license for details. * NetHack may be freely redistributed. See license for details.
* *
* This file generated by mdgrep.pl version 1.24. * This file generated by mdgrep.pl version 1.24.
* DO NOT EDIT! Your changes will be lost. * DO NOT EDIT! Your changes will be lost.
*/ */
static struct grep_var grep_vars[]={ static struct grep_var grep_vars[]={
{"0", 0}, {"0", 0},
{"1", 1}, {"1", 1},
@@ -29,11 +30,6 @@ static struct grep_var grep_vars[]={
#else #else
{"ASCIIGRAPH", 0}, {"ASCIIGRAPH", 0},
#endif #endif
#if defined(BETA)
{"BETA", 1},
#else
{"BETA", 0},
#endif
#if defined(BSD_JOB_CONTROL) #if defined(BSD_JOB_CONTROL)
{"BSD_JOB_CONTROL", 1}, {"BSD_JOB_CONTROL", 1},
#else #else
@@ -275,6 +271,22 @@ static struct grep_var grep_vars[]={
{"__BEOS__", 1}, {"__BEOS__", 1},
#else #else
{"__BEOS__", 0}, {"__BEOS__", 0},
#endif
{"NH_DEVEL_STATUS", NH_DEVEL_STATUS},
#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED)
{"DSNH_STATUS_RELEASED", 1},
#else
{"DSNH_STATUS_RELEASED", 0},
#endif
#if (NH_DEVEL_STATUS == NH_STATUS_WIP)
{"DSNH_STATUS_WIP", 1},
#else
{"DSNH_STATUS_WIP", 0},
#endif
#if (NH_DEVEL_STATUS == NH_STATUS_BETA)
{"DSNH_STATUS_BETA", 1},
#else
{"DSNH_STATUS_BETA", 0},
#endif #endif
{0,0} {0,0}
}; };
+35 -8
View File
@@ -1,5 +1,5 @@
#!perl #!perl
# NetHack 3.7 mdgrep.pl $NHDT-Date: 1693083351 2023/08/26 20:55:51 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.24 $ # NetHack 3.7 mdgrep.pl $NHDT-Date: 1710949914 2024/03/20 15:51:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.26 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland # Copyright (c) Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details. # NetHack may be freely redistributed. See license for details.
@@ -27,12 +27,17 @@
/; /;
# Miscellaneous # Miscellaneous
@misc = qw/BETA CROSSCOMPILE/; @misc = qw/CROSSCOMPILE/;
# Meta # Meta
@meta = qw/ALLDOCS/; # convention: use --grep-define ALLDOCS to notate @meta = qw/ALLDOCS/; # convention: use --grep-define ALLDOCS to notate
# items that are conditionally available # items that are conditionally available
# Special mappings (if key == value, define prefix_value, prefix is [0])
$specials = {
NH_DEVEL_STATUS => [qw/DS NH_STATUS_RELEASED NH_STATUS_WIP NH_STATUS_BETA/]
};
# JUNK: # JUNK:
# MICRO BSD __GNUC__ NHSTDC TERMLIB __linux__ LINUX WIN32CON NO_TERMS # MICRO BSD __GNUC__ NHSTDC TERMLIB __linux__ LINUX WIN32CON NO_TERMS
# ULTRIX_PROTO TERMINFO _DCC DISPMAP OPT_DISPMAP TARGET_API_MAC_CARBON # ULTRIX_PROTO TERMINFO _DCC DISPMAP OPT_DISPMAP TARGET_API_MAC_CARBON
@@ -54,10 +59,10 @@
$outfile = "mdgrep.h"; $outfile = "mdgrep.h";
sub start_file { sub start_file {
($rev) = ('$NHDT-Revision: 1.24 $') =~ m/: (.*) .$/; ($rev) = ('$NHDT-Revision: 1.26 $') =~ m/: (.*) .$/;
my $date = '$NHDT-Date: 1693083351 2023/08/26 20:55:51 $'; my $date = '$NHDT-Date: 1710949915 2024/03/20 15:51:55 $';
my $branch = '$NHDT-Branch: keni-crashweb2 $'; my $branch = '$NHDT-Branch: NetHack-3.7 $';
my $revision = '$NHDT-Revision: 1.24 $'; my $revision = '$NHDT-Revision: 1.26 $';
open(OUT, ">$outfile") || die "open $outfile: $!"; open(OUT, ">$outfile") || die "open $outfile: $!";
# NB: Date and Revision below will be modified when mdgrep.h is written to # NB: Date and Revision below will be modified when mdgrep.h is written to
# git - this is correct (but it means you must commit changes to mdgrep.pl # git - this is correct (but it means you must commit changes to mdgrep.pl
@@ -71,6 +76,8 @@ sub start_file {
* This file generated by mdgrep.pl version $rev. * This file generated by mdgrep.pl version $rev.
* DO NOT EDIT! Your changes will be lost. * DO NOT EDIT! Your changes will be lost.
*/ */
static struct grep_var grep_vars[]={
E_O_M E_O_M
} }
@@ -89,7 +96,6 @@ sub gen_magic {
# NB: Do NOT make grep_vars const - it needs to be writable for some debugging # NB: Do NOT make grep_vars const - it needs to be writable for some debugging
# options. # options.
sub gen_file { sub gen_file {
print OUT "static struct grep_var grep_vars[]={\n";
foreach(@_){ foreach(@_){
if(defined $magic{$_}){ if(defined $magic{$_}){
print OUT <<E_O_M; print OUT <<E_O_M;
@@ -105,7 +111,6 @@ E_O_M
#endif #endif
E_O_M E_O_M
} }
print OUT "\t{0,0}\n};\n";
} }
sub gen_commands { sub gen_commands {
@@ -117,9 +122,31 @@ sub gen_commands {
print OUT "\n"; print OUT "\n";
} }
sub gen_specials {
my $in = $_[0];
foreach my $name (keys %$in){
my $list = %$in{$name};
my $prefix = shift @$list;
print OUT <<E_O_M;
{"$name", $name},
E_O_M
foreach my $val (@$list){
print OUT <<E_O_M;
#if ($name == $val)
{"$prefix$val", 1},
#else
{"$prefix$val", 0},
#endif
E_O_M
}
}
}
&start_file; &start_file;
&gen_magic(0, @const_false); &gen_magic(0, @const_false);
&gen_magic(1, @const_true); &gen_magic(1, @const_true);
&gen_file(sort(@os,@win,@feature,@misc,@meta,@const_false,@const_true)); &gen_file(sort(@os,@win,@feature,@misc,@meta,@const_false,@const_true));
&gen_specials($specials);
print OUT "\t{0,0}\n};\n";
&gen_commands; &gen_commands;
&end_file; &end_file;