Skip to content
Snippets Groups Projects
Commit 3babcdb0 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

remove aaccept (renamed and improved in arun)

parent eeb079f4
No related branches found
No related tags found
No related merge requests found
SHELL:=/bin/bash
EXECUTABLE:=aaccept2
define NEW_LINE
endef
export NEW_LINE
LDFLAGS_DEBUG:=-L../alib2data/lib-debug -L../alib2algo/lib-debug -rdynamic -lxml2 -lalib2data -lalib2algo -Wl,-rpath,.
LDFLAGS_RELEASE:=-L../alib2data/lib-release -L../alib2algo/lib-release -rdynamic -lxml2 -lalib2data -lalib2algo -Wl,-rpath,.
OBJECTS_DEBUG:=$(patsubst src/%.cpp, obj-debug/%.o, $(shell find src/ -name *cpp))
OBJECTS_RELEASE:=$(patsubst src/%.cpp, obj-release/%.o, $(shell find src/ -name *cpp))
.PHONY: all build-debug clean-debug doc
all:
@echo "What to do master?"
obj%/makefile: makefile
mkdir -p $(dir $@)
echo "\
SHELL:=/bin/bash$${NEW_LINE}\
SRCDIR:=$${NEW_LINE}\
DEPTH:=$${NEW_LINE}\
OBJECTS_BASE_DIR:=$${NEW_LINE}\
$${NEW_LINE}\
define NEW_LINE$${NEW_LINE}\
$${NEW_LINE}\
$${NEW_LINE}\
endef$${NEW_LINE}\
$${NEW_LINE}\
export NEW_LINE$${NEW_LINE}\
$${NEW_LINE}\
CXXFLAGS:= -std=c++11 \$$(CXX_OTHER_FLAGS) -c -Wall -pedantic -Wextra -fPIC -I/usr/include/libxml2/ -I../../\$$(DEPTH)alib2data/src/ -I../../\$$(DEPTH)alib2algo/src/$${NEW_LINE}\
$${NEW_LINE}\
SOURCES:= \$$(shell find ../\$$(DEPTH)\$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\
DEPENDENCIES:= \$$(patsubst ../\$$(DEPTH)\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, ../\$$(DEPTH)\$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\
OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\
SOURCES_DIRS:= \$$(shell find ../\$$(DEPTH)\$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\
OBJECTS_DIRS:= \$$(patsubst ../\$$(DEPTH)\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\
OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\
$${NEW_LINE}\
.PHONY: all$${NEW_LINE}\
.PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\
$${NEW_LINE}\
all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\
$${NEW_LINE}\
%.d: makefile$${NEW_LINE}\
@echo \"\\$${NEW_LINE}\
\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -MM \\$$\$$(CXXFLAGS) \$$(patsubst ../\$$(DEPTH)\$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,../\$$(DEPTH)\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst ../\$$(DEPTH)\$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,../\$$(DEPTH)\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\
\$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\
\\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\
\" > \$$@$${NEW_LINE}\
$${NEW_LINE}\
%/makefile: makefile$${NEW_LINE}\
mkdir -p \$$(dir \$$@)$${NEW_LINE}\
cp makefile \$$@$${NEW_LINE}\
$${NEW_LINE}\
%/: FORCE | %/makefile$${NEW_LINE}\
@accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\
\$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ DEPTH=\$$(DEPTH)../ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\
accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\
if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\
touch .; \\$${NEW_LINE}\
fi$${NEW_LINE}\
$${NEW_LINE}\
FORCE:$${NEW_LINE}\
$${NEW_LINE}\
-include \$$(DEPENDENCIES)" > $@
debug: build-debug
release: build-release
clean: clean-debug clean-release
$(RM) -r doc
bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
mkdir -p $(dir $@)
$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
mkdir -p $(dir $@)
$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
obj-debug/: FORCE | obj-debug/makefile
$(MAKE) -C $@ OBJECTS_BASE_DIR=obj-debug SOURCES_BASE_DIR=src CXX_OTHER_FLAGS="-g -O0"
obj-release/: FORCE | obj-release/makefile
$(MAKE) -C $@ OBJECTS_BASE_DIR=obj-release SOURCES_BASE_DIR=src CXX_OTHER_FLAGS="-O3"
$(OBJECTS_DEBUG): obj-debug/
$(OBJECTS_RELEASE): obj-release/
build-debug: bin-debug/$(EXECUTABLE)
build-release: bin-release/$(EXECUTABLE)
clean-debug:
$(RM) -r *.o *.d bin-debug obj-debug
clean-release:
$(RM) -r *.o *.d bin-release obj-release
FORCE:
doc:
doxygen
//============================================================================
// Name : aminimize.cpp
// Author : Jan Travnicek
//============================================================================
#include <iostream>
#include <exception/AlibException.h>
#include <factory/DataFactory.hpp>
#include "automaton/run/Accept.h"
int main(int argc, char** argv) {
try {
if (argc == 2 && std::string("-h").compare(argv[1]) == 0) {
std::cout << "Automaton run." << std::endl << "Usage: aaccept string.xml < automaton.xml" << std::endl;
return -1;
} else if (argc == 2) {
automaton::Automaton automaton = alib::DataFactory::fromStdin<automaton::Automaton>();
string::LinearString string = alib::DataFactory::fromFile<string::LinearString>(argv[1]);
if(automaton::run::Accept::accept(automaton, string)) {
std::cout << "Accept" << std::endl;
return 0;
} else {
std::cout << "Reject" << std::endl;
return 1;
}
} else {
std::cout << "Automaton accept require automaton on stdin and string as argument" << std::endl;
return 2;
}
return 0;
} catch (const exception::AlibException& exception) {
alib::DataFactory::toStdout(exception);
return 2;
} catch(...) {
return 127;
}
}
...@@ -4,8 +4,7 @@ BINFOLDER = bin ...@@ -4,8 +4,7 @@ BINFOLDER = bin
   
CORE_LIB = alib2data CORE_LIB = alib2data
SUBDIRS_LIBS = alib2algo SUBDIRS_LIBS = alib2algo
SUBDIRS_BINS = aaccept2 \ SUBDIRS_BINS = acat2 \
acat2 \
aconversions2 \ aconversions2 \
aconvert2 \ aconvert2 \
aderivation2 \ aderivation2 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment