mirror of
https://github.com/matrix-construct/construct
synced 2025-02-16 16:50:12 +01: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_MAKE_SET
|
||||
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(ACLOCAL, aclocal)
|
||||
AC_PATH_PROG(AUTOHEADER, autoheader)
|
||||
|
@ -703,19 +715,6 @@ else
|
|||
AC_MSG_RESULT(no - using devnull.log)
|
||||
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],
|
||||
[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 open_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 inotice(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 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 struct module *findmodule_byname(const char *);
|
||||
RB_EXTERN_C struct module *findmodule_byname(const char *);
|
||||
extern void init_modules(void);
|
||||
|
||||
extern rb_dlink_list module_list;
|
||||
|
|
|
@ -63,11 +63,11 @@ extern struct TopConf *conf_cur_block;
|
|||
extern char *current_file;
|
||||
|
||||
int read_config(char *);
|
||||
int conf_start_block(char *, char *);
|
||||
int conf_end_block(struct TopConf *);
|
||||
int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
||||
void conf_report_error(const char *, ...);
|
||||
void conf_report_warning(const char *, ...);
|
||||
RB_EXTERN_C int conf_start_block(char *, char *);
|
||||
RB_EXTERN_C int conf_end_block(struct TopConf *);
|
||||
RB_EXTERN_C int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
||||
RB_EXTERN_C void conf_report_error(const char *, ...);
|
||||
RB_EXTERN_C void conf_report_warning(const char *, ...);
|
||||
void newconf_init(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);
|
||||
|
|
|
@ -357,9 +357,9 @@ extern char *get_user_ban_reason(struct ConfItem *aconf);
|
|||
extern void get_printable_kline(struct Client *, struct ConfItem *,
|
||||
char **, char **, char **, char **);
|
||||
|
||||
extern void yyerror(const char *);
|
||||
extern int conf_yy_fatal_error(const char *);
|
||||
extern int conf_fgets(char *, int, FILE *);
|
||||
RB_EXTERN_C void yyerror(const char *);
|
||||
RB_EXTERN_C int conf_yy_fatal_error(const char *);
|
||||
RB_EXTERN_C int conf_fgets(char *, int, FILE *);
|
||||
|
||||
extern int valid_wild_card(const char *, const char *);
|
||||
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 int yylex(void);
|
||||
|
||||
extern unsigned long cidr_to_bitmask[];
|
||||
|
||||
extern char conffilebuf[BUFSIZE + 1];
|
||||
|
|
4
ircd/.gitignore
vendored
4
ircd/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
|||
ircd_parser.h
|
||||
ircd_parser.cc
|
||||
ircd_lexer.cc
|
||||
ircd_parser.c
|
||||
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)/boost/lib
|
||||
|
||||
AM_YFLAGS = -d
|
||||
AM_YFLAGS = -d # --language=c++
|
||||
AM_LFLAGS = # --c++
|
||||
|
||||
if MINGW
|
||||
EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*'
|
||||
|
@ -34,7 +35,7 @@ libircd_la_SOURCES = \
|
|||
hostmask.cc \
|
||||
ircd.cc \
|
||||
ircd_parser.y \
|
||||
ircd_lexer.l \
|
||||
ircd_lexer.l \
|
||||
ircd_signal.cc \
|
||||
listener.cc \
|
||||
logger.cc \
|
||||
|
@ -73,6 +74,6 @@ install-data-local:
|
|||
test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@
|
||||
|
||||
clean-local:
|
||||
rm -f ircd_lexer.c ircd_lexer.cc
|
||||
rm -f ircd_parser.c ircd_parser.cc
|
||||
rm -f ircd_lexer.c
|
||||
rm -f ircd_parser.c
|
||||
rm -f ircd_parser.h
|
||||
|
|
|
@ -22,25 +22,18 @@
|
|||
%option nounput
|
||||
|
||||
%{
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define WE_ARE_MEMORY_C
|
||||
#define MAX_INCLUDE_DEPTH 10
|
||||
|
||||
#include <ircd/stdinc.h>
|
||||
#include <ircd/logger.h>
|
||||
#include <ircd/s_conf.h>
|
||||
#include <ircd/client.h>
|
||||
#include <ircd/modules.h>
|
||||
#include <ircd/newconf.h>
|
||||
|
||||
#include <ircd/s_conf.h>
|
||||
#include <ircd/logger.h>
|
||||
#include "ircd_parser.h"
|
||||
|
||||
int yylex(void);
|
||||
|
||||
#define MAX_INCLUDE_DEPTH 10
|
||||
int yyparse(void);
|
||||
void yyerror(const char *);
|
||||
|
||||
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
|
||||
int include_stack_ptr=0;
|
||||
|
@ -142,10 +135,11 @@ loadmodule { return LOADMODULE; }
|
|||
<<EOF>> { if (ieof()) yyterminate(); }
|
||||
%%
|
||||
|
||||
|
||||
/* C-comment ignoring routine -kre*/
|
||||
void ccomment()
|
||||
{
|
||||
int c;
|
||||
int c;
|
||||
|
||||
/* log(L_NOTICE, "got comment"); */
|
||||
while (1)
|
||||
|
|
|
@ -3,25 +3,18 @@
|
|||
*/
|
||||
|
||||
%{
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#define WE_ARE_MEMORY_C
|
||||
#include <ircd/stdinc.h>
|
||||
#include <ircd/defaults.h>
|
||||
#include <ircd/client.h>
|
||||
#include <ircd/modules.h>
|
||||
#include <ircd/newconf.h>
|
||||
#include <ircd/s_conf.h>
|
||||
#include <ircd/logger.h>
|
||||
#include "ircd_parser.h"
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
int yyparse(void);
|
||||
int yylex();
|
||||
void yyerror(const char *);
|
||||
int yylex(void);
|
||||
|
||||
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)
|
||||
{
|
||||
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->v.list = new;
|
||||
cur_list->v.list = new_;
|
||||
}
|
||||
else
|
||||
{
|
||||
new->next = cur_list->v.list;
|
||||
cur_list->v.list = new;
|
||||
new_->next = cur_list->v.list;
|
||||
cur_list->v.list = new_;
|
||||
}
|
||||
}
|
||||
|
||||
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->next = NULL;
|
||||
new->type = type;
|
||||
new_ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||
new_->next = NULL;
|
||||
new_->type = type;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case CF_INT:
|
||||
case CF_TIME:
|
||||
case CF_YESNO:
|
||||
new->v.number = number;
|
||||
new_->v.number = number;
|
||||
break;
|
||||
case CF_STRING:
|
||||
case CF_QSTRING:
|
||||
new->v.string = rb_strdup(str);
|
||||
new_->v.string = rb_strdup(str);
|
||||
break;
|
||||
}
|
||||
|
||||
add_cur_list_cpt(new);
|
||||
add_cur_list_cpt(new_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -246,19 +239,19 @@ single: oneitem
|
|||
|
||||
oneitem: qstring
|
||||
{
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||
$$->type = CF_QSTRING;
|
||||
$$->v.string = rb_strdup($1);
|
||||
}
|
||||
| timespec
|
||||
{
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||
$$->type = CF_TIME;
|
||||
$$->v.number = $1;
|
||||
}
|
||||
| number
|
||||
{
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
$$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t));
|
||||
$$->type = CF_INT;
|
||||
$$->v.number = $1;
|
||||
}
|
||||
|
@ -268,7 +261,7 @@ oneitem: qstring
|
|||
so pass it as that, if so */
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
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 */
|
||||
|
||||
static rb_bh *confitem_heap = NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue