This commit is contained in:
keni
2016-06-16 13:32:50 -04:00
parent a8e1700f51
commit 83a0c37d13
27 changed files with 613 additions and 34 deletions

View File

@@ -297,6 +297,7 @@ hardfloor { savetoken(yytext); yylval.i=HARDFLOOR; return FLAG_TYPE; }
nommap { savetoken(yytext); yylval.i=NOMMAP; return FLAG_TYPE; }
arboreal { savetoken(yytext); yylval.i=ARBOREAL; return FLAG_TYPE; } /* KMH */
shortsighted { savetoken(yytext); yylval.i=SHORTSIGHTED; return FLAG_TYPE; }
conway { savetoken(yytext); yylval.i=FLAG_CONWAY; return FLAG_TYPE; }
mazelevel { savetoken(yytext); yylval.i=MAZELEVEL; return FLAG_TYPE; }
premapped { savetoken(yytext); yylval.i=PREMAPPED; return FLAG_TYPE; }
shroud { savetoken(yytext); yylval.i=SHROUD; return FLAG_TYPE; }

View File

@@ -548,6 +548,18 @@ do_ext_makedefs(int argc, char **argv)
}
CONTINUE;
}
IS_OPTION("grep-test"){
struct grep_var *p;
CONSUME;
p = grepsearch(argv[0]);
if(p && p->is_defined){
exit(EXIT_SUCCESS);
} else {
exit(EXIT_FAILURE);
}
CONTINUE; /* NOTREACHED */
}
#ifdef notyet
IS_OPTION("help") {
}
@@ -611,6 +623,7 @@ do_ext_makedefs(int argc, char **argv)
#define GREP_STACK_SIZE 100
#ifdef notyet
static int grep_rewrite = 0; /* need to (possibly) rewrite lines */
static char rewrite_stack[GREP_STACK_SIZE] = {GREP_MAGIC};
#endif
static int grep_writing = 1; /* need to copy lines to output */
static int grep_errors = 0;
@@ -748,6 +761,7 @@ char *buf;
break;
#if defined(notyet)
case '(': /* start of expression */
case '@': /* substitution facility: @[ @] */
#endif
case GREP_MAGIC: /* ^^ -> ^ */
return buf0;
@@ -1422,7 +1436,7 @@ static const char *build_opts[] = {
#ifdef COM_COMPL
"command line completion",
#endif
#ifdef LIFE
#ifdef CONWAY
"Conway's Game of Life",
#endif
#ifdef COMPRESS

View File

@@ -1,12 +1,13 @@
/*
* NetHack 3.6 mdgrep.h $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $
* NetHack 3.6 mdgrep.h $NHDT-Date: 1423877529 2015/02/14 01:32:09 $ $NHDT-Branch$:$NHDT-Revision: 1.7 $
* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008
* NetHack may be freely redistributed. See license for details.
*
* This file generated by mdgrep.pl version 1.7.
* DO NOT EDIT! Your changes will be lost.
*/
static struct grep_var grep_vars[] = { { "0", 0 },
static struct grep_var grep_vars[] = {
{ "0", 0 },
{ "1", 1 },
#if defined(ALLDOCS)
{ "ALLDOCS", 1 },
@@ -48,6 +49,11 @@ static struct grep_var grep_vars[] = { { "0", 0 },
#else
{ "COMPRESS", 0 },
#endif
#if defined(CONWAY)
{ "CONWAY", 1 },
#else
{ "CONWAY", 0 },
#endif
#if defined(DLB)
{ "DLB", 1 },
#else
@@ -74,11 +80,6 @@ static struct grep_var grep_vars[] = { { "0", 0 },
#else
{ "INSURANCE", 0 },
#endif
#if defined(LIFE)
{ "LIFE", 1 },
#else
{ "LIFE", 0 },
#endif
#if defined(MAC)
{ "MAC", 1 },
#else
@@ -255,7 +256,6 @@ static struct grep_var grep_vars[] = { { "0", 0 },
#else
{ "WIN_CE_SMARTPHONE", 0 },
#endif
{ "WIZARD", 1 },
#if defined(X11_GRAPHICS)
{ "X11_GRAPHICS", 1 },
#else
@@ -276,7 +276,8 @@ static struct grep_var grep_vars[] = { { "0", 0 },
#else
{ "__BEOS__", 0 },
#endif
{ 0, 0 } };
{ 0, 0 }
};
/* Command ids */
#define TODO_GREP 1

View File

@@ -3,6 +3,14 @@
# Copyright (c) Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
###
### NOTE: We do not require Perl at build time, so if you change this file
### you MUST rebuild mdgrep.h with:
### cd util; make mdgreph
### BUT: Makefile.dat only makes sure makedefs exists, it doesn't assure it
### is up to date, so as a practical matter you should make clean. XXX
###
# MAKEDEFS:
@commands = qw/grep/;
@@ -22,7 +30,7 @@
SAFERHANGUP MFLOPPY NOCWD_ASSUMPTIONS
VAR_PLAYGROUND DLB SHELL SUSPEND NOSAVEONHANGUP HANGUPHANDLING
BSD_JOB_CONTROL MAIL POSIX_JOB_CONTROL INSURANCE
UNICODE_DRAWING UNICODE_WIDEWINPORT UNICODE_PLAYERTEXT
UNICODE_DRAWING UNICODE_WIDEWINPORT UNICODE_PLAYERTEXT CONWAY
/;
# Miscellaneous
@@ -89,23 +97,23 @@ sub gen_magic {
# NB: Do NOT make grep_vars const - it needs to be writable for some debugging
# options.
sub gen_file {
print OUT "static struct grep_var grep_vars[]={\n";
print OUT "static struct grep_var grep_vars[] = {\n";
foreach(@_){
if(defined $magic{$_}){
print OUT <<E_O_M;
{"$_", $magic{$_}},
{ "$_", $magic{$_} },
E_O_M
next;
}
print OUT <<E_O_M;
#if defined($_)
{"$_", 1},
{ "$_", 1 },
#else
{"$_", 0},
{ "$_", 0 },
#endif
E_O_M
}
print OUT "\t{0,0}\n};\n";
print OUT " { 0, 0 }\n};\n";
}
sub gen_commands {