mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
Convert bison.
NOTE: This only has "C" linkage right now.
This commit is contained in:
parent
754a6d9b5c
commit
e7e7f8ff9f
10 changed files with 62 additions and 77 deletions
25
configure.ac
25
configure.ac
|
@ -26,6 +26,18 @@ AC_TYPE_UID_T
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
|
|
||||||
|
AC_PROG_YACC
|
||||||
|
dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
|
||||||
|
if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
|
||||||
|
AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PROG_LEX
|
||||||
|
if test "$LEX" = ":"; then
|
||||||
|
AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_PATH_PROG(AUTOMAKE, automake)
|
AC_PATH_PROG(AUTOMAKE, automake)
|
||||||
AC_PATH_PROG(ACLOCAL, aclocal)
|
AC_PATH_PROG(ACLOCAL, aclocal)
|
||||||
AC_PATH_PROG(AUTOHEADER, autoheader)
|
AC_PATH_PROG(AUTOHEADER, autoheader)
|
||||||
|
@ -703,19 +715,6 @@ else
|
||||||
AC_MSG_RESULT(no - using devnull.log)
|
AC_MSG_RESULT(no - using devnull.log)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_PROG_YACC
|
|
||||||
|
|
||||||
dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
|
|
||||||
if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
|
|
||||||
AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_PROG_LEX
|
|
||||||
|
|
||||||
if test "$LEX" = ":"; then
|
|
||||||
AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([fhs-paths],
|
AC_ARG_ENABLE([fhs-paths],
|
||||||
[AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
|
[AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
|
||||||
[],
|
[],
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct Client;
|
||||||
extern void init_main_logfile(void);
|
extern void init_main_logfile(void);
|
||||||
extern void open_logfiles(void);
|
extern void open_logfiles(void);
|
||||||
extern void close_logfiles(void);
|
extern void close_logfiles(void);
|
||||||
extern void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3);
|
RB_EXTERN_C void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3);
|
||||||
extern void idebug(const char *fmt, ...) AFP(1, 2);
|
extern void idebug(const char *fmt, ...) AFP(1, 2);
|
||||||
extern void inotice(const char *fmt, ...) AFP(1, 2);
|
extern void inotice(const char *fmt, ...) AFP(1, 2);
|
||||||
extern void iwarn(const char *fmt, ...) AFP(1, 2);
|
extern void iwarn(const char *fmt, ...) AFP(1, 2);
|
||||||
|
|
|
@ -189,9 +189,9 @@ extern void load_all_modules(bool warn);
|
||||||
extern void load_core_modules(bool);
|
extern void load_core_modules(bool);
|
||||||
|
|
||||||
extern bool unload_one_module(const char *, bool);
|
extern bool unload_one_module(const char *, bool);
|
||||||
extern bool load_one_module(const char *, int, bool);
|
RB_EXTERN_C bool load_one_module(const char *, int, bool);
|
||||||
extern bool load_a_module(const char *, bool, int, bool);
|
extern bool load_a_module(const char *, bool, int, bool);
|
||||||
extern struct module *findmodule_byname(const char *);
|
RB_EXTERN_C struct module *findmodule_byname(const char *);
|
||||||
extern void init_modules(void);
|
extern void init_modules(void);
|
||||||
|
|
||||||
extern rb_dlink_list module_list;
|
extern rb_dlink_list module_list;
|
||||||
|
|
|
@ -63,11 +63,11 @@ extern struct TopConf *conf_cur_block;
|
||||||
extern char *current_file;
|
extern char *current_file;
|
||||||
|
|
||||||
int read_config(char *);
|
int read_config(char *);
|
||||||
int conf_start_block(char *, char *);
|
RB_EXTERN_C int conf_start_block(char *, char *);
|
||||||
int conf_end_block(struct TopConf *);
|
RB_EXTERN_C int conf_end_block(struct TopConf *);
|
||||||
int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
RB_EXTERN_C int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
||||||
void conf_report_error(const char *, ...);
|
RB_EXTERN_C void conf_report_error(const char *, ...);
|
||||||
void conf_report_warning(const char *, ...);
|
RB_EXTERN_C void conf_report_warning(const char *, ...);
|
||||||
void newconf_init(void);
|
void newconf_init(void);
|
||||||
int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *));
|
int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *));
|
||||||
int remove_conf_item(const char *topconf, const char *name);
|
int remove_conf_item(const char *topconf, const char *name);
|
||||||
|
|
|
@ -357,9 +357,9 @@ extern char *get_user_ban_reason(struct ConfItem *aconf);
|
||||||
extern void get_printable_kline(struct Client *, struct ConfItem *,
|
extern void get_printable_kline(struct Client *, struct ConfItem *,
|
||||||
char **, char **, char **, char **);
|
char **, char **, char **, char **);
|
||||||
|
|
||||||
extern void yyerror(const char *);
|
RB_EXTERN_C void yyerror(const char *);
|
||||||
extern int conf_yy_fatal_error(const char *);
|
RB_EXTERN_C int conf_yy_fatal_error(const char *);
|
||||||
extern int conf_fgets(char *, int, FILE *);
|
RB_EXTERN_C int conf_fgets(char *, int, FILE *);
|
||||||
|
|
||||||
extern int valid_wild_card(const char *, const char *);
|
extern int valid_wild_card(const char *, const char *);
|
||||||
extern void add_temp_kline(struct ConfItem *);
|
extern void add_temp_kline(struct ConfItem *);
|
||||||
|
@ -379,8 +379,6 @@ extern void flush_expired_ips(void *);
|
||||||
|
|
||||||
extern char *get_oper_name(struct Client *client_p);
|
extern char *get_oper_name(struct Client *client_p);
|
||||||
|
|
||||||
extern int yylex(void);
|
|
||||||
|
|
||||||
extern unsigned long cidr_to_bitmask[];
|
extern unsigned long cidr_to_bitmask[];
|
||||||
|
|
||||||
extern char conffilebuf[BUFSIZE + 1];
|
extern char conffilebuf[BUFSIZE + 1];
|
||||||
|
|
4
ircd/.gitignore
vendored
4
ircd/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
ircd_parser.h
|
ircd_parser.h
|
||||||
ircd_parser.cc
|
ircd_parser.c
|
||||||
ircd_lexer.cc
|
ircd_lexer.c
|
||||||
|
|
|
@ -9,7 +9,8 @@ AM_LDFLAGS = -export-dynamic -avoid-version -no-undefined
|
||||||
AM_LDFLAGS += -L$(top_srcdir)/rb
|
AM_LDFLAGS += -L$(top_srcdir)/rb
|
||||||
AM_LDFLAGS += -L$(top_srcdir)/boost/lib
|
AM_LDFLAGS += -L$(top_srcdir)/boost/lib
|
||||||
|
|
||||||
AM_YFLAGS = -d
|
AM_YFLAGS = -d # --language=c++
|
||||||
|
AM_LFLAGS = # --c++
|
||||||
|
|
||||||
if MINGW
|
if MINGW
|
||||||
EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*'
|
EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*'
|
||||||
|
@ -34,7 +35,7 @@ libircd_la_SOURCES = \
|
||||||
hostmask.cc \
|
hostmask.cc \
|
||||||
ircd.cc \
|
ircd.cc \
|
||||||
ircd_parser.y \
|
ircd_parser.y \
|
||||||
ircd_lexer.l \
|
ircd_lexer.l \
|
||||||
ircd_signal.cc \
|
ircd_signal.cc \
|
||||||
listener.cc \
|
listener.cc \
|
||||||
logger.cc \
|
logger.cc \
|
||||||
|
@ -73,6 +74,6 @@ install-data-local:
|
||||||
test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@
|
test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f ircd_lexer.c ircd_lexer.cc
|
rm -f ircd_lexer.c
|
||||||
rm -f ircd_parser.c ircd_parser.cc
|
rm -f ircd_parser.c
|
||||||
rm -f ircd_parser.h
|
rm -f ircd_parser.h
|
||||||
|
|
|
@ -22,25 +22,18 @@
|
||||||
%option nounput
|
%option nounput
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <sys/types.h>
|
#define MAX_INCLUDE_DEPTH 10
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#define WE_ARE_MEMORY_C
|
|
||||||
|
|
||||||
#include <ircd/stdinc.h>
|
#include <ircd/stdinc.h>
|
||||||
#include <ircd/logger.h>
|
#include <ircd/client.h>
|
||||||
#include <ircd/s_conf.h>
|
#include <ircd/modules.h>
|
||||||
#include <ircd/newconf.h>
|
#include <ircd/newconf.h>
|
||||||
|
#include <ircd/s_conf.h>
|
||||||
|
#include <ircd/logger.h>
|
||||||
#include "ircd_parser.h"
|
#include "ircd_parser.h"
|
||||||
|
|
||||||
int yylex(void);
|
int yyparse(void);
|
||||||
|
void yyerror(const char *);
|
||||||
#define MAX_INCLUDE_DEPTH 10
|
|
||||||
|
|
||||||
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
|
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
|
||||||
int include_stack_ptr=0;
|
int include_stack_ptr=0;
|
||||||
|
@ -142,10 +135,11 @@ loadmodule { return LOADMODULE; }
|
||||||
<<EOF>> { if (ieof()) yyterminate(); }
|
<<EOF>> { if (ieof()) yyterminate(); }
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
||||||
/* C-comment ignoring routine -kre*/
|
/* C-comment ignoring routine -kre*/
|
||||||
void ccomment()
|
void ccomment()
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* log(L_NOTICE, "got comment"); */
|
/* log(L_NOTICE, "got comment"); */
|
||||||
while (1)
|
while (1)
|
||||||
|
|
|
@ -3,25 +3,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <sys/types.h>
|
#define YY_NO_UNPUT
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#define WE_ARE_MEMORY_C
|
|
||||||
#include <ircd/stdinc.h>
|
#include <ircd/stdinc.h>
|
||||||
#include <ircd/defaults.h>
|
|
||||||
#include <ircd/client.h>
|
#include <ircd/client.h>
|
||||||
#include <ircd/modules.h>
|
#include <ircd/modules.h>
|
||||||
#include <ircd/newconf.h>
|
#include <ircd/newconf.h>
|
||||||
|
#include <ircd/s_conf.h>
|
||||||
|
#include <ircd/logger.h>
|
||||||
|
#include "ircd_parser.h"
|
||||||
|
|
||||||
#define YY_NO_UNPUT
|
int yylex();
|
||||||
|
|
||||||
int yyparse(void);
|
|
||||||
void yyerror(const char *);
|
void yyerror(const char *);
|
||||||
int yylex(void);
|
|
||||||
|
|
||||||
static time_t conf_find_time(char*);
|
static time_t conf_find_time(char*);
|
||||||
|
|
||||||
|
@ -112,45 +105,45 @@ static void free_cur_list(conf_parm_t* list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
conf_parm_t * cur_list = NULL;
|
conf_parm_t * cur_list;
|
||||||
|
|
||||||
static void add_cur_list_cpt(conf_parm_t *new)
|
static void add_cur_list_cpt(conf_parm_t *new_)
|
||||||
{
|
{
|
||||||
if (cur_list == NULL)
|
if (cur_list == NULL)
|
||||||
{
|
{
|
||||||
cur_list = rb_malloc(sizeof(conf_parm_t));
|
cur_list = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||||
cur_list->type = CF_FLIST;
|
cur_list->type = CF_FLIST;
|
||||||
cur_list->v.list = new;
|
cur_list->v.list = new_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new->next = cur_list->v.list;
|
new_->next = cur_list->v.list;
|
||||||
cur_list->v.list = new;
|
cur_list->v.list = new_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_cur_list(int type, char *str, int number)
|
static void add_cur_list(int type, char *str, int number)
|
||||||
{
|
{
|
||||||
conf_parm_t *new;
|
conf_parm_t *new_;
|
||||||
|
|
||||||
new = rb_malloc(sizeof(conf_parm_t));
|
new_ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||||
new->next = NULL;
|
new_->next = NULL;
|
||||||
new->type = type;
|
new_->type = type;
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
case CF_TIME:
|
case CF_TIME:
|
||||||
case CF_YESNO:
|
case CF_YESNO:
|
||||||
new->v.number = number;
|
new_->v.number = number;
|
||||||
break;
|
break;
|
||||||
case CF_STRING:
|
case CF_STRING:
|
||||||
case CF_QSTRING:
|
case CF_QSTRING:
|
||||||
new->v.string = rb_strdup(str);
|
new_->v.string = rb_strdup(str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_cur_list_cpt(new);
|
add_cur_list_cpt(new_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,19 +239,19 @@ single: oneitem
|
||||||
|
|
||||||
oneitem: qstring
|
oneitem: qstring
|
||||||
{
|
{
|
||||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||||
$$->type = CF_QSTRING;
|
$$->type = CF_QSTRING;
|
||||||
$$->v.string = rb_strdup($1);
|
$$->v.string = rb_strdup($1);
|
||||||
}
|
}
|
||||||
| timespec
|
| timespec
|
||||||
{
|
{
|
||||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||||
$$->type = CF_TIME;
|
$$->type = CF_TIME;
|
||||||
$$->v.number = $1;
|
$$->v.number = $1;
|
||||||
}
|
}
|
||||||
| number
|
| number
|
||||||
{
|
{
|
||||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||||
$$->type = CF_INT;
|
$$->type = CF_INT;
|
||||||
$$->v.number = $1;
|
$$->v.number = $1;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +261,7 @@ oneitem: qstring
|
||||||
so pass it as that, if so */
|
so pass it as that, if so */
|
||||||
int val = conf_get_yesno_value($1);
|
int val = conf_get_yesno_value($1);
|
||||||
|
|
||||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||||
|
|
||||||
if (val != -1)
|
if (val != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
struct config_server_hide ConfigServerHide;
|
struct config_server_hide ConfigServerHide;
|
||||||
|
|
||||||
extern "C" int yyparse(void); /* defined in y.tab.c */
|
RB_EXTERN_C int yyparse(void);
|
||||||
extern char yy_linebuf[16384]; /* defined in ircd_lexer.l */
|
extern char yy_linebuf[16384]; /* defined in ircd_lexer.l */
|
||||||
|
|
||||||
static rb_bh *confitem_heap = NULL;
|
static rb_bh *confitem_heap = NULL;
|
||||||
|
|
Loading…
Reference in a new issue