work in progess
This commit is contained in:
27
Makefile
27
Makefile
@@ -91,7 +91,8 @@ sbin_PROGRAMS = helmetd$(EXEEXT)
|
|||||||
bin_PROGRAMS = helmetctl$(EXEEXT)
|
bin_PROGRAMS = helmetctl$(EXEEXT)
|
||||||
noinst_PROGRAMS = libxtools/tconfig_test$(EXEEXT) \
|
noinst_PROGRAMS = libxtools/tconfig_test$(EXEEXT) \
|
||||||
libxtools/clconfig_test$(EXEEXT) \
|
libxtools/clconfig_test$(EXEEXT) \
|
||||||
libxtools/clcomp_test$(EXEEXT) libxtools/cllexer_test$(EXEEXT)
|
libxtools/clcomp_test$(EXEEXT) libxtools/cllexer_test$(EXEEXT) \
|
||||||
|
server_test$(EXEEXT)
|
||||||
subdir = .
|
subdir = .
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||||
@@ -147,6 +148,10 @@ libxtools_cllexer_test_DEPENDENCIES = $(libxtools_NAME)
|
|||||||
am_libxtools_tconfig_test_OBJECTS = libxtools/tconfig_test.$(OBJEXT)
|
am_libxtools_tconfig_test_OBJECTS = libxtools/tconfig_test.$(OBJEXT)
|
||||||
libxtools_tconfig_test_OBJECTS = $(am_libxtools_tconfig_test_OBJECTS)
|
libxtools_tconfig_test_OBJECTS = $(am_libxtools_tconfig_test_OBJECTS)
|
||||||
libxtools_tconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
libxtools_tconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
||||||
|
am_server_test_OBJECTS = server_test.$(OBJEXT) server.$(OBJEXT) \
|
||||||
|
logger.$(OBJEXT)
|
||||||
|
server_test_OBJECTS = $(am_server_test_OBJECTS)
|
||||||
|
server_test_DEPENDENCIES = $(libxtools_NAME)
|
||||||
AM_V_P = $(am__v_P_$(V))
|
AM_V_P = $(am__v_P_$(V))
|
||||||
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
|
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
|
||||||
am__v_P_0 = false
|
am__v_P_0 = false
|
||||||
@@ -179,13 +184,13 @@ SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
|||||||
$(libxtools_clcomp_test_SOURCES) \
|
$(libxtools_clcomp_test_SOURCES) \
|
||||||
$(libxtools_clconfig_test_SOURCES) \
|
$(libxtools_clconfig_test_SOURCES) \
|
||||||
$(libxtools_cllexer_test_SOURCES) \
|
$(libxtools_cllexer_test_SOURCES) \
|
||||||
$(libxtools_tconfig_test_SOURCES)
|
$(libxtools_tconfig_test_SOURCES) $(server_test_SOURCES)
|
||||||
DIST_SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
DIST_SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
||||||
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
||||||
$(libxtools_clcomp_test_SOURCES) \
|
$(libxtools_clcomp_test_SOURCES) \
|
||||||
$(libxtools_clconfig_test_SOURCES) \
|
$(libxtools_clconfig_test_SOURCES) \
|
||||||
$(libxtools_cllexer_test_SOURCES) \
|
$(libxtools_cllexer_test_SOURCES) \
|
||||||
$(libxtools_tconfig_test_SOURCES)
|
$(libxtools_tconfig_test_SOURCES) $(server_test_SOURCES)
|
||||||
am__can_run_installinfo = \
|
am__can_run_installinfo = \
|
||||||
case $$AM_UPDATE_INFO_DIR in \
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
n|no|NO) false;; \
|
n|no|NO) false;; \
|
||||||
@@ -363,6 +368,8 @@ libxtools_clcomp_test_SOURCES = libxtools/clcomp_test.c
|
|||||||
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
||||||
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
||||||
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
||||||
|
server_test_SOURCES = server_test.c server.c logger.c
|
||||||
|
server_test_LDADD = $(libxtools_NAME)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@@ -545,6 +552,10 @@ libxtools/tconfig_test$(EXEEXT): $(libxtools_tconfig_test_OBJECTS) $(libxtools_t
|
|||||||
@rm -f libxtools/tconfig_test$(EXEEXT)
|
@rm -f libxtools/tconfig_test$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
server_test$(EXEEXT): $(server_test_OBJECTS) $(server_test_DEPENDENCIES) $(EXTRA_server_test_DEPENDENCIES)
|
||||||
|
@rm -f server_test$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(server_test_OBJECTS) $(server_test_LDADD) $(LIBS)
|
||||||
|
|
||||||
mostlyclean-compile:
|
mostlyclean-compile:
|
||||||
-rm -f *.$(OBJEXT)
|
-rm -f *.$(OBJEXT)
|
||||||
-rm -f libxasync/*.$(OBJEXT)
|
-rm -f libxasync/*.$(OBJEXT)
|
||||||
@@ -923,14 +934,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
|||||||
.PRECIOUS: Makefile
|
.PRECIOUS: Makefile
|
||||||
|
|
||||||
|
|
||||||
test:: libxtools/cllexer_test
|
test:: server_test
|
||||||
cd libxtools && ./cllexer_test
|
./server_test
|
||||||
|
|
||||||
test:: libxtools/clcomp_test
|
|
||||||
cd libxtools && ./clcomp_test
|
|
||||||
|
|
||||||
test:: libxtools/clconfig_test
|
|
||||||
cd libxtools && ./clconfig_test
|
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f *~
|
rm -f *~
|
||||||
|
|||||||
20
Makefile.am
20
Makefile.am
@@ -63,14 +63,22 @@ noinst_PROGRAMS += libxtools/cllexer_test
|
|||||||
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
||||||
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
||||||
|
|
||||||
test:: libxtools/cllexer_test
|
#test:: libxtools/cllexer_test
|
||||||
cd libxtools && ./cllexer_test
|
# cd libxtools && ./cllexer_test
|
||||||
|
|
||||||
test:: libxtools/clcomp_test
|
#test:: libxtools/clcomp_test
|
||||||
cd libxtools && ./clcomp_test
|
# cd libxtools && ./clcomp_test
|
||||||
|
|
||||||
|
#test:: libxtools/clconfig_test
|
||||||
|
# cd libxtools && ./clconfig_test
|
||||||
|
|
||||||
|
noinst_PROGRAMS += server_test
|
||||||
|
server_test_SOURCES = server_test.c server.c logger.c
|
||||||
|
server_test_LDADD = $(libxtools_NAME)
|
||||||
|
|
||||||
|
test:: server_test
|
||||||
|
./server_test
|
||||||
|
|
||||||
test:: libxtools/clconfig_test
|
|
||||||
cd libxtools && ./clconfig_test
|
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f *~
|
rm -f *~
|
||||||
|
|||||||
27
Makefile.in
27
Makefile.in
@@ -91,7 +91,8 @@ sbin_PROGRAMS = helmetd$(EXEEXT)
|
|||||||
bin_PROGRAMS = helmetctl$(EXEEXT)
|
bin_PROGRAMS = helmetctl$(EXEEXT)
|
||||||
noinst_PROGRAMS = libxtools/tconfig_test$(EXEEXT) \
|
noinst_PROGRAMS = libxtools/tconfig_test$(EXEEXT) \
|
||||||
libxtools/clconfig_test$(EXEEXT) \
|
libxtools/clconfig_test$(EXEEXT) \
|
||||||
libxtools/clcomp_test$(EXEEXT) libxtools/cllexer_test$(EXEEXT)
|
libxtools/clcomp_test$(EXEEXT) libxtools/cllexer_test$(EXEEXT) \
|
||||||
|
server_test$(EXEEXT)
|
||||||
subdir = .
|
subdir = .
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||||
@@ -147,6 +148,10 @@ libxtools_cllexer_test_DEPENDENCIES = $(libxtools_NAME)
|
|||||||
am_libxtools_tconfig_test_OBJECTS = libxtools/tconfig_test.$(OBJEXT)
|
am_libxtools_tconfig_test_OBJECTS = libxtools/tconfig_test.$(OBJEXT)
|
||||||
libxtools_tconfig_test_OBJECTS = $(am_libxtools_tconfig_test_OBJECTS)
|
libxtools_tconfig_test_OBJECTS = $(am_libxtools_tconfig_test_OBJECTS)
|
||||||
libxtools_tconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
libxtools_tconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
||||||
|
am_server_test_OBJECTS = server_test.$(OBJEXT) server.$(OBJEXT) \
|
||||||
|
logger.$(OBJEXT)
|
||||||
|
server_test_OBJECTS = $(am_server_test_OBJECTS)
|
||||||
|
server_test_DEPENDENCIES = $(libxtools_NAME)
|
||||||
AM_V_P = $(am__v_P_@AM_V@)
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
am__v_P_0 = false
|
am__v_P_0 = false
|
||||||
@@ -179,13 +184,13 @@ SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
|||||||
$(libxtools_clcomp_test_SOURCES) \
|
$(libxtools_clcomp_test_SOURCES) \
|
||||||
$(libxtools_clconfig_test_SOURCES) \
|
$(libxtools_clconfig_test_SOURCES) \
|
||||||
$(libxtools_cllexer_test_SOURCES) \
|
$(libxtools_cllexer_test_SOURCES) \
|
||||||
$(libxtools_tconfig_test_SOURCES)
|
$(libxtools_tconfig_test_SOURCES) $(server_test_SOURCES)
|
||||||
DIST_SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
DIST_SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
||||||
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
||||||
$(libxtools_clcomp_test_SOURCES) \
|
$(libxtools_clcomp_test_SOURCES) \
|
||||||
$(libxtools_clconfig_test_SOURCES) \
|
$(libxtools_clconfig_test_SOURCES) \
|
||||||
$(libxtools_cllexer_test_SOURCES) \
|
$(libxtools_cllexer_test_SOURCES) \
|
||||||
$(libxtools_tconfig_test_SOURCES)
|
$(libxtools_tconfig_test_SOURCES) $(server_test_SOURCES)
|
||||||
am__can_run_installinfo = \
|
am__can_run_installinfo = \
|
||||||
case $$AM_UPDATE_INFO_DIR in \
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
n|no|NO) false;; \
|
n|no|NO) false;; \
|
||||||
@@ -363,6 +368,8 @@ libxtools_clcomp_test_SOURCES = libxtools/clcomp_test.c
|
|||||||
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
||||||
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
||||||
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
||||||
|
server_test_SOURCES = server_test.c server.c logger.c
|
||||||
|
server_test_LDADD = $(libxtools_NAME)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@@ -545,6 +552,10 @@ libxtools/tconfig_test$(EXEEXT): $(libxtools_tconfig_test_OBJECTS) $(libxtools_t
|
|||||||
@rm -f libxtools/tconfig_test$(EXEEXT)
|
@rm -f libxtools/tconfig_test$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
server_test$(EXEEXT): $(server_test_OBJECTS) $(server_test_DEPENDENCIES) $(EXTRA_server_test_DEPENDENCIES)
|
||||||
|
@rm -f server_test$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(server_test_OBJECTS) $(server_test_LDADD) $(LIBS)
|
||||||
|
|
||||||
mostlyclean-compile:
|
mostlyclean-compile:
|
||||||
-rm -f *.$(OBJEXT)
|
-rm -f *.$(OBJEXT)
|
||||||
-rm -f libxasync/*.$(OBJEXT)
|
-rm -f libxasync/*.$(OBJEXT)
|
||||||
@@ -923,14 +934,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
|||||||
.PRECIOUS: Makefile
|
.PRECIOUS: Makefile
|
||||||
|
|
||||||
|
|
||||||
test:: libxtools/cllexer_test
|
test:: server_test
|
||||||
cd libxtools && ./cllexer_test
|
./server_test
|
||||||
|
|
||||||
test:: libxtools/clcomp_test
|
|
||||||
cd libxtools && ./clcomp_test
|
|
||||||
|
|
||||||
test:: libxtools/clconfig_test
|
|
||||||
cd libxtools && ./clconfig_test
|
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f *~
|
rm -f *~
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
#define RES_OK 0
|
#define RES_OK 0
|
||||||
#define RES_ERR -1
|
#define RES_ERR -1
|
||||||
|
|
||||||
#define POS1TYPE TOKEN_WORD
|
//#define POS1TYPE TLEX_TOKEN_WORD
|
||||||
#define POS2TYPE TOKEN_OPER
|
//#define POS2TYPE TLEX_TOKEN_OPER
|
||||||
#define POS3TYPE TOKEN_WORD
|
//#define POS3TYPE TLEX_TOKEN_WORD
|
||||||
#define POS4TYPE TOKEN_COMM
|
//#define POS4TYPE TLEX_TOKEN_COMM
|
||||||
|
|
||||||
static char* strcopy(char* src) {
|
static char* strcopy(char* src) {
|
||||||
size_t srcsize = strlen(src) + 1;
|
size_t srcsize = strlen(src) + 1;
|
||||||
@@ -62,25 +62,25 @@ int tccomp_parse(tccomp_t * comp) {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
toktype = tclexer_get_token(lexer, token, MAX_TOK_SIZE);
|
toktype = tclexer_get_token(lexer, token, MAX_TOK_SIZE);
|
||||||
if (toktype == TOKEN_SPACE) {
|
if (toktype == TLEX_TOKEN_SPACE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (toktype == TOKEN_COMM) {
|
if (toktype == TLEX_TOKEN_COMM) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//printf("tok=%d pos=%d line=%d [%s]\n", toktype, comp->pos, comp->lnum, token);
|
//printf("tok=%d pos=%d line=%d [%s]\n", toktype, comp->pos, comp->lnum, token);
|
||||||
|
|
||||||
if (toktype == TOKEN_NEWLN) {
|
if (toktype == TLEX_TOKEN_NEWLN) {
|
||||||
comp->lnum++;
|
comp->lnum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (comp->pos) {
|
switch (comp->pos) {
|
||||||
case 0:{
|
case 0:{
|
||||||
if (toktype == TOKEN_NEWLN) {
|
if (toktype == TLEX_TOKEN_NEWLN) {
|
||||||
comp->pos = 0;
|
comp->pos = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (toktype != TOKEN_WORD) {
|
if (toktype != TLEX_TOKEN_WORD) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
comp->pos++;
|
comp->pos++;
|
||||||
@@ -88,14 +88,14 @@ int tccomp_parse(tccomp_t * comp) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:{
|
case 1:{
|
||||||
if (toktype != TOKEN_OPER) {
|
if (toktype != TLEX_TOKEN_OPER) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
comp->pos++;
|
comp->pos++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:{
|
case 2:{
|
||||||
if (toktype != TOKEN_WORD) {
|
if (toktype != TLEX_TOKEN_WORD) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
comp->pos++;
|
comp->pos++;
|
||||||
@@ -103,7 +103,7 @@ int tccomp_parse(tccomp_t * comp) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:{
|
case 3:{
|
||||||
if (toktype != TOKEN_NEWLN && toktype != TOKEN_ENDFL) {
|
if (toktype != TLEX_TOKEN_NEWLN && toktype != TLEX_TOKEN_ENDFL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
comp->pos = 0;
|
comp->pos = 0;
|
||||||
@@ -114,7 +114,7 @@ int tccomp_parse(tccomp_t * comp) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toktype == TOKEN_ENDFL)
|
if (toktype == TLEX_TOKEN_ENDFL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
|
|
||||||
switch (lexer->context) {
|
switch (lexer->context) {
|
||||||
case LEXCONT_ENDFL:{
|
case LEXCONT_ENDFL:{
|
||||||
return TOKEN_ENDFL;
|
return TLEX_TOKEN_ENDFL;
|
||||||
}
|
}
|
||||||
case LEXCONT_WORD:{
|
case LEXCONT_WORD:{
|
||||||
int newcontext = LEXCONT_WORD;
|
int newcontext = LEXCONT_WORD;
|
||||||
@@ -108,7 +108,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
if (newcontext != lexer->context) {
|
if (newcontext != lexer->context) {
|
||||||
lexer->context = newcontext;
|
lexer->context = newcontext;
|
||||||
token[lexer->pos++] = '\0';
|
token[lexer->pos++] = '\0';
|
||||||
return TOKEN_WORD;
|
return TLEX_TOKEN_WORD;
|
||||||
}
|
}
|
||||||
token[lexer->pos++] = lexer->letter;
|
token[lexer->pos++] = lexer->letter;
|
||||||
break;
|
break;
|
||||||
@@ -129,7 +129,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
if (newcontext != lexer->context) {
|
if (newcontext != lexer->context) {
|
||||||
token[lexer->pos++] = '\0';
|
token[lexer->pos++] = '\0';
|
||||||
lexer->context = newcontext;
|
lexer->context = newcontext;
|
||||||
return TOKEN_COMM;
|
return TLEX_TOKEN_COMM;
|
||||||
}
|
}
|
||||||
token[lexer->pos++] = lexer->letter;
|
token[lexer->pos++] = lexer->letter;
|
||||||
break;
|
break;
|
||||||
@@ -162,7 +162,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
if (newcontext != lexer->context) {
|
if (newcontext != lexer->context) {
|
||||||
lexer->context = newcontext;
|
lexer->context = newcontext;
|
||||||
strcpy(token, "SPACE");
|
strcpy(token, "SPACE");
|
||||||
return TOKEN_SPACE;
|
return TLEX_TOKEN_SPACE;
|
||||||
}
|
}
|
||||||
token[lexer->pos++] = lexer->letter;
|
token[lexer->pos++] = lexer->letter;
|
||||||
break;
|
break;
|
||||||
@@ -195,7 +195,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
if (newcontext != lexer->context) {
|
if (newcontext != lexer->context) {
|
||||||
lexer->context = newcontext;
|
lexer->context = newcontext;
|
||||||
strcpy(token, "=");
|
strcpy(token, "=");
|
||||||
return TOKEN_OPER;
|
return TLEX_TOKEN_OPER;
|
||||||
}
|
}
|
||||||
token[lexer->pos++] = lexer->letter;
|
token[lexer->pos++] = lexer->letter;
|
||||||
break;
|
break;
|
||||||
@@ -224,7 +224,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
if (newcontext != lexer->context) {
|
if (newcontext != lexer->context) {
|
||||||
lexer->context = newcontext;
|
lexer->context = newcontext;
|
||||||
strcpy(token, "NL");
|
strcpy(token, "NL");
|
||||||
return TOKEN_NEWLN;
|
return TLEX_TOKEN_NEWLN;
|
||||||
}
|
}
|
||||||
token[lexer->pos++] = lexer->letter;
|
token[lexer->pos++] = lexer->letter;
|
||||||
break;
|
break;
|
||||||
@@ -267,7 +267,7 @@ int tclexer_get_token(tclexer_t * lexer, char* token, int maxsize) {
|
|||||||
}
|
}
|
||||||
lexer->letter = bstream_getc(lexer->stream);
|
lexer->letter = bstream_getc(lexer->stream);
|
||||||
}
|
}
|
||||||
return TOKEN_ENDFL;
|
return TLEX_TOKEN_ENDFL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tclexer_destroy(tclexer_t * lexer) {
|
void tclexer_destroy(tclexer_t * lexer) {
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ typedef struct {
|
|||||||
|
|
||||||
#define MAX_TOK_SIZE 1024
|
#define MAX_TOK_SIZE 1024
|
||||||
|
|
||||||
#define TOKEN_NULL 0
|
#define TLEX_TOKEN_NULL 0
|
||||||
#define TOKEN_WORD 1
|
#define TLEX_TOKEN_WORD 1
|
||||||
#define TOKEN_SPACE 2
|
#define TLEX_TOKEN_SPACE 2
|
||||||
#define TOKEN_COMM 3
|
#define TLEX_TOKEN_COMM 3
|
||||||
#define TOKEN_OPER 4
|
#define TLEX_TOKEN_OPER 4
|
||||||
#define TOKEN_ENDFL 5
|
#define TLEX_TOKEN_ENDFL 5
|
||||||
#define TOKEN_NEWLN 7
|
#define TLEX_TOKEN_NEWLN 7
|
||||||
|
|
||||||
tclexer_t* new_tclexer(bstream_t * stream);
|
tclexer_t* new_tclexer(bstream_t * stream);
|
||||||
void tclexer_init(tclexer_t * tclexer, bstream_t * stream);
|
void tclexer_init(tclexer_t * tclexer, bstream_t * stream);
|
||||||
|
|||||||
21
server.c
21
server.c
@@ -4,19 +4,27 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <logger.h>
|
#include <logger.h>
|
||||||
|
#include <clconfig.h>
|
||||||
#include <tconfig.h>
|
#include <tconfig.h>
|
||||||
#include <massert.h>
|
#include <massert.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
} server_t;
|
||||||
|
|
||||||
|
|
||||||
|
static server_t server;
|
||||||
|
|
||||||
int server_init(void) {
|
int server_init(void) {
|
||||||
logger_dprintf("server inited");
|
logger_dprintf("server initialization");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SERVER_CONFIG_ERROR -1
|
#define SERVER_CONFIG_ERROR -1
|
||||||
|
|
||||||
int server_config(void) {
|
int server_config(void) {
|
||||||
logger_dprintf("server configi");
|
logger_dprintf("server configuration");
|
||||||
|
|
||||||
tconfig_t tconfig;
|
tconfig_t tconfig;
|
||||||
tconfig_init(&tconfig);
|
tconfig_init(&tconfig);
|
||||||
@@ -35,16 +43,13 @@ int server_config(void) {
|
|||||||
tconfig_destroy(&tconfig);
|
tconfig_destroy(&tconfig);
|
||||||
logger_dprintf("logpath = %s", logpath);
|
logger_dprintf("logpath = %s", logpath);
|
||||||
|
|
||||||
clconfig_t tconfig;
|
//clconfig_t clconfig;
|
||||||
tconfig_init(&tconfig);
|
//clconfig_init(&clconfig);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int server_run(void) {
|
int server_run(void) {
|
||||||
logger_dprintf("server started");
|
logger_dprintf("start the server");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
22
server_test.c
Normal file
22
server_test.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
//#include <fcntl.h>
|
||||||
|
//#include <clconfig.h>
|
||||||
|
#include <massert.h>
|
||||||
|
|
||||||
|
#include <server.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
|
server_init();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user