Browse Source

move AcceptBaseParser to utils directory

master
Tomasz Sowa 6 months ago
parent
commit
d0d2cfb22c
  1. 7
      winixd/Makefile
  2. 2
      winixd/Makefile.dep
  3. 858
      winixd/core/Makefile.dep
  4. 2
      winixd/core/Makefile.o.dep
  5. 6
      winixd/core/acceptencodingparser.h
  6. 4
      winixd/core/acceptparser.h
  7. 1
      winixd/main/Makefile.dep
  8. 24
      winixd/utils/Makefile
  9. 3
      winixd/utils/Makefile.dep
  10. 1
      winixd/utils/Makefile.o.dep
  11. 24
      winixd/utils/acceptbaseparser.cpp
  12. 14
      winixd/utils/acceptbaseparser.h

7
winixd/Makefile

@ -64,13 +64,14 @@ winix.so: $(winix.src.files)
@cd models ; $(MAKE) -e
@cd db ; $(MAKE) -e
@cd functions ; $(MAKE) -e
@cd notify ; $(MAKE) -e
@cd templates ; $(MAKE) -e
@cd notify ; $(MAKE) -e
@cd utils ; $(MAKE) -e
@cd $(GLOBAL_WORKING_DIR)/ezc/src ; $(MAKE) -e
@cd $(GLOBAL_WORKING_DIR)/tito/src ; $(MAKE) -e
@cd $(GLOBAL_WORKING_DIR)/pikotools ; $(MAKE) -e
@cd $(GLOBAL_WORKING_DIR)/morm/src ; $(MAKE) -e
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(winix_include_paths) core/*.o db/*.o models/*.o functions/*.o templates/*.o notify/*.o $(GLOBAL_WORKING_DIR)/ezc/src/ezc.a $(GLOBAL_WORKING_DIR)/tito/src/tito.a $(GLOBAL_WORKING_DIR)/pikotools/src/pikotools.a $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(LDFLAGS) -lfcgi -lpq -lz -lpthread -lcurl -lmagic -Wl,-no-whole-archive
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(winix_include_paths) core/*.o db/*.o models/*.o functions/*.o templates/*.o notify/*.o utils/*.o $(GLOBAL_WORKING_DIR)/ezc/src/ezc.a $(GLOBAL_WORKING_DIR)/tito/src/tito.a $(GLOBAL_WORKING_DIR)/pikotools/src/pikotools.a $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(LDFLAGS) -lfcgi -lpq -lz -lpthread -lcurl -lmagic -Wl,-no-whole-archive
winix: winix.so $(winix.src.files)
@ -101,6 +102,7 @@ clean:
@cd functions ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
@cd notify ; $(MAKE) -e clean
@cd utils ; $(MAKE) -e clean
@cd plugins/stats ; $(MAKE) -e clean
@cd plugins/thread ; $(MAKE) -e clean
@cd plugins/ticket ; $(MAKE) -e clean
@ -129,6 +131,7 @@ depend:
@cd functions ; $(MAKE) -e depend
@cd templates ; $(MAKE) -e depend
@cd notify ; $(MAKE) -e depend
@cd utils ; $(MAKE) -e depend
@cd plugins/stats ; $(MAKE) -e depend
@cd plugins/thread ; $(MAKE) -e depend
@cd plugins/ticket ; $(MAKE) -e depend

2
winixd/Makefile.dep

File diff suppressed because one or more lines are too long

858
winixd/core/Makefile.dep

File diff suppressed because it is too large Load Diff

2
winixd/core/Makefile.o.dep

@ -1 +1 @@
o = acceptbaseparser.o app.o basethread.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o httpsimpleparser.o image.o ipbancontainer.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o users.o winixbase.o winixmodeldeprecated.o winixrequest.o winixsystem.o
o = app.o basethread.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o httpsimpleparser.o image.o ipbancontainer.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o users.o winixbase.o winixmodeldeprecated.o winixrequest.o winixsystem.o

6
winixd/core/acceptencodingparser.h

@ -35,7 +35,7 @@
#ifndef headerfile_winix_core_acceptencodingparser
#define headerfile_winix_core_acceptencodingparser
#include "acceptbaseparser.h"
#include "utils/acceptbaseparser.h"
#include "log.h"
@ -62,7 +62,7 @@ public:
void ParseAndLog(const wchar_t * str)
{
Parse(str);
parse(str);
if( accept_deflate || accept_gzip )
{
@ -92,7 +92,7 @@ public:
private:
void Init()
void init()
{
accept_deflate = false;
accept_gzip = false;

4
winixd/core/acceptparser.h

@ -35,7 +35,7 @@
#ifndef headerfile_winix_core_acceptparser
#define headerfile_winix_core_acceptparser
#include "acceptbaseparser.h"
#include "utils/acceptbaseparser.h"
#include "log.h"
#include "header.h"
@ -67,7 +67,7 @@ public:
header_values.clear();
this->header_values = &header_values;
AcceptBaseParser::Parse(str);
AcceptBaseParser::parse(str);
std::sort(header_values.begin(), header_values.end(), [](HeaderValue & h1, HeaderValue & h2) -> bool {
return h1.weight > h2.weight;

1
winixd/main/Makefile.dep

@ -183,7 +183,6 @@ main.o: ../../../winix/winixd/core/httpsimpleparser.h
main.o: ../../../winix/winixd/core/cookieparser.h
main.o: ../../../winix/winixd/core/postmultiparser.h
main.o: ../../../winix/winixd/core/acceptencodingparser.h
main.o: ../../../winix/winixd/core/acceptbaseparser.h
main.o: ../../../winix/winixd/core/acceptparser.h
main.o: ../../../winix/winixd/core/winixrequest.h
main.o: ../../../winix/winixd/core/version.h

24
winixd/utils/Makefile

@ -0,0 +1,24 @@
include Makefile.o.dep
current_path := $(shell pwd)
global_relative_working_dir := $(shell relative_path $(current_path) $(GLOBAL_WORKING_DIR))
winix_include_paths = -I$(global_relative_working_dir)/winix/winixd -I$(global_relative_working_dir)/ezc/src -I$(global_relative_working_dir)/tito/src -I$(global_relative_working_dir)/morm/src -I$(global_relative_working_dir)/pikotools/src
all: $(o)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(winix_include_paths) $<
depend:
makedepend -Y. $(winix_include_paths) -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
clean:
rm -f *.o
include Makefile.dep

3
winixd/utils/Makefile.dep

@ -0,0 +1,3 @@
# DO NOT DELETE
acceptbaseparser.o: acceptbaseparser.h ../../../tito/src/misc.h

1
winixd/utils/Makefile.o.dep

@ -0,0 +1 @@
o = acceptbaseparser.o

24
winixd/core/acceptbaseparser.cpp → winixd/utils/acceptbaseparser.cpp

@ -34,7 +34,7 @@
#include <wchar.h>
#include "acceptbaseparser.h"
#include "misc.h"
#include "core/misc.h"
@ -53,7 +53,7 @@ return false;
}
void AcceptBaseParser::SkipWhite()
void AcceptBaseParser::skip_white()
{
while( IsWhite(*text) )
++text;
@ -62,10 +62,10 @@ void AcceptBaseParser::SkipWhite()
void AcceptBaseParser::ReadParameter()
void AcceptBaseParser::read_parameter()
{
param.clear();
SkipWhite();
skip_white();
while( *text!=0 && *text!=',' && *text!=';' )
{
@ -80,7 +80,7 @@ void AcceptBaseParser::ReadParameter()
void AcceptBaseParser::ReadQ()
{
q = 1.0;
SkipWhite();
skip_white();
if( *text != ';' )
return;
@ -96,14 +96,14 @@ void AcceptBaseParser::ReadQ()
++text; // skipping '='
SkipWhite();
skip_white();
q = wcstod(text, (wchar_t**)&text);
}
void AcceptBaseParser::SkipParam()
{
SkipWhite();
skip_white();
if( *text == ',' )
++text;
@ -111,14 +111,14 @@ void AcceptBaseParser::SkipParam()
void AcceptBaseParser::Parse(const wchar_t * str)
void AcceptBaseParser::parse(const wchar_t * str)
{
text = str;
Init();
init();
while( *text != 0 )
{
ReadParameter();
read_parameter();
ReadQ();
SkipParam();
Param(param, q);
@ -127,9 +127,9 @@ void AcceptBaseParser::Parse(const wchar_t * str)
void AcceptBaseParser::Parse(const std::wstring & str)
void AcceptBaseParser::parse(const std::wstring & str)
{
Parse(str.c_str());
parse(str.c_str());
}

14
winixd/core/acceptbaseparser.h → winixd/utils/acceptbaseparser.h

@ -36,7 +36,7 @@
#define headerfile_winix_core_acceptbaseparser
#include <string>
#include "winixbase.h"
#include "core/winixbase.h"
namespace Winix
@ -46,23 +46,23 @@ namespace Winix
// sample (you must create your own class derived from this one):
// object.Parse(L" text/html ; , ; q = 45, application / xhtml+xml ; q = 0.4 , application/xml ; q = 0.9 , */* ; q = 0.8 ");
// object.parse(L" text/html ; , ; q = 45, application / xhtml+xml ; q = 0.4 , application/xml ; q = 0.9 , */* ; q = 0.8 ");
class AcceptBaseParser : public WinixBase
{
public:
void Parse(const wchar_t * str);
void Parse(const std::wstring & str);
void parse(const wchar_t * str);
void parse(const std::wstring & str);
private:
virtual void Init() {} ;
virtual void init() {} ;
virtual void Param(const std::wstring & param, double q) = 0;
bool IsWhite(int c);
void SkipWhite();
void ReadParameter();
void skip_white();
void read_parameter();
void ReadQ();
void SkipParam();
Loading…
Cancel
Save