kaptain-0.73/0000750023433300116100000000000011532670023011573 5ustar zsoltengkaptain-0.73/kaptain.pro0000640023433300116100000000173311532667703013764 0ustar zsoltengCONFIG += qt QT += qt3support HEADERS += communication.h global.h grammar.h intermediate.h kaptain.h \ lexer.h process.h tools.h SOURCES += communication.cpp grammar.cpp intermediate.cpp kaptain.cpp \ main.cpp process.cpp tools.cpp LEXSOURCES += lexer.lpp YACCSOURCES += parser.ypp QMAKE_LEX = flex QMAKE_YACC = bison QMAKE_YACCFLAGS = -d -o parser.tab.c QMAKE_YACC_HEADER = parser.tab.h QMAKE_YACC_SOURCE = parser.tab.c unix:!macx { # installation on Unix-ish platforms isEmpty(PREFIX):PREFIX = /usr/local isEmpty(BIN_DIR):BIN_DIR = $$PREFIX/bin isEmpty(DATA_DIR):DATA_DIR = $$PREFIX/share isEmpty(DOCS_DIR):DOCS_DIR = $$DATA_DIR/doc/kaptain isEmpty(MAN_DIR):MAN_DIR = $$DATA_DIR/man/man1 target.path = $$BIN_DIR documentation.files = COPYING README doc/* documentation.path = $$DOCS_DIR man.files = man/kaptain.1 man.path = $$MAN_DIR examples.files = examples/* examples.path=$$DATA_DIR/kaptain INSTALLS = target documentation examples man } kaptain-0.73/Makefile0000640023433300116100000004234611532670040013244 0ustar zsolteng############################################################################# # Makefile for building: kaptain # Generated by qmake (2.01a) (Qt 4.6.2) on: Mon Feb 28 10:51:28 2011 # Project: kaptain.pro # Template: app # Command: /usr/bin/qmake -unix -o Makefile kaptain.pro ############################################################################# ####### Compiler, tools and options CC = gcc CXX = g++ DEFINES = -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED CFLAGS = -pipe -O2 -D_REENTRANT -Wall -W $(DEFINES) CXXFLAGS = -pipe -O2 -D_REENTRANT -Wall -W $(DEFINES) INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/Qt3Support -I/usr/include/qt4 -I. LINK = g++ LFLAGS = -Wl,-O1 LIBS = $(SUBLIBS) -L/usr/lib -lQt3Support -lQtGui -lQtCore -lpthread AR = ar cqs RANLIB = QMAKE = /usr/bin/qmake TAR = tar -cf COMPRESS = gzip -9f COPY = cp -f SED = sed COPY_FILE = $(COPY) COPY_DIR = $(COPY) -r STRIP = strip INSTALL_FILE = install -m 644 -p INSTALL_DIR = $(COPY_DIR) INSTALL_PROGRAM = install -m 755 -p DEL_FILE = rm -f SYMLINK = ln -f -s DEL_DIR = rmdir MOVE = mv -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p ####### Output directory OBJECTS_DIR = ./ ####### Files SOURCES = communication.cpp \ grammar.cpp \ intermediate.cpp \ kaptain.cpp \ main.cpp \ process.cpp \ tools.cpp moc_communication.cpp \ moc_kaptain.cpp \ parser_yacc.cpp \ lexer_lex.cpp OBJECTS = communication.o \ grammar.o \ intermediate.o \ kaptain.o \ main.o \ process.o \ tools.o \ moc_communication.o \ moc_kaptain.o \ parser_yacc.o \ lexer_lex.o DIST = /usr/share/qt4/mkspecs/common/g++.conf \ /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/linux.conf \ /usr/share/qt4/mkspecs/qconfig.pri \ /usr/share/qt4/mkspecs/features/qt_functions.prf \ /usr/share/qt4/mkspecs/features/qt_config.prf \ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/release.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ /usr/share/qt4/mkspecs/features/qt.prf \ /usr/share/qt4/mkspecs/features/unix/thread.prf \ /usr/share/qt4/mkspecs/features/moc.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ /usr/share/qt4/mkspecs/features/resources.prf \ /usr/share/qt4/mkspecs/features/uic.prf \ /usr/share/qt4/mkspecs/features/yacc.prf \ /usr/share/qt4/mkspecs/features/lex.prf \ /usr/share/qt4/mkspecs/features/include_source_dir.prf \ kaptain.pro QMAKE_TARGET = kaptain DESTDIR = TARGET = kaptain first: all ####### Implicit rules .SUFFIXES: .o .c .cpp .cc .cxx .C .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" ####### Build rules all: Makefile $(TARGET) $(TARGET): $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) Makefile: kaptain.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/linux.conf \ /usr/share/qt4/mkspecs/qconfig.pri \ /usr/share/qt4/mkspecs/features/qt_functions.prf \ /usr/share/qt4/mkspecs/features/qt_config.prf \ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/release.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ /usr/share/qt4/mkspecs/features/qt.prf \ /usr/share/qt4/mkspecs/features/unix/thread.prf \ /usr/share/qt4/mkspecs/features/moc.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ /usr/share/qt4/mkspecs/features/resources.prf \ /usr/share/qt4/mkspecs/features/uic.prf \ /usr/share/qt4/mkspecs/features/yacc.prf \ /usr/share/qt4/mkspecs/features/lex.prf \ /usr/share/qt4/mkspecs/features/include_source_dir.prf \ /usr/lib/libQt3Support.prl \ /usr/lib/libQtGui.prl \ /usr/lib/libQtCore.prl $(QMAKE) -unix -o Makefile kaptain.pro /usr/share/qt4/mkspecs/common/g++.conf: /usr/share/qt4/mkspecs/common/unix.conf: /usr/share/qt4/mkspecs/common/linux.conf: /usr/share/qt4/mkspecs/qconfig.pri: /usr/share/qt4/mkspecs/features/qt_functions.prf: /usr/share/qt4/mkspecs/features/qt_config.prf: /usr/share/qt4/mkspecs/features/exclusive_builds.prf: /usr/share/qt4/mkspecs/features/default_pre.prf: /usr/share/qt4/mkspecs/features/release.prf: /usr/share/qt4/mkspecs/features/default_post.prf: /usr/share/qt4/mkspecs/features/qt.prf: /usr/share/qt4/mkspecs/features/unix/thread.prf: /usr/share/qt4/mkspecs/features/moc.prf: /usr/share/qt4/mkspecs/features/warn_on.prf: /usr/share/qt4/mkspecs/features/resources.prf: /usr/share/qt4/mkspecs/features/uic.prf: /usr/share/qt4/mkspecs/features/yacc.prf: /usr/share/qt4/mkspecs/features/lex.prf: /usr/share/qt4/mkspecs/features/include_source_dir.prf: /usr/lib/libQt3Support.prl: /usr/lib/libQtGui.prl: /usr/lib/libQtCore.prl: qmake: FORCE @$(QMAKE) -unix -o Makefile kaptain.pro dist: @$(CHK_DIR_EXISTS) .tmp/kaptain1.0.0 || $(MKDIR) .tmp/kaptain1.0.0 $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/kaptain1.0.0/ && $(COPY_FILE) --parents communication.h global.h grammar.h intermediate.h kaptain.h lexer.h process.h tools.h .tmp/kaptain1.0.0/ && $(COPY_FILE) --parents communication.cpp grammar.cpp intermediate.cpp kaptain.cpp main.cpp process.cpp tools.cpp .tmp/kaptain1.0.0/ && $(COPY_FILE) --parents parser.ypp .tmp/kaptain1.0.0/ && $(COPY_FILE) --parents parser.ypp .tmp/kaptain1.0.0/ && $(COPY_FILE) --parents lexer.lpp .tmp/kaptain1.0.0/ && (cd `dirname .tmp/kaptain1.0.0` && $(TAR) kaptain1.0.0.tar kaptain1.0.0 && $(COMPRESS) kaptain1.0.0.tar) && $(MOVE) `dirname .tmp/kaptain1.0.0`/kaptain1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/kaptain1.0.0 clean:compiler_clean -$(DEL_FILE) $(OBJECTS) -$(DEL_FILE) *~ core *.core ####### Sub-libraries distclean: clean -$(DEL_FILE) $(TARGET) -$(DEL_FILE) Makefile mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all compiler_moc_header_make_all: moc_communication.cpp moc_kaptain.cpp compiler_moc_header_clean: -$(DEL_FILE) moc_communication.cpp moc_kaptain.cpp moc_communication.cpp: communication.h /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) communication.h -o moc_communication.cpp moc_kaptain.cpp: kaptain.h /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) kaptain.h -o moc_kaptain.cpp compiler_rcc_make_all: compiler_rcc_clean: compiler_image_collection_make_all: qmake_image_collection.cpp compiler_image_collection_clean: -$(DEL_FILE) qmake_image_collection.cpp compiler_moc_source_make_all: compiler_moc_source_clean: compiler_uic_make_all: compiler_uic_clean: compiler_yacc_decl_make_all: parser_yacc.h compiler_yacc_decl_clean: -$(DEL_FILE) parser_yacc.h parser_yacc.h: parser.ypp bison -d -o parser.tab.c -p parser -b parser parser.ypp rm -f parser_yacc.h parser_yacc.cpp mv -f parser.tab.h parser_yacc.h mv -f parser.tab.c parser_yacc.cpp compiler_yacc_impl_make_all: parser_yacc.cpp compiler_yacc_impl_clean: -$(DEL_FILE) parser_yacc.cpp parser_yacc.cpp: parser.ypp \ parser_yacc.h compiler_lex_make_all: lexer_lex.cpp compiler_lex_clean: -$(DEL_FILE) lexer_lex.cpp lexer_lex.cpp: lexer.lpp flex -Plexer lexer.lpp rm -f lexer_lex.cpp mv -f lex.lexer.c lexer_lex.cpp compiler_clean: compiler_moc_header_clean compiler_yacc_decl_clean compiler_yacc_impl_clean compiler_lex_clean ####### Compile communication.o: communication.cpp global.h \ tools.h \ communication.h \ grammar.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o communication.o communication.cpp grammar.o: grammar.cpp global.h \ grammar.h \ communication.h \ tools.h \ intermediate.h \ kaptain.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o grammar.o grammar.cpp intermediate.o: intermediate.cpp intermediate.h \ grammar.h \ kaptain.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o intermediate.o intermediate.cpp kaptain.o: kaptain.cpp tools.h \ process.h \ kaptain.h \ intermediate.h \ grammar.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kaptain.o kaptain.cpp main.o: main.cpp global.h \ tools.h \ communication.h \ process.h \ grammar.h \ intermediate.h \ kaptain.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp process.o: process.cpp process.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o process.o process.cpp tools.o: tools.cpp tools.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tools.o tools.cpp moc_communication.o: moc_communication.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_communication.o moc_communication.cpp moc_kaptain.o: moc_kaptain.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kaptain.o moc_kaptain.cpp parser_yacc.o: parser_yacc.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o parser_yacc.o parser_yacc.cpp lexer_lex.o: lexer_lex.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o lexer_lex.o lexer_lex.cpp ####### Install install_target: first FORCE @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/bin/ -$(INSTALL_PROGRAM) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)" -$(STRIP) "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)" uninstall_target: FORCE -$(DEL_FILE) "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)" -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/bin/ install_documentation: first FORCE @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/COPYING $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/README $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/crypt.gif $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/database.tgz $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/fig1.png $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/kaptain.html $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/kaptain.info $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/kaptain.texi $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/record.gif $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/tar.gif $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/doc/tutorial.tgz $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ uninstall_documentation: FORCE -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/COPYING -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/README -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/crypt.gif -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/database.tgz -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/fig1.png -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/kaptain.html -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/kaptain.info -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/kaptain.texi -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/record.gif -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/tar.gif -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/doc/kaptain/tutorial.tgz -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/share/doc/kaptain/ install_examples: first FORCE @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/share/kaptain/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/arping.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/budget.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/crypt.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/curl.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/dia2code.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/emboss.tgz $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/enscript.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/find.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/finger.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/grep.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/indent.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/lameGUI.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/ls.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/mpage.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/nslookup.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/open.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/ping.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/povray.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/procmail.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/puf.tgz $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/search.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/tar.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/weblint.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/wget.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/whois.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/examples/zangband.kaptn $(INSTALL_ROOT)/usr/local/share/kaptain/ uninstall_examples: FORCE -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/arping.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/budget.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/crypt.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/curl.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/dia2code.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/emboss.tgz -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/enscript.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/find.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/finger.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/grep.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/indent.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/lameGUI.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/ls.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/mpage.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/nslookup.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/open.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/ping.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/povray.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/procmail.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/puf.tgz -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/search.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/tar.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/weblint.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/wget.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/whois.kaptn -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/kaptain/zangband.kaptn -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/share/kaptain/ install_man: first FORCE @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/share/man/man1/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/share/man/man1/ -$(INSTALL_FILE) /home/zsolt/kaptain/kaptain-0.73/man/kaptain.1 $(INSTALL_ROOT)/usr/local/share/man/man1/ uninstall_man: FORCE -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/man/man1/kaptain.1 -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/share/man/man1/ install: install_target install_documentation install_examples install_man FORCE uninstall: uninstall_target uninstall_documentation uninstall_examples uninstall_man FORCE FORCE: kaptain-0.73/communication.cpp0000640023433300116100000001563111531160643015154 0ustar zsolteng#include #include #include #include #include #include #include #include #include #include #include #include #include #include "global.h" #include "tools.h" #include "communication.h" #include "grammar.h" #define NO_MORE_IO "At most one i/o channel is allowed.\n" extern Grammar * yygrammar; Communicator::Communicator() { reader=0; fd_read=-1; fd_write=-1; input=true; output=true; ok=false; } Communicator::~Communicator() { if (reader) delete reader; if (fd_read!=-1) close(fd_read); if (fd_write!=-1) close(fd_write); } bool Communicator::is_stdin() { return fd_read==STDIN_FILENO; } bool Communicator::setup_stdio() { if (fd_read!=-1 || fd_write!=-1) { MAKE_WARNING(NO_MORE_IO); return false; } setup_stdin(); setup_stdout(); return true; } bool Communicator::setup_socket_server(string port_str) { if (fd_read!=-1 || fd_write!=-1) { MAKE_WARNING(NO_MORE_IO); return false; } int port; /* determining port number */ if (sscanf(port_str.c_str(), "%d", &port)!=1) { ostringstream message; message << "Invalid port number `" << port_str << "'." << endl; MAKE_ERROR(message.str()); return false; } int socket_fd; struct sockaddr_in my_addr; struct sockaddr_in their_addr; int sin_size, yes=1; /* Create the socket. */ socket_fd = socket (AF_INET, SOCK_STREAM, 0); if (socket_fd == -1) { MAKE_ERROR(string("socket: ")+string(strerror(errno))+string(".\n")); return false; } if (setsockopt(socket_fd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1) { MAKE_ERROR(string("setsockopt: ")+string(strerror(errno))+string(".\n")); return false; } my_addr.sin_family = AF_INET; // host byte order my_addr.sin_port = htons(port); // short, network byte order my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct /* bind */ if (bind(socket_fd, (struct sockaddr *)&my_addr, sizeof (struct sockaddr)) == -1) { MAKE_ERROR(string("bind: ")+string(strerror(errno))+string(".\n")); return false; } /* listen */ if (listen(socket_fd,1) == -1) { MAKE_ERROR(string("listen: ")+string(strerror(errno))+string(".\n")); return false; } /* accept */ sin_size = sizeof(struct sockaddr_in); fd_read=accept(socket_fd, (struct sockaddr *)& their_addr, (socklen_t *)&sin_size); if (fd_read==-1) { MAKE_ERROR(string("accept: ")+string(strerror(errno))+string(".\n")); return false; } fcntl(fd_read, F_SETFL, O_NONBLOCK); //cout << inet_ntoa(their_addr.sin_addr) << endl; fd_write=fd_read; reader=new QSocketNotifier(fd_read, QSocketNotifier::Read); connect(reader, SIGNAL(activated(int)), SLOT(data_arrived(int))); ok=true; return true; } bool Communicator::setup_socket_client(string url) { if (fd_read!=-1 || fd_write!=-1) { MAKE_WARNING(NO_MORE_IO); return false; } unsigned int port; size_t separ; string host, port_str; /* separating host and port */ separ=url.find(':'); if (separ==url.npos) { ostringstream message; message << "Could not determine server address and port from `" << url << "' (host:port)." << endl; MAKE_ERROR(message.str()); return false; } /* determining port number */ host=url.substr(0,separ); port_str=url.substr(separ+1); if (sscanf(port_str.c_str(), "%u", &port)!=1) { ostringstream message; message << "Invalid port number `" << port_str << "'." << endl; MAKE_ERROR(message.str()); return false; } /* connect to the server */ struct hostent* hostinfo; struct sockaddr_in their_addr; hostinfo = gethostbyname (host.c_str()); if (hostinfo == NULL) { MAKE_ERROR(string("Couldn't resolve host name `") +host+string("'.\n")); return false; } fd_read = socket (AF_INET, SOCK_STREAM, 0); if (fd_read == -1) { MAKE_ERROR(string("socket: ")+string(strerror(errno))+string(".\n")); return false; } their_addr.sin_family = AF_INET; // host byte order their_addr.sin_port = htons(port); // short, network byte order their_addr.sin_addr = *((struct in_addr *)hostinfo->h_addr); memset(&(their_addr.sin_zero), '\0', 8); // zero the rest of the struct if (::connect (fd_read, (struct sockaddr *)&their_addr, sizeof (struct sockaddr)) == -1) { MAKE_ERROR(string("Couldn't connect to `") +url+string("'. ")+string(strerror(errno))+string("\n")); return false; } fd_write=fd_read; fcntl(fd_read, F_SETFL, O_NONBLOCK); reader=new QSocketNotifier(fd_read, QSocketNotifier::Read); connect(reader, SIGNAL(activated(int)), SLOT(data_arrived(int))); ok=true; return true; } bool Communicator::setup_progio(string command) { if (fd_read!=-1 || fd_write!=-1) { MAKE_WARNING(NO_MORE_IO); return false; } int left[2]; int right[2]; pid_t pid; pipe (left); pipe (right); pid = fork (); if (pid == (pid_t) 0) { close (left[1]); close (right[0]); dup2 (left[0], STDIN_FILENO); dup2 (right[1], STDOUT_FILENO); execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL); } else { close (left[0]); close (right[1]); fd_read=right[0]; fd_write=left[1]; } if (fd_read!=-1 && fd_write!=-1) { fcntl(fd_read, F_SETFL, O_NONBLOCK); reader=new QSocketNotifier(fd_read, QSocketNotifier::Read); connect(reader, SIGNAL(activated(int)), SLOT(data_arrived(int))); ok=true; return true; } MAKE_ERROR("Unable to create pipe to `"+command+"': "+strerror(errno)+".\n"); return false; } bool Communicator::setup_stdin() { fd_read=STDIN_FILENO; // stdin fcntl(fd_read, F_SETFL, O_NONBLOCK | O_RDONLY ); reader=new QSocketNotifier(fd_read, QSocketNotifier::Read); connect(reader, SIGNAL(activated(int)), SLOT(data_arrived(int))); return true; } bool Communicator::setup_stdout() { fd_write=STDOUT_FILENO; ok=true; return true; } bool Communicator::setup_filein(string) { return false; } bool Communicator::setup_fileout(string) { return false; } void Communicator::send(string message) { if (ok && output) { int res=write(fd_write, message.c_str(), message.size()); if (res==-1) { cerr << (string("Error: Unable to send data: ") +string(strerror(errno))+string(".\n")); exit(-1); close(fd_write); ok=false; } } } void Communicator::data_arrived(int) { #define BUFF_SIZE 255 char buff[BUFF_SIZE+1]; ssize_t n; do { n=read(fd_read, buff, BUFF_SIZE); if (n==-1) { break; } buff[n]=0; message+=string(buff); } while (n==BUFF_SIZE); size_t line; while ( (line=message.find('\n'))!=message.npos) { string first_line=message.substr(0,line+1); if (input) yygrammar->recieve(first_line); message=message.substr(line+1); } } kaptain-0.73/communication.h0000640023433300116100000000136110120611332014601 0ustar zsolteng#ifndef COMMUNICATION_HH #define COMMUNICATION_HH #include #include using namespace std; class Communicator : public QObject { Q_OBJECT private: int fd_read, fd_write; QSocketNotifier * reader; bool ok; bool input, output; string message; // buffer public: Communicator(); ~Communicator(); bool is_stdin(); bool setup_stdio(); bool setup_progio(string); bool setup_socket_server(string); bool setup_socket_client(string); bool setup_stdin(); bool setup_stdout(); bool setup_filein(string); bool setup_fileout(string); void no_input() {input=false;} void no_output() {output=false;} void send(string); public slots: void data_arrived(int); }; #endif // COMMUNICATION_HH kaptain-0.73/global.h0000640023433300116100000000044210120611331013172 0ustar zsolteng#ifndef GLOBAL_HH #define GLOBAL_HH class Error; extern void STATUS(const char *); extern void DONE(void); extern Error * glob_error; #define MAKE_ERROR(s) (glob_error->error(s)) #define MAKE_WARNING(s) (glob_error->warning(s)) #define GO_ON() (glob_error->go_on()) #endif // GLOBAL_HH kaptain-0.73/grammar.cpp0000640023433300116100000006454511162156751013752 0ustar zsolteng#include #include #include #include "global.h" #include "grammar.h" #include "communication.h" #include "tools.h" #include "intermediate.h" #include "kaptain.h" extern Communicator * glob_communicator; const char * special_names[]={ "@integer", // 1 "@string", // 2 "@list", // 3 "@float", // 4 "@button", // 5 "@regexp", // 6 "@infile", // 7 "@outfile", // 8 "@directory", // 9 "@combo", // 10 "@container", // 11 "@close", // 12 "@action", // 13 "@edit", // 14 "@combow", // 15 "@exec", // 16 "@echo", // 17 "@icon", // 18 "@text", // 19 "@execclose", // 20 "@execbuffer", // 21 "@dump", // 22 "@preview", // 23 "@size", // 24 "@password", // 25 "@fork", // 26 "@fill", // 27 "@multicol", // 28 "@line" // 29 }; int special_num=29; const char * modifier_names[]={ ":tabbed", // 1 ":framed", // 2 ":horizontal", // 4 ":wizard", // 8 ":dialog", // 16 ":reverse", // 32 ":noeval", // 64 ":double", // 128 ":beside", // 256 ":tree", // 512 ":detailed", // 1024 ":stack", // 2048 ":checkbox", // 4096 ":tristate", // 8192 ":radioparent", // 16384 ":leftaligned", // 32768 ":rightaligned", // 65536 ":radio", // 131072 "" }; int modifier_num=12; int extra_modifier_num=18; int two_power[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864}; /*----------------------------------------------------------------------*/ Grammar::Grammar() { start_rule=0; was_default_widget_done=false; } Grammar::~Grammar() { list::iterator pr; /* delete the rules of the grammar */ for (pr=rules.begin(); pr!=rules.end(); pr++) if (*pr) delete *pr; list::iterator pd; /* delete the descriptions of the grammar */ for (pd=descriptions.begin(); pd!=descriptions.end(); pd++) if (*pd) delete *pd; } void Grammar::add_rule(Rule * r) { rules.push_back(r); } void Grammar::add_description(string *s, list *l, string **t) { descriptions.push_back(new Description(this, s, l, t)); } void Grammar::add_constraint(string *s1, string *s2) { int n1=broker.get_nonterminal(s1), n2=broker.get_nonterminal(s2); /* add to a multimap */ constraints.insert(pair(n1, n2)); } Rule * Grammar::get_rule(int nt) { Rule * result=0; list::iterator ri; for (ri=rules.begin(); ri!=rules.end(); ri++) if ((*ri)->get_left()==nt) result=(*ri); /* return the pointer to the last rule of the list having left side `nt' */ return result; } void Grammar::verify() { /* verify every separate rule */ list::iterator rp; for (rp=rules.begin(); rp!=rules.end(); rp++) if (*rp) // special symbol names // modifier symbol names (*rp)->verify_rule(); /* start rule */ verify_start_rule(); /* recursion */ STATUS("Looking for recursion..."); verify_recursion(); DONE(); /* unreachable nonterminals */ STATUS("Checking reachability..."); verify_reachability(); DONE(); /* unterminateable nonterminals */ STATUS("Verifying termination..."); verify_terminateability(); DONE(); /* descriptions of nonexistent rules */ verify_descriptions(); } void Grammar::verify_start_rule() { if (!GO_ON()) return; string start_const("start"); int start=broker.get_nonterminal(&start_const); list::iterator rp; for (rp=rules.begin(); rp!=rules.end(); rp++) if (*rp) { if ((*rp)->get_left()==start) { start_rule=*rp; break; } } if (rp==rules.end()) { ostringstream message; /* No `start' rule. */ message << "No `start' rule." << endl; MAKE_ERROR(message.str()); } } void Grammar::verify_recursion() { if (!GO_ON()) return; int i=0; int N=broker.get_nt_num(); vector > is_on_right; is_on_right.resize(N); int validnum=0; vector valid; valid.resize(N); for (i=0; i::iterator rp; for (rp=rules.begin(); rp!=rules.end(); rp++) if (*rp) { if ((*rp)->disjunction==0) continue; list & conj=(*rp)->disjunction->conjunctions; list::iterator cp; for (cp=conj.begin(); cp!=conj.end(); cp++) { list::iterator ip; list & li=(*cp)->symbols; for (ip=li.begin(); ip!=li.end(); ip++) if (*ip<0) { is_on_right[-*ip-1].push_back(-(*rp)->get_left()-1); } } if (!valid[-(*rp)->get_left()-1]) validnum++; valid[-(*rp)->get_left()-1]=true; } i=0; while (i0) { /* recursion found */ ostringstream message; message << "Recursion found in rules:"; for (int j=0; j nt_done; set nt_pending; int current; nt_pending.insert(start_rule->get_left()); do { /* get first pending element */ current=*nt_pending.begin(); nt_pending.erase(nt_pending.begin()); list::iterator rp; for (rp=rules.begin(); rp!=rules.end(); rp++) if (*rp) if ((*rp)->get_left()==current) { /* normal rule, having a right side */ if ((*rp)->disjunction) { list & conj=(*rp)->disjunction->conjunctions; list::iterator cp; for (cp=conj.begin(); cp!=conj.end(); cp++) { list::iterator ip; list & li=(*cp)->symbols; for (ip=li.begin(); ip!=li.end(); ip++) if (*ip<0 && *ip!=current && find(nt_done.begin(), nt_done.end(), *ip) == nt_done.end() && find(nt_pending.begin(), nt_pending.end(), *ip) == nt_pending.end() ) { nt_pending.insert(*ip); } } } if ((*rp)->type>0 && (*rp)->parameters) { /* special symbol: parameters are also reachable */ list::iterator pi; for (pi=(*rp)->parameters->begin(); pi!=(*rp)->parameters->end(); pi++) if (*pi && (*pi)->type==T_NONTERM) { int nt=(*pi)->value; if (find(nt_done.begin(), nt_done.end(), nt) == nt_done.end() && find(nt_pending.begin(), nt_pending.end(), nt) == nt_pending.end()) nt_pending.insert(nt); } } if ((*rp)->type>0 && (*rp)->initvalue) { /* special symbol: initvalue is also reachable */ if ((*rp)->initvalue && (*rp)->initvalue->type==T_NONTERM) { int nt=(*rp)->initvalue->value; if (find(nt_done.begin(), nt_done.end(), nt) == nt_done.end() && find(nt_pending.begin(), nt_pending.end(), nt) == nt_pending.end()) nt_pending.insert(nt); } } } nt_done.insert(current); } while (!nt_pending.empty()); list unreachable; int nt_num=broker.get_nt_num(); for (int i=0; i::iterator it; for (it=unreachable.begin(); it!=unreachable.end(); it++) { string name=broker.get_string(*it); if (name[0]!='-') /* not internal nonterminal */ message << " `" << name << "'"; } message << "." << endl; MAKE_WARNING(message.str()); } } void Grammar::verify_terminateability() { if (!GO_ON()) return; list unterminated; list::iterator rp; /* check every rule */ for (rp=rules.begin(); rp!=rules.end(); rp++) if (*rp) { /* normal rule, having a right side */ if ((*rp)->disjunction) { list & conj=(*rp)->disjunction->conjunctions; list::iterator cp; for (cp=conj.begin(); cp!=conj.end(); cp++) { list::iterator ip; list & li=(*cp)->symbols; for (ip=li.begin(); ip!=li.end(); ip++) if (*ip<0 && get_rule(*ip)==0) unterminated.push_back(*ip); } } if ((*rp)->type>0) /* SPECIAL */ { if ((*rp)->parameters) { /* parameters are also reachable */ list::iterator pi; for (pi=(*rp)->parameters->begin(); pi!=(*rp)->parameters->end(); pi++) if (*pi && (*pi)->type==T_NONTERM) { int nt=(*pi)->value; if (nt<0 && get_rule(nt)==0) unterminated.push_back(nt); } } if ((*rp)->initvalue) { /* initvalue is also reachable */ if ((*rp)->initvalue && (*rp)->initvalue->type==T_NONTERM) { int nt=(*rp)->initvalue->value; if (nt<0 && get_rule(nt)==0) unterminated.push_back(nt); } } } } /* make message */ if (!unterminated.empty()) { ostringstream message; message << "Unterminated nonterminals:"; list::iterator it; for (it=unterminated.begin(); it!=unterminated.end(); it++) { string name=broker.get_string(*it); if (name[0]!='-') /* not internal nonterminal */ message << " `" << name << "'"; } message << "." << endl; MAKE_ERROR(message.str()); } } void Grammar::verify_descriptions() { if (!GO_ON()) return; list::iterator di; for (di=descriptions.begin(); di!=descriptions.end(); di++) if (*di) { Rule * r=get_rule((*di)->nonterminal); if (r==0) { ostringstream message; message << "No rule found for `" << broker.get_string((*di)->nonterminal) << "', description ignored." << endl; MAKE_WARNING(message.str()); delete *di; descriptions.erase(di); } } } void Grammar::unify_rules() { if (!GO_ON()) return; /* combines several rules of the same left hand side */ list::iterator r, rx; restart: for (r=rules.begin(); r!=rules.end(); r++) if (*r) { rx=r; rx++; while (rx!=rules.end()) if (*rx) { if ((*r)->get_left()==(*rx)->get_left()) { /* unifying `r' and `rx' */ list::reverse_iterator ci; if ((*r)->disjunction) for (ci=(*r)->disjunction->conjunctions.rbegin(); ci!=(*r)->disjunction->conjunctions.rend(); ci++) if (*ci) { (*rx)->disjunction->add_conjunction(*ci); *ci=0; } Rule * zombie=*r; rules.erase(r); delete zombie; goto restart; } rx++; } } } void Grammar::unify_descriptions() { /* insert description data into rules */ list::iterator di; for (di=descriptions.begin(); di!=descriptions.end(); di++) if (*di) { int nt=(*di)->nonterminal; Rule * r=get_rule(nt); if (r->textinfo[0].empty()) r->textinfo[0]=(*di)->textinfo[0]; if (r->textinfo[1].empty()) r->textinfo[1]=(*di)->textinfo[1]; if (r->textinfo[2].empty()) r->textinfo[2]=(*di)->textinfo[2]; if ((*di)->modifiers) { r->add_modifiers((*di)->modifiers); (*di)->modifiers=0; } } } void Grammar::unify() { unify_rules(); unify_descriptions(); } string Grammar::evaluate_nonterminal(int nt, bool consider_noeval) { //cout << "Grammar::evaluate_nonterminal(" << nt << ")" << endl; string s; Rule * r=get_rule(nt); if (r) s=r->evaluate(consider_noeval); return s; } int Grammar::get_constraint_for(int nt) { int result=0; multimap::iterator mi; mi=constraints.find(nt); if (mi!=constraints.end()) result=mi->second; return result; } void Grammar::send(string message) { glob_communicator->send(message); } void Grammar::recieve(string message) { size_t b=message.find_first_of("(=?!"); if (b!=message.npos) { string tail=message.substr(b+1,message.length()-b-1); string head=message.substr(0,b); int nt=broker.get_nonterminal(&head); Rule * r=get_rule(nt); if (r) r->recieve(message[b],tail); } } /*----------------------------------------------------------------------*/ Rule::Rule(Grammar * gr) { grammar=gr; left=0; disjunction=0; parameters=0; type=0; /* normal by default */ initvalue=0; transformations=0; modifiers=0; my_intermediate=0; } Rule::~Rule() { if (disjunction) delete disjunction; if (parameters) { list::iterator pp; /* delete each parameter in the list */ for (pp=parameters->begin(); pp!=parameters->end(); pp++) if (*pp) delete *pp; delete parameters; } if (initvalue) delete initvalue; if (transformations) { list::iterator tp; /* delete each transformation in the list */ for (tp=transformations->begin(); tp!=transformations->end(); tp++) if (*tp) delete *tp; delete transformations; } if (modifiers) { list::iterator sp; /* delete each modifier in the list */ for (sp=modifiers->begin(); sp!=modifiers->end(); sp++) if (*sp) delete *sp; delete modifiers; } } void Rule::set_left(string * s) { left=grammar->broker.get_nonterminal(s); } void Rule::set_disjunction(Disjunction * d) { disjunction=d; } void Rule::set_special(string * spec_name, list * params, Parameter * init) { type=1; if (spec_name) special_type=*spec_name; /* remove old values */ if (initvalue) delete initvalue; if (parameters) { list::iterator pi; for (pi=parameters->begin(); pi!=parameters->end(); pi++) if (*pi) delete (*pi); delete parameters; } /* set new values */ initvalue=init; parameters=params; } void Rule::add_modifiers(list * l) { if (modifiers==0) modifiers=l; else { list::iterator sp; for (sp=l->begin(); sp!=l->end(); sp++) modifiers->push_back(*sp); delete l; } } void Rule::set_textinfo(string ** ti) { /* `ti' is an array of 3 string pointers */ if (ti[0]) textinfo[0]=*ti[0]; if (ti[1]) textinfo[1]=*ti[1]; if (ti[2]) textinfo[2]=*ti[2]; } void Rule::set_transformations(list * t) { transformations=t; } void Rule::verify_rule() { if (!GO_ON()) return; /* verify special name also sets `type' */ if (type>0) { for (type=0; type::iterator mi; if (modifiers) for (mi=modifiers->begin(); mi!=modifiers->end(); mi++) if (*mi) { int n=0; for (n=0; nbroker.get_string(left) << endl; string result; if (type>0) { //cout << "SPEC " << type << endl; if (my_intermediate) result=my_intermediate->evaluate_special(); } else if (disjunction) { if (disjunction->conjunctions.size()==0); else if (disjunction->conjunctions.size()==1) result=disjunction->conjunctions.front()->evaluate(consider_noeval); else { int sel=0; if (my_intermediate) sel=my_intermediate->get_current_selection(); else { // directly default selection: sel=disjunction->default_num; /* try using constraints */ int nt=grammar->get_constraint_for(left); if (nt!=0) { Rule * source=grammar->get_rule(nt); if (source && source->my_intermediate) sel=source->my_intermediate-> get_current_selection(); } } /* find `sel'th child */ list::iterator ci; for (ci=disjunction->conjunctions.begin(); ci!=disjunction->conjunctions.end(); ci++) { if (sel==0) break; sel--; } if (ci!=disjunction->conjunctions.end()) result=(*ci)->evaluate(consider_noeval); } } /* perform some transformations ... */ if (transformations) { list::iterator ti; for (ti=transformations->begin(); ti!=transformations->end(); ti++) if (*ti) { string result2=result; /* apply (*ti) to result */ if ((*ti)->type==T_SUBST) { //cout << "s '" << (*ti)->data << "' '" // << (*ti)->data2 << "' " // << ((*ti)->value ? 't' : 'f') // << endl; /* substitution */ Regexp::substitute((*ti)->data, // pattern result2, // src (*ti)->data2, // replacement result, // dest (*ti)->value); } if ((*ti)->type==T_TRANS) { //cout << "t '" << (*ti)->data << "' '" // << (*ti)->data2 << "' " // << endl; Regexp::transliterate((*ti)->data, // from (*ti)->data2, // to result2, // src result); // dest } } } if (consider_noeval && my_intermediate && my_intermediate->is(is_noeval)) result.erase(); return result; } int Rule::get_default_selection() { int sel=0; if (disjunction) sel=disjunction->get_default_num(); /* reverse checkboxes */ if (my_intermediate->is(is_checkbox) && disjunction->conjunctions.size()==2 && disjunction->conjunctions.front()->symbols.size()==0) /* setting checkbox means to choose nonempty */ sel=1-sel; return sel; } int Rule::get_current_selection() { int sel=0; if (my_intermediate) sel=my_intermediate->get_current_selection(); /* treat reversed disjunctions in a different way: `a -> @ | b' */ if (my_intermediate->is(is_checkbox) && disjunction->conjunctions.size()==2 && disjunction->conjunctions.front()->symbols.size()==0) /* setting checkbox means to choose nonempty */ sel=1-sel; return sel; } void Rule::send(string message, bool prefix_sender) { string total; if (prefix_sender) total=grammar->broker.get_string(left)+message+'\n'; else total=message+'\n'; grammar->send(total); } void Rule::recieve(char command, string message) { if (my_intermediate) if (command=='?') { // process here send(evaluate(false), false); // don't consider :noeval and do not write sender before the message } else if (command=='!') { /* FIXME */ } else { /* process at `intermediate' */ my_intermediate->recieve(command+message); } } /*----------------------------------------------------------------------*/ Disjunction::Disjunction(Grammar * gr) { grammar=gr; default_num=-1; } Disjunction::~Disjunction() { list::iterator cp; /* delete each conjunction in the list */ for(cp=conjunctions.begin(); cp!=conjunctions.end(); cp++) if (*cp) delete *cp; } int Disjunction::get_default_num() { if (default_num==-1) { default_num=0; int def=0; list::iterator conj; /* set `num_default' to the last conjunction marked to be default */ for (conj=conjunctions.begin(); conj!=conjunctions.end(); conj++, def++) if ((*conj)->get_default()) default_num=def; } return default_num; } void Disjunction::add_conjunction(Conjunction * c) { conjunctions.push_front(c); } /*----------------------------------------------------------------------*/ Conjunction::Conjunction(Grammar * gr) { grammar=gr; is_default=false; } Conjunction::~Conjunction() { } void Conjunction::set_default() { is_default=true; } void Conjunction::add_nonterminal(string * s) { symbols.push_front(grammar->broker.get_nonterminal(s)); } void Conjunction::add_terminal(string * s) { symbols.push_front(grammar->broker.get_terminal(s)); } void Conjunction::add_special(string * s, list * p, Parameter * iv) { Rule * r=new Rule(grammar); ostringstream name; int new_left_side=-grammar->broker.get_nt_num()-1; name << new_left_side; string str=name.str(); r->set_left(&str); r->set_special(s, p, iv); grammar->add_rule(r); symbols.push_front(new_left_side); } string Conjunction::evaluate(bool consider_noeval) { //cout << "Conjunction::evaluate()" << endl; string s; list::iterator li; for (li=symbols.begin(); li!=symbols.end(); li++) if ((*li)>0) s+=grammar->broker.get_string(*li); else s+=grammar->evaluate_nonterminal(*li, consider_noeval); return s; } /*----------------------------------------------------------------------*/ Broker::Broker() { /* initial table sizes */ nonterminal_table.reserve(20); terminal_table.reserve(20); } Broker::~Broker() { } int Broker::get_nonterminal(string * s) { int result; vector::iterator it; it=find(nonterminal_table.begin(), nonterminal_table.end(), *s); if (it==nonterminal_table.end()) { /* insert element as new */ nonterminal_table.push_back(*s); result=nonterminal_table.size()-1; } else result=it-nonterminal_table.begin(); return -result-1; } int Broker::get_terminal(string * s) { int result; vector::iterator it; it=find(terminal_table.begin(), terminal_table.end(), *s); if (it==terminal_table.end()) { /* insert element as new */ terminal_table.push_back(*s); result=terminal_table.size()-1; } else result=it-terminal_table.begin(); return result+1; } string Broker::get_string(int i) { if (i<0) { /* nonterminal */ return nonterminal_table[-i-1]; } else { /* terminal */ return terminal_table[i-1]; } } /*----------------------------------------------------------------------*/ Parameter::Parameter(Grammar * gr) { grammar=gr; } void Parameter::set_numeral(int n) { type=T_NUMERAL; value=n; } void Parameter::set_string(string * s) { type=T_STRING; data=*s; } void Parameter::set_nonterminal(string * s) { type=T_NONTERM; value=grammar->broker.get_nonterminal(s); } void Parameter::set_regexp(string * s) { type=T_REGEXP; data=*s; } void Parameter::set_substitution(string ** s) { type=T_SUBST; data=*s[0]; data2=*s[1]; if ((*s[2])[0]=='g') value=1; // indicate `g' flag else value=0; } void Parameter::set_transliteration(string ** s) { type=T_TRANS; data=*s[0]; data2=*s[1]; } /*----------------------------------------------------------------------*/ Description::Description(Grammar * gr, string *s, list *l, string **t) { grammar=gr; nonterminal=grammar->broker.get_nonterminal(s); modifiers=l; if (t[0]) textinfo[0]=*t[0]; if (t[1]) textinfo[1]=*t[1]; if (t[2]) textinfo[2]=*t[2]; } Description::~Description() { if (modifiers) { list::iterator sp; for (sp=modifiers->begin(); sp!=modifiers->end(); sp++) if (*sp) delete *sp; delete modifiers; } } kaptain-0.73/grammar.h0000640023433300116100000001060210120611331013357 0ustar zsolteng#ifndef GRAMMAR_HH #define GRAMMAR_HH #include #include #include #include using namespace std; class Grammar; class Rule; class Disjunction; class Conjunction; class Broker; class Parameter; class Intermediate; /* different parameter types */ #define T_NUMERAL 1 #define T_NONTERM 2 #define T_STRING 3 #define T_REGEXP 4 #define T_SUBST 5 #define T_TRANS 6 /****************/ class Description { friend class Grammar; friend class Intermediate; Grammar * grammar; list * modifiers; string textinfo[3]; int nonterminal; public: Description(Grammar *, string *, list *, string **); ~Description(); }; /***************/ class Parameter { friend class Grammar; friend class Intermediate; friend class Rule; Grammar * grammar; int type; int value; string data; string data2; public: Parameter(Grammar *); void set_numeral(int); void set_string(string *); void set_nonterminal(string *); void set_regexp(string *); void set_substitution(string **); void set_transliteration(string **); }; /***********/ class Broker { /* Broker of string<->int transformations */ vector nonterminal_table; vector terminal_table; public: Broker(); ~Broker(); int get_nonterminal(string *); /* returns the number of a nonterminal */ int get_terminal(string *); /* returns the number of a terminal */ string get_string(int); /* returns the name of a nonterminal or the value of a terminal */ int get_nt_num() { return nonterminal_table.size(); } }; /****************/ class Conjunction { friend class Grammar; friend class Intermediate; friend class Rule; Grammar * grammar; list symbols; bool is_default; public: Conjunction(Grammar *); ~Conjunction(); void add_nonterminal(string *); void add_terminal(string *); void set_default(); bool get_default() { return is_default; } void add_special(string *, list *, Parameter *); string evaluate(bool); }; /****************/ class Disjunction { friend class Grammar; friend class Rule; friend class Intermediate; Grammar * grammar; list conjunctions; int default_num; public: Disjunction(Grammar * gr=NULL); ~Disjunction(); int get_default_num(); void add_conjunction(Conjunction *); }; /*********/ class Rule { friend class Grammar; friend class Intermediate; Grammar * grammar; int left; /* left hand side nonterminal */ Disjunction * disjunction; /* the right hand side */ int type; /* special(>0) or normal(0) */ string special_type; list * parameters; /* parameter list */ Parameter * initvalue; list * modifiers; int mods; /* modifier bits */ /* textual information for the rule */ string textinfo[3]; /* transformations for the rule */ list * transformations; Intermediate * my_intermediate; public: Rule(Grammar *); ~Rule(); void set_left(string *); void set_disjunction(Disjunction *); void set_special(string *, list *, Parameter *); void add_modifiers(list *); void set_textinfo(string ** ti); void set_transformations(list *); int get_left() { return left; } Intermediate * get_intermediate() { return my_intermediate; } int get_default_selection(); int get_current_selection(); void verify_rule(); string evaluate(bool); void send(string message, bool prefix_sender=true); void recieve(char, string); }; /************/ class Grammar { friend class Intermediate; list rules; multimap constraints; list descriptions; Rule * start_rule; public: Grammar(); ~Grammar(); Broker broker; bool was_default_widget_done; // global variable for a Kaptain tree void add_rule(Rule *); void add_description(string *, list *, string **); void add_constraint(string *, string *); Rule * get_rule(int); Rule * get_start_rule() { return start_rule; } void verify(); void verify_start_rule(); void verify_recursion(); void verify_reachability(); void verify_terminateability(); void verify_descriptions(); void unify(); void unify_rules(); void unify_descriptions(); string evaluate_nonterminal(int, bool); int get_constraint_for(int); void send(string); void recieve(string); }; #endif // GRAMMAR_HH kaptain-0.73/README0000640023433300116100000000316211532667773012500 0ustar zsoltengKaptain - Universal Graphical Front-end --------------------------------------- Universal Graphical Front-end for command-line programs. (c) 2000-2004, 2011 Zsolt Terek All bug reports and suggestions are welcome. If you have made a grammar that can be useful for others, prease send it to me. To compile and install, run qmake kaptain.pro make make install What's new in Kaptain 0.73 -------------------------- Maintenance release; ported to compile with Qt4, rewritten to use qmake. What's new in Kaptain 0.72 -------------------------- Bug fixes and minor changes for Qt 3.3 and gcc-3.3 compatibility. Run configure as shown below to specify the qt directory explicitly. The script will search for `bin', `include' and `lib' subdirs below. ./configure --with-qt-dir=/my/qt/dir What's new in Kaptain 0.71 -------------------------- Bug fixes and minor changes for Qt 3 and gcc-3.2 compatibility. Run configure as shown below to specify qt include directory explicitly. ./configure --with-qt-dir=/usr/share/qt3 UPGRADING FROM Kaptain 0.6 -------------------------- Since Kaptain 0.7 was completely rewritten, the syntax of grammars has changed. To make your scripts work with Kaptain 0.7, check the followings: - All statements should end with a semicolon (;). This was only needed for rules in Kaptain 0.6, but now it is neccesary for descriptions and constraints, too. - String constants and regular expressions should be closed on the line they are opened. To write multi-line strings, the only way is to use the < #include #include #include #include "kaptain.h" #include extern char * special_names[]; extern char * modifier_names[]; extern int two_power[]; extern int extra_modifier_num; extern int glob_parse_result; extern list * glob_param_list; extern Parameter * glob_init_value; extern int glob_parse_result; extern void lexer_scan_string(const char *); extern int parserparse(); Intermediate::Intermediate(Intermediate * f) { type=0; father=f; my_rule=0; my_kaptain=0; child_num=0; grammar=0; modifiers=0; } Intermediate::~Intermediate() { list::iterator ip; for (ip=children.begin(); ip!=children.end(); ip++) if (*ip) delete *ip; } bool Intermediate::is(int i) { bool result=(modifiers & i); //cout << "IS " << modifiers << " & " << i << " = " << result << endl; return result; //return modifiers & i; } bool Intermediate::create_from(Grammar * gr, Rule * r) { grammar=gr; my_rule=r; if (my_rule==0) return false; if (my_rule->my_intermediate) return false; my_rule->my_intermediate=this; if (my_rule->type > 0) { /* special symbol */ type=SPEC; spec_type=my_rule->type; } else { assert(my_rule->disjunction!=0); /* a rule of a nonterminal */ if (my_rule->disjunction->conjunctions.size()>1) { type=DISJ; list::iterator ci; for (ci=my_rule->disjunction->conjunctions.begin(); ci!=my_rule->disjunction->conjunctions.end(); ci++) if (*ci) { Intermediate * child=new Intermediate(this); child->type=CONJ; child->grammar=grammar; child->create_from_conjunction(*ci); children.push_back(child); } child_num=children.size(); } else if (my_rule->disjunction->conjunctions.size()==1) { type=CONJ; Conjunction * only_child; only_child=*(my_rule->disjunction->conjunctions.begin()); create_from_conjunction(only_child); } else type=INVALID; } textinfo[0]=my_rule->textinfo[0]; textinfo[1]=my_rule->textinfo[1]; textinfo[2]=my_rule->textinfo[2]; modifiers=my_rule->mods; if (type==INVALID) cerr << "INVALID Intermediate Object." << endl; return true; } void Intermediate::create_from_conjunction(Conjunction * c) { //c->is_default; list::iterator ii; for (ii=c->symbols.begin(); ii!=c->symbols.end(); ii++) if (*ii<0) /* only nonteminals */ { Rule * child_rule=grammar->get_rule(*ii); if (child_rule) { Intermediate * child=new Intermediate(this); /* throw INVALID children */ if (child->create_from(grammar, child_rule)) children.push_back(child); else delete child; } } child_num=children.size(); } void Intermediate::print(int tab) { for (int i=0; iget_left()!=0) cout << grammar->broker.get_string(my_rule->get_left()) << " "; else if (my_rule) cout << "0 "; else cout << "NULL "; cout << children.size() << " "; if (! textinfo[0].empty()) cout << textinfo[0] << " " << modifiers << " "; for (int i=0; i::iterator ii; for (ii=children.begin(); ii!=children.end(); ii++) if (*ii) (*ii)->print(tab+1); } bool Intermediate::empty() { if (type==SPEC || type==DISJ) return false; if (children.size()==0) return textinfo[0].empty(); list::iterator ii; for (ii=children.begin(); ii!=children.end(); ii++) if (*ii && !((*ii)->empty())) return false; /* has a nonempty child */ /* all children are empty */ return true; } /* get intermediate for a given rule */ Intermediate * Intermediate::get_intermediate(int nt) { Rule * r=grammar->get_rule(nt); return r ? r->get_intermediate() : 0; } string Intermediate::evaluate_nonterminal(int nt, bool consider_noeval) { return grammar->evaluate_nonterminal(nt, consider_noeval); } string Intermediate::get_name() { string s; if (my_rule && my_rule->get_left()!=0) s=grammar->broker.get_string(my_rule->get_left()); return s; } bool Intermediate::is_default_widget() { if (grammar->was_default_widget_done) return false; grammar->was_default_widget_done=true; return true; } int Intermediate::get_default_selection() { int sel=0; if (my_rule && type==DISJ) sel=my_rule->get_default_selection(); return sel; } string Intermediate::evaluate_special() { string s; if (my_kaptain) s=my_kaptain->evaluate_special(); return s; } int Intermediate::get_selected_child() { list::iterator child; int selected=0; if (is(is_radioparent)) { for (child=children.begin(); child!=children.end(); child++) { if ((*child)->my_kaptain && (*child)->my_kaptain->radio_is_selected()) break; selected++; } if (child==children.end()) selected=0; } else if (is(is_stack) && my_kaptain) { selected=my_kaptain->get_selected_page(); } return selected; } int Intermediate::get_selected_checkbox() { int i=0; if (is(is_checkbox) && my_kaptain) i=my_kaptain->get_check_selected(); return i; } int Intermediate::get_current_selection() { return is(is_radioparent) || is(is_stack) ? get_selected_child() : get_selected_checkbox(); } /* handling parameters */ /* No 0 : initial value */ /* No 1,2,... : parameters specified in parentheses */ /* If `glob_parse_result' is 1, `glob_param_list' and `glob_init_value' are regarded */ Parameter * Intermediate::get_parameter(int n) { Parameter * par=0, * _initvalue=0; list * _parameters=0; if (glob_parse_result==0 && my_rule) { _initvalue=my_rule->initvalue; _parameters=my_rule->parameters; } else if (glob_parse_result==1) { _initvalue=glob_init_value; _parameters=glob_param_list; } if (is_special() && my_rule && n>=0) { if (n==0) par=_initvalue; else if (_parameters) { int i=0; list::iterator pp=_parameters->begin(); while (pp!=_parameters->end()) { i++; if (i==n) { par=*pp; break; } pp++; } } } return par; } int Intermediate::get_parameter_num() { int result=0; if (is_special()) if (glob_parse_result==0 && my_rule && my_rule->parameters) result=my_rule->parameters->size(); else if (glob_parse_result==1 && glob_param_list) result=glob_param_list->size(); return result; } bool Intermediate::parameter_type(int n, int ptype) { Parameter * par=get_parameter(n); return (par && par->type==ptype); } int Intermediate::get_int_parameter(int n) { Parameter * par=get_parameter(n); int result = (par && par->type==T_NUMERAL || par->type==T_NONTERM) ? par->value : -1; return result; } string Intermediate::get_string_parameter(int n) { Parameter * par=get_parameter(n); string s = (par && (par->type==T_STRING || par->type==T_REGEXP)) ? par->data : string() ; int size = s.size(); if (size>1 && s[size-1]=='\n') s.erase(size-1); return s; } void Intermediate::get_subst_parameter(int n, string & pattern, string & replacement, bool & global_flag) { Parameter * par=get_parameter(n); if (par) { pattern=par->data; replacement=par->data2; global_flag=par->value==1; } } void Intermediate::transduce() { transduce_1(); transduce_2(); } void Intermediate::transduce_1() { /* BOTTOM-UP */ bool xis_framed=false; list::iterator ii; for (ii=children.begin(); ii!=children.end(); ii++) if (*ii) { (*ii)->transduce_1(); /* upspread SPEC rule if (children.size()==1 && (*ii)->is_special()) { type=(*ii)->type; spec_type=(*ii)->spec_type; delete *ii; *ii=0; break; inkabb a nagyapatol kellene - } */ /* FIXME !!!!!!!!!!!! */ /* get selection information before killing! */ /* 1) transfer framing data to children */ if (is(is_framed)) { xis_framed=true; (*ii)->modifiers|=2; // framed; } if ((*ii)->children.size()==1 && (*ii)->my_rule==0) { Intermediate * zombie=*ii; *ii=*(zombie->children.begin()); (*ii)->father=zombie->father; zombie->children.clear(); delete zombie; } else if ((*ii)->children.size()==0 && (*ii)->my_rule==0) { Intermediate * zombie=*ii; *ii=0; delete zombie; } } if (xis_framed) modifiers^=2; // framed children.remove(NULL); } void Intermediate::transduce_2() { /* TOP-DOWN */ /* remove :stack if not in disjunction */ if (is(is_stack) && (!is_disjunction() || is(is_tree))) modifiers^=is_stack; if (is_disjunction() && !is(is_stack) && children.size()<=1) if (child_num<3) modifiers|=is_checkbox; // checkbox else modifiers|=is_checkbox | is_tristate; list::iterator ii; bool has_spec_child=false; for (ii=children.begin(); ii!=children.end(); ii++) if (*ii) { if ((*ii)->is_special()) has_spec_child=true; } /* remove :tree from direct specials */ if (is(is_tree) && has_spec_child) modifiers^=is_tree; int empty_child=0; for (ii=children.begin(); ii!=children.end(); ii++) if (*ii) { if ((*ii)->empty()) empty_child++; if ((*ii)->is_special()) has_spec_child=true; /* `@integer' and `:beside' special case */ if (children.size()==1 && (*ii)->is_special() && (*ii)->spec_type==1) // @integer (*ii)->modifiers|=(is(is_beside) ? is_right_aligned : is_left_aligned); /* get label for a frame */ if (is(is_framed) && children.size()==1 && textinfo[0].empty()) { textinfo[0]=(*ii)->textinfo[0]; (*ii)->textinfo[0]=string(); } /* spread :detailed in a tree */ if (is(is_tree) && is(is_detailed)) (*ii)->modifiers|=is_detailed; // spread 'is_detailed' /* radio & checkbox work */ if (is_disjunction()) { if (is(is_stack)) modifiers|=is_stack; else if (children.size()>1 /*|| child_num>3 */) { modifiers|=is_radioparent; (*ii)->modifiers|=is_radio; // radio } else if (children.size()==1) { modifiers|=is_checkbox; // checkbox if (textinfo[0].empty()) { textinfo[0]=(*children.begin())->textinfo[0]; (*children.begin())->textinfo[0]=string(); } } } (*ii)->transduce_2(); } /* if (children.size()==3 && is(is_radioparent) && (empty_child==2 && !(children.front()->empty()) || empty_child==3)) { modifiers|=is_tristate; modifiers^=is_radioparent; list::iterator ii; for (ii=children.begin(); ii!=children.end(); ii++) if (*ii) { (*ii)->modifiers^=is_radio; } } */ } void Intermediate::send(string message, char separ) { if (is_special() && father) /* send throuh SPEC's father */ father->send(message); else if (my_rule) if (separ!=0) /* send directly */ my_rule->send(separ+message); else my_rule->send(message, false); } void Intermediate::recieve(string message) { if (children.size()==1 && children.front()->is_special()) /* process at the SPEC child */ children.front()->recieve(message); else { /* process here */ if (is_special()) { lexer_scan_string(message.c_str()); glob_parse_result=-1; glob_param_list=0; glob_init_value=0; if (parserparse()==0 && glob_parse_result==1 && my_kaptain) { /* save old parameters, initvalue */ /* reset the widget */ my_kaptain->create_special(); /* restore old parameters, initvalue if the new ones are 0 */ my_rule->set_special(0, glob_param_list, glob_init_value); glob_parse_result=0; glob_init_value=0; glob_param_list=0; // get_parameter now works again // on my_rule's params } /* garbage collection */ if (glob_init_value) delete glob_init_value; if (glob_param_list) { list::iterator pi; for (pi=glob_param_list->begin(); pi!=glob_param_list->end(); pi++) if (*pi) delete (*pi); delete glob_param_list; } } else /* not special */ if (type==DISJ && message[0]=='=') if (message[1]!='\r' && message[1]!='\n') { int res=0; if (sscanf(message.c_str()+1,"%d",&res)==1) { my_kaptain->select_it(res); } } else { int res=0; ostringstream reply; res=get_current_selection(); reply << res; send(reply.str(),'='); } } } kaptain-0.73/intermediate.h0000640023433300116100000000413311162144266014424 0ustar zsolteng#ifndef INTERMEDIATE__HH #define INTERMEDIATE__HH #include #include using namespace std; class Grammar; class Rule; class Conjunction; class Parameter; class Kaptain; #define INVALID 0 #define DISJ 1 #define CONJ 2 #define SPEC 3 #define is_tabbed 1 #define is_framed 2 #define is_horizontal 4 #define is_wizard 8 #define is_subdialog 16 #define is_reverse 32 #define is_noeval 64 #define is_double 128 #define is_beside 256 #define is_tree 512 #define is_detailed 1024 #define is_stack 2048 #define is_checkbox 4096 #define is_tristate 8192 #define is_radioparent 16384 #define is_left_aligned 32768 #define is_right_aligned 65536 #define is_radio 131072 class Intermediate { friend class Kaptain; friend class Rule; list children; Intermediate * father; int type; int child_num; // before deleting some... Rule * my_rule; Kaptain * my_kaptain; Grammar * grammar; string textinfo[3]; int spec_type; int modifiers; public: Intermediate(Intermediate *); ~Intermediate(); bool is_disjunction() { return type==DISJ; } bool is_conjunction() { return type==CONJ; } bool is_special() { return type==SPEC; } bool is(int i); bool empty(); /* interface to grammar */ Intermediate * get_intermediate(int); string evaluate_nonterminal(int, bool); string get_name(); bool is_default_widget(); int get_default_selection(); /* interface to kaptain */ int get_selected_child(); int get_selected_checkbox(); int get_current_selection(); string evaluate_special(); /* parameters and initvalue */ Parameter * get_parameter(int); int get_parameter_num(); bool parameter_type(int, int); int get_int_parameter(int); string get_string_parameter(int); void get_subst_parameter(int, string &, string &, bool &); bool create_from(Grammar *, Rule *); void create_from_conjunction(Conjunction *); void transduce(); void transduce_1(); void transduce_2(); void print(int); void recieve(string); void send(string message, char separ=':'); }; #endif // INTERMEDIATE__HH kaptain-0.73/kaptain.cpp0000640023433300116100000014561311531162201013732 0ustar zsolteng#include "tools.h" #include "process.h" #include "kaptain.h" #include "intermediate.h" #include "grammar.h" #include #include #include #include #include #include #include #include #include //Added by qt3to4: #include #include #include #include #include #include #include #include #include #include #include #define BORDER 10 #define SPACING 5 extern bool global_test; extern Grammar * yygrammar; /* ---------------------------------------------------------------------- */ QRegValidator::QRegValidator(QString s, QWidget *parent, const char *name ) : QValidator(parent,name) { compiled_pattern=new regex_t; valid=!regcomp(compiled_pattern, s, REG_EXTENDED); if (!valid) cerr << "Ignoring invalid regular expression:" << (const char*)s << endl; } QRegValidator::~QRegValidator() { delete compiled_pattern; } QValidator::State QRegValidator::validate(QString & s, int &) const { regmatch_t regs[10]; QValidator::State state=QValidator::Invalid; const char * str=s; if (valid && str && regexec(compiled_pattern, str, 10, regs, 0)==0) state=QValidator::Acceptable; return state; } /* ---------------------------------------------------------------------- */ QPixmap & get_pixmap(QString file_name) { QPixmap * pm=new QPixmap(file_name); return *pm; } void image_text(string s, string & image, string & text) { list result; image=string(); // clear text=string(); if (Regexp::matches("^\\{(.*)\\}(.*)$",s, result) && result.size()==2) { image=result.front(); text=result.back(); } else text=s; } /* make button label or image */ void button_label(QPushButton * push_button, string s) { string image, text; image_text(s, image, text); if (image.empty()) push_button->setText(text.c_str()); else push_button->setPixmap(get_pixmap(image.c_str())); } /* ---------------------------------------------------------------------- */ Kaptain::Kaptain(Intermediate * i, Kaptain * p, QWidget * widget, Q3BoxLayout * layout, QDialog * dialog, bool _no_title, const char *) { im=i; assert(im!=0); im->my_kaptain=this; parent=p; /* parent_widget is always needed */ parent_widget=widget; parent_dialog=dialog; parent_layout=layout; if (!parent_widget) { if (im->is(is_wizard) && parent==0) { /* only top level wizard */ wizard=new Q3Wizard(dialog, im->get_name().c_str(), true); parent_dialog=wizard; parent_widget=parent_dialog; } else { parent_dialog=new QDialog(dialog, im->get_name().c_str(), true); parent_widget=parent_dialog; parent_layout=new Q3VBoxLayout(parent_widget, BORDER, SPACING); } kill_dialog=true; } else kill_dialog=false; myself=0; radio_button=0; checkbox=0; spin_box=0; line_edit=0; tab_widget=0; list_box=0; combo_box=0; push_button=0; list_view=0; list_view_item=0; widget_stack=0; my_panel=0; mapping=0; stack_size=0; container_source=0; edit=0; child_dialog=0; alignment=0; grid=0; grid_rows=1; grid_columns=1; no_title=_no_title; done_title=false; title=im->textinfo[0].c_str(); tooltip=im->textinfo[1].c_str(); whatsthis=im->textinfo[2].c_str(); no_tree=false; // forbids tree creation if true ignore_radio=false; children.setAutoDelete(true); create(); set_info(myself); } Kaptain::~Kaptain() { /* if (kill_dialog && parent_dialog) delete parent_dialog; */ if (mapping) delete mapping; } void Kaptain::create() { if (im->type==INVALID) return; if (im->is(is_wizard) && parent==0) { // only toplevel node can be wizard create_wizard(); } else if (parent && parent->im->is(is_tree) && !no_tree) { /*-- inside a tree --*/ create_tree_item(); } else { /*-- out of a tree --*/ no_title=no_title || im->is(is_subdialog); /** create frame **/ if (im->is(is_framed)) create_frame(); /** create title **/ create_title(); // also creates sublayout /** create object(s) **/ if (im->is_special()) { /* a special object */ create_minimum_layout(); create_special(); /* using proper alignment */ if (im->is(is_left_aligned)) alignment=Qt::AlignLeft; if (im->is(is_right_aligned)) alignment=Qt::AlignRight; /* inserted into a layout */ if (myself) parent_layout->addWidget(myself, 0, alignment); /* give keyboard focus to the first SPEC widget */ if (myself && im->is_default_widget()) myself->setFocus(); } else { /* children sequence */ if (im->is(is_tabbed)) { /* tab widget */ create_minimum_layout(); create_tabbed(); } else if (im->is(is_tree)) { /* tree view */ create_minimum_layout(); create_tree_view(); } else if (im->is(is_subdialog)) { /* subdialog */ create_minimum_layout(); create_subdialog(); } else if (im->is(is_stack)) { /* stack */ create_minimum_layout(); create_stack(); } else { /* box layout */ if (im->is(is_double)) create_grid_layout(); create_sequence(); } } } } void Kaptain::create_frame() { if (!parent_layout) { parent_layout=new Q3VBoxLayout(parent_widget, SPACING); } Q3GroupBox * frame=new Q3GroupBox(title, parent_widget); done_title=true; parent_widget=frame; parent_layout->addWidget(parent_widget); int frame_size = 2*frame->lineWidth() + frame->midLineWidth() + frame->margin(); parent_layout=new Q3VBoxLayout(frame, frame_size+5, SPACING); parent_layout->addSpacing(frame->fontMetrics().height()-frame_size); set_info(frame); } void Kaptain::create_title() { /* dialog title */ if (kill_dialog) // I'm dialog owner { parent_dialog->setCaption(title); // what about icons ??? done_title=true; } if (!((no_title || done_title))) //&& !im->is(is_radio) && !im->is(is_checkbox)) { /* need a layout for the title */ Q3BoxLayout::Direction need_dir=Q3BoxLayout::TopToBottom; if (im->is(is_beside)) need_dir=Q3BoxLayout::LeftToRight; if (!(parent_layout && parent_layout->direction()==need_dir)) { if (parent_layout) parent_layout=new Q3BoxLayout(parent_layout, need_dir, SPACING); else parent_layout=new Q3BoxLayout(parent_widget, need_dir, BORDER, SPACING); } if (im->is(is_radio) && !ignore_radio) { /* place a radio button */ radio_button=new QRadioButton(title, parent_widget); parent_layout->addWidget(radio_button); connect(radio_button, SIGNAL(clicked()), SLOT(radio_clicked())); done_title=true; set_info(radio_button); } if (im->is(is_checkbox)) { if (im->is(is_radio) && !ignore_radio) // both radio and checkbox { /* radio was done above. insert indentation */ Q3HBoxLayout * indent=new Q3HBoxLayout(parent_layout); indent->addSpacing(parent_widget->fontMetrics().height() +SPACING); Q3VBoxLayout * indent2=new Q3VBoxLayout(indent); parent_layout=indent2; /* FIXME shouldn't the title differ? */ } /* create checkbox */ checkbox=new QCheckBox(title, parent_widget); if (im->is(is_tristate)) checkbox->setTristate(); parent_layout->addWidget(checkbox); connect(checkbox, SIGNAL(stateChanged(int)), SLOT(message_checkbox(int))); done_title=true; set_info(checkbox); } if (!no_title && !done_title && !title.isEmpty()) { /* if all else fails, a simple label */ QLabel * label=new QLabel(title, parent_widget); parent_layout->addWidget(label); set_info(label); } done_title=true; /* put content a bit indented to the radio or checkbox */ if ( ( im->is(is_radio) || im->is(is_checkbox) ) && need_dir==Q3BoxLayout::TopToBottom && !(im->empty())) { Q3HBoxLayout * indent=new Q3HBoxLayout(parent_layout); indent->addSpacing(parent_widget->fontMetrics().height()+SPACING); parent_layout=indent; } } // create sublayout suitable for children create_sublayout(); } void Kaptain::create_minimum_layout() { if (parent_layout==0) parent_layout=new Q3VBoxLayout(parent_widget, BORDER, SPACING); } void Kaptain::create_sublayout() { Q3BoxLayout::Direction dir; /* calculate layout direction needed */ if (im->is(is_double)) dir=Q3BoxLayout::TopToBottom; // no matter what direction else if (im->is(is_horizontal) || im->is(is_beside)) if (im->is(is_reverse)) dir=Q3BoxLayout::RightToLeft; else dir=Q3BoxLayout::LeftToRight; else if (im->is(is_reverse)) dir=Q3BoxLayout::BottomToTop; else dir=Q3BoxLayout::TopToBottom; /* create if parent_layout is different */ if (!(parent_layout && (parent_layout->direction()==dir || im->is(is_double)))) { if (parent_layout) parent_layout=new Q3BoxLayout(parent_layout, dir, SPACING); else parent_layout=new Q3BoxLayout(parent_widget, dir, BORDER, SPACING); } /* grid layout is created just before create_sequence() is called */ } void Kaptain::create_grid_layout() { /* double columns or rows */ grid_rows=(im->children.size()+1)/2; grid_columns=2; if (im->is(is_horizontal)) { int t=grid_rows; grid_rows=grid_columns; grid_columns=t; } grid=new Q3GridLayout(parent_layout, grid_rows, grid_columns, SPACING); //parent_layout->setStretchFactor(grid, 1); /*for (int i=0; isetRowStretch(i,1); for (int i=0; isetColStretch(i,1);*/ } void Kaptain::create_sequence() { create_sublayout(); int child_index=0, child_num=im->children.size(); list::iterator ii; for (ii=im->children.begin(); ii!=im->children.end(); ii++) if (*ii) { /* render new layout if needed */ Q3BoxLayout * new_layout=parent_layout; if (im->is(is_double)) { int x,y, pos=child_index; if (im->is(is_reverse)) pos=child_num-1-pos; x=pos / 2; y=pos % 2; if (im->is(is_horizontal)) {int t=x;x=y;y=t;} new_layout=new Q3VBoxLayout(SPACING); grid->addLayout(new_layout, x, y); } Kaptain * child=new Kaptain(*ii, this, parent_widget, new_layout, parent_dialog); children.append(child); child_index++; } select_defaults(); } void Kaptain::select_defaults() { /* default selection */ if (im->type==DISJ) { int sel=im->get_default_selection(); select_it(sel); } } void Kaptain::select_it(int sel) { int item=0; Kaptain * child; if (im->is(is_radioparent)) { for (child=children.first(); child; child=children.next()) { if (item==sel) break; item++; } if (!child) child=children.first(); child->radio_select(true); } else if (im->is(is_checkbox)) if (checkbox) if (im->is(is_tristate)) switch (sel) { case 0: checkbox->setChecked(true); break; case 1: checkbox->setNoChange(); break; case 2: checkbox->setChecked(false); break; default: break; } else checkbox->setChecked(!sel); else { if (list_view_item) ((Q3CheckListItem *)list_view_item)->setOn(!sel); } else if (im->is(is_stack)) { select_page(sel); } } void Kaptain::create_tabbed() { tab_widget=new QTabWidget(parent_widget); parent_layout->addWidget(tab_widget); list::iterator ii; for (ii=im->children.begin(); ii!=im->children.end(); ii++) if (*ii) { QWidget * new_widget=new QWidget(tab_widget); tab_widget->addTab(new_widget, QString((*ii)->textinfo[0].c_str())); Kaptain * child=new Kaptain(*ii, this, new_widget, 0, parent_dialog, true); children.append(child); } } void Kaptain::create_stack() { widget_stack=new Q3WidgetStack(parent_widget); parent_layout->addWidget(widget_stack); int i=0; list::iterator ii; for (ii=im->children.begin(); ii!=im->children.end(); ii++) if (*ii) { QWidget * new_widget=new QWidget(widget_stack); widget_stack->addWidget(new_widget, i); Kaptain * child=new Kaptain(*ii, this, new_widget, 0, parent_dialog, true); children.append(child); i++; } select_defaults(); } void Kaptain::select_page(int p) { if (widget_stack && mapping==0) widget_stack->raiseWidget(p); } int Kaptain::get_selected_page() { int selected=0; if (widget_stack) { selected=widget_stack->id(widget_stack->visibleWidget()); if (selected==-1) selected=0; } return selected; } Kaptain * Kaptain::get_tree_top() { /* find topmost tree element */ Kaptain * ancestor=this; while (ancestor && ancestor->widget_stack==0) ancestor=ancestor->parent; return ancestor; } void Kaptain::create_tree_view() { list_view=new Q3ListView(parent_widget); mapping=new Q3PtrDict; parent_layout->addWidget(list_view); /* list view setup */ list_view->setSorting(-1); list_view->setRootIsDecorated(true); list_view->addColumn(QString()); if (im->is(is_detailed)) list_view->addColumn(QString()); // two columns else list_view->header()->hide(); // no header /* create widget stack */ widget_stack=new Q3WidgetStack(parent_widget); list::reverse_iterator ii; /* simply insert child nodes */ for (ii=im->children.rbegin(); ii!=im->children.rend(); ii++) if (*ii) { Kaptain * child=new Kaptain(*ii, this, parent_widget, parent_layout, parent_dialog); children.append(child); } select_defaults(); if (stack_size) /* panel should be created */ { /* insert empty panel with 0 id */ widget_stack->addWidget(new QWidget(widget_stack),0); parent_layout->addWidget(widget_stack); connect(list_view, SIGNAL(currentChanged(Q3ListViewItem *)), SLOT(panel_selected(Q3ListViewItem *))); } else delete widget_stack; list_view->adjustSize(); } void Kaptain::create_tree_item() { // take image and label // string img, txt, tit; tit=title.latin1(); image_text(tit,img,txt); title=QString(txt.c_str()); if (parent && parent->list_view_item) { if (im->is(is_radioparent)) list_view_item=new Q3CheckListItem(parent->list_view_item, title, Q3CheckListItem::Controller); else if (im->is(is_radio)) { list_view_item=new Q3CheckListItem((Q3CheckListItem *) parent->list_view_item, title, Q3CheckListItem::RadioButton); } else if (im->is(is_checkbox)) { list_view_item=new Q3CheckListItem(parent->list_view_item, title, Q3CheckListItem::CheckBox); } else list_view_item=new Q3ListViewItem(parent->list_view_item, title); } else if (parent && parent->list_view) { if (im->is(is_radioparent)) list_view_item=new Q3CheckListItem(parent->list_view, title, Q3CheckListItem::Controller); else if (im->is(is_radio)) { parent->list_view_item= new Q3CheckListItem(parent->list_view, parent->title, Q3CheckListItem::Controller); list_view_item=new Q3CheckListItem((Q3CheckListItem *) parent->list_view_item, title, Q3CheckListItem::RadioButton); } else if (im->is(is_checkbox)) { list_view_item=new Q3CheckListItem(parent->list_view, title, Q3CheckListItem::CheckBox); } else list_view_item=new Q3ListViewItem(parent->list_view, title); } if (im->is(is_detailed)) list_view_item->setText(1,tooltip); if (!img.empty()) list_view_item->setPixmap(0, get_pixmap(img.c_str())); no_tree=!(im->is(is_tree)) || im->is_special() || im->is(is_radio) || im->is(is_checkbox); /* only insert children into widget stack, not this node */ ignore_radio= im->is(is_radio) && im->is(is_checkbox); no_title= im->is(is_radio) != im->is(is_checkbox); if (no_tree) { /* create this node again on the widget_stack */ Kaptain * top=get_tree_top(); parent_widget=new QWidget(top->widget_stack); my_panel=parent_widget; parent_layout=0; top->widget_stack->addWidget(parent_widget,top->stack_size); /* to raise the widget when the tree item is selected the mapping list_view_item->Kaptain is needed */ top->mapping->insert((void *)list_view_item, this); /* call create again with no_tree set */ if (im->children.size()>0 || ignore_radio) { create(); top->stack_size++; } } else { list::reverse_iterator ii; /* insert child nodes */ for (ii=im->children.rbegin(); ii!=im->children.rend(); ii++) if (*ii) { Kaptain * child=new Kaptain(*ii, this, parent_widget, parent_layout, parent_dialog); children.append(child); } } select_defaults(); } void Kaptain::panel_selected(Q3ListViewItem * item) { Kaptain * owner=mapping->find((void *)item); if (owner) widget_stack->raiseWidget(owner->my_panel); else widget_stack->raiseWidget(0); } void Kaptain::create_subdialog() { QString label; push_button=new QPushButton(parent_widget); parent_layout->addWidget(push_button); button_label(push_button, title.latin1()); push_button->setFixedSize(push_button->sizeHint()); connect(push_button, SIGNAL(clicked()), SLOT(subdialog_clicked())); if (im->children.size()>1) { child_dialog=new QDialog(parent_dialog, im->get_name().c_str(), true); Q3BoxLayout * child_layout=new Q3VBoxLayout(child_dialog, BORDER, SPACING); child_dialog->setCaption(title); list::iterator ii; for (ii=im->children.begin(); ii!=im->children.end(); ii++) if (*ii) { Kaptain * child=new Kaptain(*ii, this, child_dialog, child_layout, child_dialog); children.append(child); } } else if (im->children.size()==1) { Kaptain * child=new Kaptain(im->children.front(), this, 0, 0, 0); children.append(child); child_dialog=child->main_dialog(); } } void Kaptain::create_wizard() { list::iterator ii; for (ii=im->children.begin(); ii!=im->children.end(); ii++) if (*ii) { QWidget * new_widget=new QWidget(wizard); wizard->addPage(new_widget, QString((*ii)->textinfo[0].c_str())); wizard->setCaption(title); wizard->setHelpEnabled(new_widget, false); Kaptain * child=new Kaptain(*ii, this, new_widget, 0, wizard, true); children.append(child); } } void Kaptain::create_special() { int spec=im->spec_type; bool again=false; /* creates a widget and sets myself to point to it */ switch (spec) { case 1: // @integer again=spin_box; if (!again) { spin_box=new QSpinBox(parent_widget); myself=spin_box; spin_box->setFixedSize(spin_box->sizeHint()); } { /* initial setup */ int min=0, max=99, init=0; if (im->parameter_type(0,T_NUMERAL)) init=im->get_int_parameter(0); if (im->parameter_type(1,T_NUMERAL)) min=im->get_int_parameter(1); if (im->parameter_type(2,T_NUMERAL)) max=im->get_int_parameter(2); if (maxmax) init=max; spin_box->setRange(min,max); spin_box->setValue(init); } break; case 2: // @string --> @float, @regex, @password again=line_edit; if (!again) { line_edit=new QLineEdit(parent_widget); myself=line_edit; } /* initial value */ if (im->parameter_type(0,T_STRING)) line_edit->setText(QString(im->get_string_parameter(0).c_str())); /* maximum length */ if (im->parameter_type(1,T_NUMERAL)) line_edit->setMaxLength(im->get_int_parameter(1)); break; case 3: // @list --> @combo, @comborw { again=list_box; if (!again) { list_box=new Q3ListBox(parent_widget); connect(list_box, SIGNAL(highlighted(const QString &)), SLOT(message_listbox(const QString &))); myself=list_box; } else { if (im->get_parameter_num()>0) list_box->clear(); } bool has_string_regexp_init=false, regexp=false; bool s_global_flag=false, has_substitution=false; string s_pattern, s_replacement, pattern; list result; if (im->parameter_type(0,T_STRING) || im->parameter_type(0,T_REGEXP)) { has_string_regexp_init=true; regexp=im->parameter_type(0,T_REGEXP); pattern=im->get_string_parameter(0); } int items_inserted=0; /* process parameters and initvalue */ int pn=im->get_parameter_num(); for (int i=1; i<=pn; i++) { if (im->parameter_type(i,T_SUBST)) { /* update substitution */ has_substitution=true; im->get_subst_parameter(i, s_pattern, s_replacement, s_global_flag); } if (im->parameter_type(i,T_STRING)) { list lines; Regexp::split('\n', im->get_string_parameter(i), lines); list::iterator it; for (it=lines.begin(); it!=lines.end(); it++) { string original_line=(*it), modified_line=original_line; /* execute substitution */ if (has_substitution) Regexp::substitute(s_pattern, original_line, s_replacement, modified_line, s_global_flag); list_box->insertItem(modified_line.c_str()); if (has_string_regexp_init) { /* select the line - equal to a string - matching a regexp */ if ((!regexp && pattern==(*it)) || (regexp && Regexp::matches (pattern, original_line, result))) { has_string_regexp_init=false; // select first choice list_box->setCurrentItem(items_inserted); } } items_inserted++; } } } /* integer initvalue */ if (im->parameter_type(0,T_NUMERAL)) list_box->setCurrentItem(im->get_int_parameter(0)-1); } break; case 4: // @float --> @string, @regex, @password again=line_edit; if (!again) { line_edit=new QLineEdit(parent_widget); myself=line_edit; line_edit->setValidator(new QDoubleValidator(parent_widget)); } /* initial value */ if (im->parameter_type(0,T_STRING)) line_edit->setText(QString(im->get_string_parameter(0).c_str())); if (im->parameter_type(0,T_NUMERAL)) line_edit->setText(QString::number(im->get_int_parameter(0))); break; case 5: // @button case 12: // @close case 13: // @action case 16: // @exec case 17: // @echo case 20: // @execclose case 21: // @execbuffer case 22: // @dump case 23: // @preview case 26: // @fork again=push_button; if (!again) { push_button=new QPushButton(parent_widget); myself=push_button; } /* initial value is the label */ if (im->parameter_type(0,T_STRING)) button_label(push_button, im->get_string_parameter(0)); push_button->setFixedSize(push_button->sizeHint()); if (im->parameter_type(0,T_STRING) && im->get_string_parameter(0)[0]==' ') //if (im->is_default_button()) push_button->setDefault(true); /* button pressed ... */ if (!again) connect(push_button, SIGNAL(clicked()), SLOT(button_pressed())); break; case 6: // @regex --> @string, @float, @password again=line_edit; if (!again) { line_edit=new QLineEdit(parent_widget); myself=line_edit; } /* first parameter is regular expression */ if (im->parameter_type(1,T_STRING) || im->parameter_type(1,T_REGEXP)) { line_edit->setValidator (new QRegValidator(im->get_string_parameter(1).c_str(), parent_widget)); list result; /* initial value */ if (im->parameter_type(0,T_STRING) && Regexp::matches(im->get_string_parameter(1).c_str(), im->get_string_parameter(0).c_str(),result)) line_edit->setText(im->get_string_parameter(0).c_str()); } break; case 7: // @infile case 8: // @outfile case 9: // @directory again=line_edit; if (!again) { myself=new Q3HBox(parent_widget); ((Q3HBox *)myself)->setSpacing(SPACING); line_edit=new QLineEdit(myself); push_button=new QPushButton(myself); push_button->setText("..."); push_button->adjustSize(); } if (im->parameter_type(0,T_STRING)) line_edit->setText(im->get_string_parameter(0).c_str()); /* button pressed ... */ if (!again) connect(push_button, SIGNAL(clicked()), SLOT(button_pressed())); break; case 10: // @combo case 15: // @combow --> @list { again=combo_box; if (!again) { combo_box=new QComboBox(spec==15, parent_widget); connect(combo_box, SIGNAL(activated(const QString &)), SLOT(message_listbox(const QString &))); myself=combo_box; } else { if (im->get_parameter_num()>0) combo_box->clear(); } bool has_string_regexp_init=false, regexp=false; bool s_global_flag=false, has_substitution=false; string s_pattern, s_replacement, pattern; list result; if (im->parameter_type(0,T_STRING) || im->parameter_type(0,T_REGEXP)) { has_string_regexp_init=true; regexp=im->parameter_type(0,T_REGEXP); pattern=im->get_string_parameter(0); } int items_inserted=0; /* process parameters and initvalue */ int pn=im->get_parameter_num(); for (int i=1; i<=pn; i++) { if (im->parameter_type(i,T_SUBST)) { /* update substitution */ has_substitution=true; im->get_subst_parameter(i, s_pattern, s_replacement, s_global_flag); } if (im->parameter_type(i,T_STRING)) { list lines; Regexp::split('\n', im->get_string_parameter(i), lines); list::iterator it; for (it=lines.begin(); it!=lines.end(); it++) { string original_line=(*it), modified_line=original_line; /* execute substitution */ if (has_substitution) Regexp::substitute(s_pattern, original_line, s_replacement, modified_line, s_global_flag); combo_box->insertItem(modified_line.c_str()); if (has_string_regexp_init) { /* select the line - equal to a string - matching a regexp */ if ((!regexp && pattern==(*it)) || (regexp && Regexp::matches (pattern, original_line, result))) { has_string_regexp_init=false; // select first choice combo_box->setCurrentItem(items_inserted); } } items_inserted++; } } } /* integer initvalue */ if (im->parameter_type(0,T_NUMERAL)) combo_box->setCurrentItem(im->get_int_parameter(0)-1); } break; case 11: // @container { again=list_box; if (!again) { Q3VBox * vbox=new Q3VBox(parent_widget); myself=vbox; Q3HBox * hbox=new Q3HBox(vbox); hbox->setSpacing(SPACING); vbox->setSpacing(SPACING); list_box=new Q3ListBox(vbox); // buttons push_button=new QPushButton(hbox); push_button2=new QPushButton(hbox); } string txt_add("Add"); string txt_remove("Remove"); /* 1: source for the container: NONTERMINAL */ if (im->parameter_type(1,T_NONTERM)) container_source=im->get_int_parameter(1); /* 2,3: Add, Remove button label: string */ if (im->parameter_type(2,T_STRING)) txt_add=im->get_string_parameter(2); if (im->parameter_type(3,T_STRING)) txt_remove=im->get_string_parameter(3); // text or image label if (!again || im->parameter_type(2,T_STRING)) button_label(push_button, txt_add.c_str()); if (!again || im->parameter_type(3,T_STRING)) button_label(push_button2, txt_remove.c_str()); push_button->setFixedSize(push_button->sizeHint()); push_button2->setFixedSize(push_button2->sizeHint()); /* when button is pressed */ if (!again) { connect(push_button, SIGNAL(clicked()), SLOT(container_add())); connect(push_button2, SIGNAL(clicked()), SLOT(container_remove())); } } break; case 14: // @edit --> @preview's pressed action { again=edit; if (!again) { edit=new Q3MultiLineEdit(parent_widget); myself=edit; } /* init value */ if (im->parameter_type(0,T_STRING)) edit->setText(im->get_string_parameter(0).c_str()); int param=1; /* font, size parameters */ if (im->parameter_type(1,T_STRING)) { string font_name=im->get_string_parameter(1); QFont font(font_name.c_str()); if (font_name[0]=='-') font.setRawName(font_name.c_str()); edit->setFont(font); param++; } /* window size */ if (im->parameter_type(param,T_NUMERAL)) edit->setMinimumWidth(im->get_int_parameter(param)); if (im->parameter_type(param+1,T_NUMERAL)) edit->setMinimumHeight(im->get_int_parameter(param+1)); } break; case 18: // @icon { QLabel * label=(QLabel *)myself; again=label; if (!again) { label=new QLabel(parent_widget); myself=label; } if (im->parameter_type(1,T_STRING)) { QPixmap & pixmap=get_pixmap(im->get_string_parameter(1).c_str()); label->setPixmap(pixmap); label->setFixedSize(pixmap.size()); } } break; case 19: // @text { QLabel * text=(QLabel *)myself; again=text; if (!again) { text=new QLabel(parent_widget); myself=text; text->setAlignment(Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap); text->setFrameStyle(Q3Frame::Panel | Q3Frame::Sunken); } /* concatenate parameters */ list lines; int pm=im->get_parameter_num(); for (int i=0; i<=pm; i++) { if (im->parameter_type(i,T_STRING)) lines.push_back(im->get_string_parameter(i)); } string joined; Regexp::join('\n', lines, joined); text->setText(joined.c_str()); } break; case 24: // @size if (im->parameter_type(1,T_NUMERAL)) parent_widget->setMinimumWidth(im->get_int_parameter(1)); if (im->parameter_type(2,T_NUMERAL)) parent_widget->setMinimumHeight(im->get_int_parameter(2)); if (im->parameter_type(3,T_NUMERAL)) parent_widget->setMaximumWidth(im->get_int_parameter(3)); if (im->parameter_type(4,T_NUMERAL)) parent_widget->setMaximumHeight(im->get_int_parameter(4)); break; case 25: // @password --> @string, @float, @regex again=line_edit; if (!again) { line_edit=new QLineEdit(parent_widget); myself=line_edit; line_edit->setEchoMode(QLineEdit::Password); } /* initial value */ if (im->parameter_type(0,T_STRING)) line_edit->setText(QString(im->get_string_parameter(0).c_str())); /* maximum length */ if (im->parameter_type(1,T_NUMERAL)) line_edit->setMaxLength(im->get_int_parameter(1)); break; case 27: // @fill myself=new QWidget(parent_widget); parent_layout->addWidget(myself,1); myself=0; // do not add it later to the layout break; case 28: // @multicol -:-> @list { again=list_view; if (!again) { list_view=new Q3ListView(parent_widget); list_view->setAllColumnsShowFocus(true); list_view->setSorting(-1); myself=list_view; } else { list_view->clear(); } /* coulomn separation, substitution */ bool has_regexp=false, has_substitution=false; string s_pattern, s_replacement; string separator_reg; bool s_global_flag; list result; /* initial value selection */ bool init_regexp=false, init_string=false, init_number=false; int init_num=0; string init_str; string init_reg; /* initial value */ if (im->parameter_type(0,T_NUMERAL)) { init_number=true; init_num=im->get_int_parameter(0); } if (im->parameter_type(0,T_REGEXP)) { init_regexp=true; init_reg=im->get_string_parameter(0); } if (im->parameter_type(0,T_STRING)) { init_string=true; init_str=im->get_string_parameter(0); } int i=1, item_inserted=0, pn=im->get_parameter_num(); bool init_selected=false, has_header=false; int max_col_num=0; Q3ListViewItem * current_item=0; /* optional first regexp */ if (im->parameter_type(i, T_REGEXP)) { has_regexp=true; separator_reg=im->get_string_parameter(i); i++; } for (; i<=pn; i++) { /* process multiline strings like for @list */ if (im->parameter_type(i,T_SUBST)) { /* update substitution */ has_substitution=true; im->get_subst_parameter(i, s_pattern, s_replacement, s_global_flag); } if (im->parameter_type(i,T_STRING)) { list lines; Regexp::split('\n', im->get_string_parameter(i), lines); list::iterator it; for (it=lines.begin(); it!=lines.end(); it++) { string original_line=(*it), modified_line=original_line; /** substitution **/ if (has_substitution) Regexp::substitute(s_pattern, original_line, s_replacement, modified_line, s_global_flag); /** separation **/ result.clear(); if (has_regexp) // separate using regexp { if (!Regexp::matches (separator_reg, modified_line, result)) result.push_back(modified_line); } else // separate at tabs { Regexp::split('\t', modified_line, result); } if (has_header) current_item=new Q3ListViewItem(list_view,current_item); /** inserting the fields **/ list::iterator si; int col=0; for (si=result.begin(); si!=result.end(); si++, col++) if (has_header) { if (max_col_num==col) { max_col_num++; list_view->addColumn(""); } current_item->setText(col,(*si).c_str()); } else { /* create header field */ list_view->addColumn((*si).c_str()); max_col_num++; } /** selection **/ result.clear(); if (!init_selected && has_header) { /* select the line - equal to a string - matching a regexp - equal to an integer */ if ((init_string && init_str.c_str()==(*it)) || (init_number && init_num==item_inserted+1) || (init_regexp && Regexp::matches (string(init_reg), string(original_line), result))) { init_selected=true; // select first choice list_view->setCurrentItem(current_item); } } if (has_header) item_inserted++; has_header=true; //only the first time } } } } break; case 29: // @line { again=myself; if (!again) { Q3Frame * line=new Q3Frame(parent_widget); line->setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken ); myself=line; } } break; default: // fallback to @integer again=spin_box; if (!again) { spin_box=new QSpinBox(parent_widget); myself=spin_box; } } } void Kaptain::set_info(QWidget * w) { if (w) { if (!tooltip.isEmpty()) QToolTip::add(w, tooltip); if (!whatsthis.isEmpty()) Q3WhatsThis::add(w, whatsthis); } } /* ---------- RADIO BUTTONS ---------- */ bool Kaptain::radio_is_selected() { bool is=false; if (radio_button) is=radio_button->isChecked(); else if (im->is(is_radio) && list_view_item) is=((Q3CheckListItem *)list_view_item)->isOn(); return is; } void Kaptain::radio_select(bool on) { if (radio_button) radio_button->setChecked(on); else if (im->is(is_radio) && list_view_item) { ((Q3CheckListItem *)list_view_item)->setOn(on); } if (on) im->send("selected"); } void Kaptain::radio_clicked() { /* deselect others */ Kaptain * brother; for (brother=parent->children.first(); brother!=0; brother=parent->children.next()) if (brother) { brother->radio_select(false); } /* select this */ radio_select(true); } int Kaptain::get_check_selected() { int is=0; if (checkbox) if (checkbox->isTristate()) switch (checkbox->state()) { case QCheckBox::Off: is=2; break; case QCheckBox::NoChange: is=1; break; case QCheckBox::On: is=0; break; default: break; } else is=checkbox->isChecked() ? 0 : 1; else if (im->is(is_checkbox) && list_view_item) is=((Q3CheckListItem *)list_view_item)->isOn() ? 0 : 1; return is; } string Kaptain::evaluate_parameter(int i, bool consider_noeval) { string eval; if (im->parameter_type(i,T_NONTERM)) { int nt=im->get_int_parameter(i); eval=im->evaluate_nonterminal(nt, consider_noeval); } else if (im->parameter_type(i,T_STRING)) { eval=im->get_string_parameter(i); } return eval; } /* Ask topmost Kaptain to quit */ void Kaptain::quit() { Kaptain * p=this; /* fing topmost node */ while (p->parent) p=p->parent; /* tell him to stop */ connect(this, SIGNAL(close()), p->parent_dialog, SLOT(accept())); emit close(); } /* Close current dialog */ void Kaptain::close_dialog() { /* tell him to stop */ connect(this, SIGNAL(close()), parent_dialog, SLOT(accept())); emit close(); } /* evaluate each nonterminal parameter, collect into string list */ void Kaptain::generate_arglist(list & arglist, bool need_shell, bool consider_noeval) { int pn=im->get_parameter_num(); // create command line if (pn==1 && need_shell) // calling bash { arglist.push_back("/bin/sh"); arglist.push_back("-c"); } for (int i=1; i<=pn; i++) if (im->parameter_type(i,T_STRING)) // append string arglist.push_back(im->get_string_parameter(i)); else if (im->parameter_type(i, T_NONTERM)) arglist.push_back // append generated text (im->evaluate_nonterminal(im->get_int_parameter(i), consider_noeval)); } /* ---------- BUTTONS ---------- */ void Kaptain::button_pressed() { int spec=im->spec_type; switch (spec) { case 5: // @button im->send("pressed"); break; case 12: // @close close_dialog(); break; case 13: // @action case 16: // @exec case 20: // @execclose case 26: // @fork { list arglist; if (global_test) { /* just print */ generate_arglist(arglist, false, true); copy(arglist.begin(), arglist.end(), ostream_iterator(cout)); cout << endl; } else { generate_arglist(arglist, true, true); exec_async(arglist); } if (spec==16) // @exec quit(); else if (spec==20) // @execclose close_dialog(); } // FIXME @action is synchronous! break; case 17: // @echo case 22: // @dump { list arglist; generate_arglist(arglist, false, true); copy(arglist.begin(), arglist.end(), ostream_iterator(cout)); cout << endl; if (spec==22) // @dump quit(); } break; case 21: // @execbuffer { // FIXME blocking gui! list arglist; generate_arglist(arglist, true, true); buffer_output=exec_sync_stdout(arglist); } break; case 23: // @preview { QDialog * view=new QDialog(parent_dialog,0,true); Q3BoxLayout * lay=new Q3VBoxLayout(view, BORDER, SPACING); Q3TextView * text_view=new Q3TextView(view); QPushButton * button=new QPushButton(view); lay->addWidget(text_view); lay->addWidget(button); connect(button, SIGNAL(clicked()),view, SLOT(accept())); //connect(text_view, SIGNAL(), view, SLOT(accept())); //button->setDefault(TRUE); /* init value */ if (im->parameter_type(0,T_STRING)) view->setCaption(im->get_string_parameter(0).c_str()); /* process parameters */ int param=2; /* font, size parameters */ if (im->parameter_type(param,T_STRING)) { string font_name=im->get_string_parameter(param); QFont font(font_name.c_str()); if (font_name[0]=='-') font.setRawName(font_name.c_str()); text_view->setFont(font); param++; } /* window size */ if (im->parameter_type(param,T_NUMERAL)) { text_view->setMinimumWidth(im->get_int_parameter(param)); param++; } if (im->parameter_type(param,T_NUMERAL)) { text_view->setMinimumHeight(im->get_int_parameter(param)); param++; } if (im->parameter_type(param,T_STRING)) button->setText(im->get_string_parameter(param).c_str()); else button->setText("OK"); button->setFixedSize(button->sizeHint()); if (im->parameter_type(1,T_NONTERM)) text_view->setText(im->evaluate_nonterminal (im->get_int_parameter(1), true).c_str()); view->exec(); delete lay; delete view; } break; case 7: // @infile case 8: // @outfile case 9: // @directory { QString filter, initial, result; if (im->parameter_type(1,T_STRING)) filter=im->get_string_parameter(1).c_str(); initial=line_edit->text(); if (spec==7) result=Q3FileDialog::getOpenFileName(initial, filter, parent_widget); if (spec==8) result=Q3FileDialog::getSaveFileName(initial, filter, parent_widget); if (spec==9) result=Q3FileDialog::getExistingDirectory(initial, parent_widget); if (!result.isEmpty()) line_edit->setText(result); } break; default: ; } } /* ---------- CONTAINER ---------- */ void Kaptain::container_add() { /* add one line to the continer */ if (container_source) { string s=im->evaluate_nonterminal(container_source, false); if (!s.empty()) list_box->insertItem(s.c_str()); } else list_box->insertItem("NO_SOURCE"); } void Kaptain::container_remove() { /* remove selected line */ if (list_box->currentItem()!=-1) list_box->removeItem(list_box->currentItem()); } void Kaptain::subdialog_clicked() { if (child_dialog) { child_dialog->exec(); } } string Kaptain::evaluate_special() { string s; int spec=im->spec_type; /* creates a widget and sets myself to point to it */ switch (spec) { case 1: // @integer { ostringstream ss; ss << spin_box->value(); s=ss.str(); } break; case 2: // @string case 4: // @float case 6: // @regex case 7: // @infile case 8: // @outfile case 9: // @directory case 25: // @password s=line_edit->text().latin1(); break; case 3: // @list case 10: // @combo { int n=0; if (spec==3) // @list n=list_box->currentItem(); else if (spec==10) // @combo n=combo_box->currentItem(); int items_inserted=0; /* find nth line */ int pn=im->get_parameter_num(); for (int i=1; i<=pn; i++) { if (im->parameter_type(i,T_STRING)) { list lines; Regexp::split('\n', im->get_string_parameter(i), lines); list::iterator it; for (it=lines.begin(); it!=lines.end(); it++) { if (items_inserted==n) s=(*it); items_inserted++; } } } } break; case 5: // @button case 12: // @close case 13: // @action case 16: // @exec case 17: // @echo case 20: // @execclose case 22: // @dump case 23: // @preview case 26: // @fork break; case 21: // @execbuffer s=buffer_output; break; case 15: // @combow --> @list s=combo_box->currentText().latin1(); break; case 11: // @container for (uint i=0; icount(); i++) s+=list_box->text(i).latin1(); break; case 14: // @edit s=edit->text().latin1(); break; case 18: // @icon case 19: // @text case 24: // @size case 27: // @fill break; case 28: // @multicol { Q3ListViewItem * p = list_view->firstChild(); Q3ListViewItem * current=list_view->currentItem(); int n = 0; while (p) { if (p == current) break; p = p->nextSibling(); n++; } if (p) { n++; // because the first string is the header int items_inserted=0; /* find nth line */ int pn=im->get_parameter_num(); for (int i=1; i<=pn; i++) { if (im->parameter_type(i,T_STRING)) { list lines; Regexp::split('\n', im->get_string_parameter(i), lines); list::iterator it; for (it=lines.begin(); it!=lines.end(); it++) { if (items_inserted==n) s=(*it); items_inserted++; } } } } } break; case 29: // @line break; default: break; } return s; } /* -------------------- message handlers -------------------- */ void Kaptain::message_checkbox(int state) { if (state==2) im->send("on"); else if (state==1) im->send("no-change"); else if (state==0) im->send("off"); } void Kaptain::message_listbox(const QString & s) { if (im) im->send(s.latin1()); } kaptain-0.73/kaptain.h0000640023433300116100000000626011531163202013373 0ustar zsolteng#ifndef KAPTAIN_HH #define KAPTAIN_HH #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //Added by qt3to4: #include #include #include #include #include #include using namespace std; class Intermediate; class QRegValidator : public QValidator { QString regexp; regex_t * compiled_pattern; bool valid; public: QRegValidator(QString, QWidget *parent=0, const char *name=0); ~QRegValidator(); virtual QValidator::State validate(QString &, int &) const; }; class Kaptain : public QObject { Q_OBJECT private: Intermediate * im; Kaptain * parent; QWidget * parent_widget; QDialog * parent_dialog; bool kill_dialog; Q3BoxLayout * parent_layout; QWidget * myself; QRadioButton * radio_button; QCheckBox * checkbox; QSpinBox * spin_box; QLineEdit * line_edit; QTabWidget * tab_widget; Q3ListBox * list_box; QComboBox * combo_box; QPushButton * push_button, * push_button2; Q3ListView * list_view; Q3ListViewItem * list_view_item; Q3WidgetStack * widget_stack; Q3PtrDict * mapping; // used in list_views QWidget * my_panel; int stack_size; // used in treeview stacks int container_source; // used in @container Q3MultiLineEdit * edit; QDialog * child_dialog; Q3Wizard * wizard; string buffer_output; Qt::Alignment alignment; int grid_rows, grid_columns; Q3GridLayout * grid; QString title; QString tooltip; QString whatsthis; bool no_title; bool done_title; bool no_tree; bool ignore_radio; Q3PtrList children; void create_frame(); void create_title(); void create_minimum_layout(); void create_sublayout(); void create_grid_layout(); void create_sequence(); void create_tabbed(); void create_tree_view(); void create_subdialog(); void create_wizard(); void create_tree_item(); void create_stack(); void set_info(QWidget *); // add tooltip & whatsthis information Kaptain * get_tree_top(); void quit(); void close_dialog(); void generate_arglist(list &, bool, bool); void radio_select(bool); void select_defaults(); string evaluate_parameter(int, bool); public: Kaptain(Intermediate *, Kaptain *, QWidget *, Q3BoxLayout *, QDialog *, bool no_title=false, const char *name=0 ); ~Kaptain(); void create(); void create_special(); bool radio_is_selected(); int get_check_selected(); void select_page(int); int get_selected_page(); void select_it(int); string evaluate_special(); QDialog * main_dialog() { return parent_dialog; } public slots: void radio_clicked(); void panel_selected(Q3ListViewItem *); void button_pressed(); void container_add(); void container_remove(); void subdialog_clicked(); void message_checkbox(int); void message_listbox(const QString &); signals: void close(); }; #endif // KAPTAIN_HH kaptain-0.73/AUTHORS0000640023433300116100000000005210120611326012632 0ustar zsoltengTerk Zsolt kaptain-0.73/COPYING0000640023433300116100000004313110120611326012622 0ustar zsolteng GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. kaptain-0.73/ChangeLog0000640023433300116100000000000110120611326013326 0ustar zsolteng kaptain-0.73/lexer.h0000640023433300116100000000000010120611331013037 0ustar zsoltengkaptain-0.73/lexer.lpp0000640023433300116100000001673111162156272013444 0ustar zsolteng%{ #include #include #include "global.h" #include "tools.h" #include "process.h" #include "grammar.h" #include "parser_yacc.h" using namespace std; string * terminal; string delimiter; int rarrow_lineno=0, larrow_lineno=0, nonterminal_lineno=0, last_correct_lineno=0; char quoting, first_char; bool my_exception(int e); string safe_getenv(char *); %} %option noyywrap yylineno %x DOUBLE_QUOTES SINGLE_QUOTES BACK_QUOTES QUOTE QUOTE_START SUPER_QUOTE %x REG_EXP REG_EXP_START %x SUBST1 SUBST2 SUBST3 SUBST_START %x TRANS1 TRANS2 TRANS_START alpha [a-zA-Z_] alphanum [a-zA-Z_0-9] Word {alpha}{alphanum}* %% [ \t\n\r]+ ; #.*\n ; #.* ; [+-]?[0-9]+ { parserlval.integer=atoi(yytext); return NUMBER; } {Word} { nonterminal_lineno=yylineno; parserlval.pstring=new string(yytext); return NONTERMINAL; } :{Word} { parserlval.pstring=new string(yytext); return MODIFIER; } @{Word} { parserlval.pstring=new string(yytext); return SPECIAL; } "->" { rarrow_lineno=yylineno; return RARROW; } "<-" { larrow_lineno=yylineno; return LARROW; } \" { terminal=new string; BEGIN(DOUBLE_QUOTES); } { \\n { terminal->append("\n"); } \\t { terminal->append("\t"); } \\\n ; \\. { terminal->append(yytext+1); } \" { parserlval.pstring=terminal; BEGIN(INITIAL); return TERMINAL; } \n { if (my_exception(1)) return ERROR; } [^\n$\\""]+ { terminal->append(string(yytext)); } \$[a-zA-Z]+ { terminal->append(safe_getenv(yytext+1)); } \$\{[^}]+\} { yytext[yyleng-1]=0; char * env = getenv(yytext+2); if (env) terminal->append(env); } . { terminal->append(yytext); } } ' { terminal=new string; BEGIN(SINGLE_QUOTES); } { ' { parserlval.pstring=terminal; BEGIN(INITIAL); return TERMINAL; } \n { my_exception(1); return ERROR; } [^\n'']+ { terminal->append(string(yytext)); } . { terminal->append(yytext); } } ` { terminal=new string; BEGIN(BACK_QUOTES); } { ` { parserlval.pstring=new string(exec_sync_stdout(*terminal)); delete terminal; BEGIN(INITIAL); return TERMINAL; } \n { my_exception(1); return ERROR; } [^\n`]+ { terminal->append(string(yytext)); } . { terminal->append(yytext); } } (q|x)/[^a-zA-Z0-9;().=:_\n\t -] { BEGIN(QUOTE_START); first_char=yytext[0]; terminal=new string; } . { quoting=yytext[0]; BEGIN(QUOTE); } . { if (yytext[0]==quoting) { BEGIN(INITIAL); if (first_char=='x') parserlval.pstring=new string (exec_sync_stdout(*terminal)); else parserlval.pstring=terminal; return TERMINAL; } terminal->append(yytext); } \n { my_exception(1); return ERROR; } (m)/[^a-zA-Z0-9;().=:_\n\t -] { BEGIN(REG_EXP_START); first_char=yytext[0]; terminal=new string; } . { quoting=yytext[0]; BEGIN(REG_EXP); } . { if (yytext[0]==quoting) { BEGIN(INITIAL); parserlval.pstring=terminal; return REGEXP; } terminal->append(yytext); } \n { my_exception(2); return ERROR; } (s)/[^a-zA-Z0-9;().=:_\n\t -] { BEGIN(SUBST_START); first_char=yytext[0]; terminal=new string; } . { quoting=yytext[0]; BEGIN(SUBST1); } . { if (yytext[0]==quoting) { BEGIN(SUBST2); parserlval.string_array[0]=terminal; terminal=new string; } else terminal->append(yytext); } . { if (yytext[0]==quoting) { BEGIN(SUBST3); parserlval.string_array[1]=terminal; } else terminal->append(yytext); } \n { my_exception(3); return ERROR; } \n { my_exception(3); return ERROR; } .|\n { terminal=new string; terminal[0]=yytext[0]; parserlval.string_array[2]=terminal; if (yytext[0]!='g') unput(yytext[0]); BEGIN(INITIAL); return SUBSTITUTION; /* if (yytext[0]=='g') parserlval.string_array[2]=(string *)1; // indicate `g' flag else { parserlval.string_array[2]=0; unput(yytext[0]); } BEGIN(INITIAL); return SUBSTITUTION; */ } (tr|y)/[^a-zA-Z0-9;().=:_\n\t -] { BEGIN(TRANS_START); first_char=yytext[0]; terminal=new string; } . { quoting=yytext[0]; BEGIN(TRANS1); } . { if (yytext[0]==quoting) { BEGIN(TRANS2); parserlval.string_array[0]=terminal; terminal=new string; } else terminal->append(yytext); } . { if (yytext[0]==quoting) { BEGIN(INITIAL); parserlval.string_array[1]=terminal; return TRANSLITERATION; } else terminal->append(yytext); } \n { my_exception(4); return ERROR; } \n { my_exception(4); return ERROR; } "<<".*\n { BEGIN(SUPER_QUOTE); delimiter=string(yytext+2); terminal=new string; } ^.*\n { if (yytext==delimiter) { BEGIN(INITIAL); terminal->erase(terminal->size()-1,1); parserlval.pstring=terminal; return TERMINAL; } //if (!(terminal->empty())) // terminal->append("\n"); terminal->append(yytext); } \n ; . { return yytext[0]; } %% extern Grammar * yygrammar; bool my_exception(int e) { ostringstream message; string s; bool warning=false; switch (e) { case 1: s="String constant has reached the end of the line"; warning=true; break; case 2: s="Regular expression constant has reached the end of the line"; break; case 3: s="Substitution constant has reached the end of the line"; break; case 4: s="Transliteration constant has reached the end of the line"; break; default: s="Unknown error"; } message << s << " at line " << yylineno << "." << endl; if (warning) MAKE_WARNING(message.str()); else MAKE_ERROR(message.str()); return !warning; // report error or not } /* returns emty string if no uch environment variable exists */ string safe_getenv(char * s) { string r; char * env; env=getenv(s); if (env) r=env; return r; } kaptain-0.73/INSTALL0000640023433300116100000001547210120611326012627 0ustar zsoltengBasic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Type `make install' to install the programs and any data files and documentation. 4. You can remove the program binaries and object files from the source code directory by typing `make clean'. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. kaptain-0.73/main.cpp0000640023433300116100000001446611162157053013241 0ustar zsolteng#include #include #include #include "global.h" #include "tools.h" #include "communication.h" #include "process.h" #include "grammar.h" #include "intermediate.h" #include "kaptain.h" #include #include #include //#include "../config.h" #define PACKAGE "kaptain" #define VERSION "0.8" extern FILE * lexerin; extern int last_correct_lineno, yylineno; Grammar * yygrammar; int parserparse(); int yylex(); bool global_debug=false, global_test=false; int glob_parse_result=0; list * glob_param_list=0; Parameter * glob_init_value=0; Communicator * glob_communicator=0; Error * glob_error=0; class Instance { Grammar * grammar; Intermediate * intermediate; Kaptain * kaptain; public: Instance(); ~Instance(); void init(int, char **); void load(); void transform(); int run(); Communicator communicator; Error error; string filename; bool dbg_print_before; bool dbg_print_after; bool quit; bool test; }; extern int lexerlex (void); int parserlex() { return lexerlex(); } int main(int argc, char * argv[]) { POSIX_init(); Instance instance; QApplication a(argc, argv); glob_communicator=&instance.communicator; glob_error=&instance.error; instance.init(argc,argv); instance.load(); instance.error.print(); instance.transform(); int res=instance.run(); return res; } /*---*/ Instance::Instance() { grammar=0; intermediate=0; kaptain=0; dbg_print_before=false; dbg_print_after=false; quit=false; } void STATUS(const char * s) { if (global_debug) cout << s << endl; } void DONE(void) { } Instance::~Instance() { if (grammar) delete grammar; if (intermediate) delete intermediate; if (kaptain) delete kaptain; } void Instance::init(int argc, char * argv[]) { int at=1; // start at first argument while (at" << endl; quit=true; } else if /* help */ (strcmp(argv[at],"--help")==0 || strcmp(argv[at],"-h")==0) { cout << "kaptain is a universal graphical front-end." << endl << "Usage: kaptain [options] file" << endl << endl; quit=true; } else if /* socket client */ (strcmp(argv[at],"--client")==0 || strcmp(argv[at],"-c")==0) { /* getting next argument */; at++; if (at==argc) MAKE_ERROR("Missing `hostname:port' for client socket.\n"); else communicator.setup_socket_client(argv[at]); } else if /* socket server */ (strcmp(argv[at],"--server")==0 || strcmp(argv[at],"--port")==0 || strcmp(argv[at],"-s")==0) { /* getting next argument */; at++; if (at==argc) MAKE_ERROR("Missing port number for server socket.\n"); else communicator.setup_socket_server(argv[at]); } else if /* pipe to a program */ (strcmp(argv[at],"--pipe")==0 || strcmp(argv[at],"--prog")==0 || strcmp(argv[at],"-p")==0) { /* getting next argument */; at++; if (at==argc) MAKE_ERROR("Missing command name for creatinf pipe.\n"); else communicator.setup_progio(argv[at]); } else if (strcmp(argv[at],"--no-input")==0) { communicator.no_input(); ; } else if (strcmp(argv[at],"--no-output")==0) { communicator.no_output(); ; } else if /* file input (strcmp(argv[at],"--input")==0 || strcmp(argv[at],"-i")==0) { communicator.setup_stdin(); ; } else if */ /* standard input/output */ (strcmp(argv[at],"--stdio")==0) { communicator.setup_stdio(); ; } else if (filename.empty()) /* filename */ filename=argv[at]; at++; } } void Instance::load() { if (quit || !GO_ON()) return; grammar=new Grammar(); yygrammar=grammar; // global variable for the parser STATUS("Parsing script..."); if (strcmp(filename.c_str(),"-")==0 || filename.empty()) { if (communicator.is_stdin()) { MAKE_ERROR("No input file.\n"); lexerin=0; return; } lexerin=stdin; } else lexerin=fopen(filename.c_str(),"rt"); if (!lexerin) { /* I/O error */ ostringstream message; if (filename.empty()) filename=string("stdin"); message << "Can't read input file: " << filename << endl; MAKE_ERROR(message.str()); } else { /* OK */ if (parserparse()!=0 || glob_parse_result!=0) { /* parse error */ ostringstream message; extern int lexerlineno; message << "Parse error on line " << lexerlineno << endl << "Stuck __after__ the rule on line " << last_correct_lineno << endl; MAKE_ERROR(message.str()); } fclose(lexerin); } DONE(); grammar->unify(); grammar->verify(); return; } void Instance::transform() { if (quit || !GO_ON()) return; STATUS("Transforming rules..."); intermediate=new Intermediate(0); intermediate->create_from(grammar, grammar->get_start_rule()); if (dbg_print_before) intermediate->print(0); intermediate->transduce(); if (dbg_print_before && dbg_print_after) cout << "---" << endl; if (dbg_print_after) intermediate->print(0); DONE(); } int Instance::run() { if (quit) return 0; if (!GO_ON()) return -1; STATUS("Done."); kaptain=new Kaptain(intermediate, 0, 0, 0, 0); qApp->setMainWidget(kaptain->main_dialog()); return kaptain->main_dialog()->exec(); } kaptain-0.73/man/0000750023433300116100000000000011532667206012357 5ustar zsoltengkaptain-0.73/man/kaptain.10000640023433300116100000000601711532667206014075 0ustar zsolteng.\" hey, Emacs: -*- nroff -*- .\" kaptain is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program; see the file COPYING. If not, write to .\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. .\" .TH KAPTAIN 1 "September 11, 2004" .\" Please update the above date whenever this man page is modified. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins (default) .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME kaptain \- Universal graphical front-end for command-line programs. .SH SYNOPSIS .B kaptain .RI [ options ] .RI file .SH DESCRIPTION \fBkaptain\fP reads the given file and builds a user-friendly dialog according to the grammar rules found in it. .PP See .B info kaptain for a detailed overview. .SH OPTIONS \fBkaptain\fP accepts the following options: .TP .B \-h, \-\-help Show summary of options. .TP .B \-V Run in verbose mode. .TP .B \-\-version Show version of program. .TP .B \-\-test Run in test mode. This means that commands are not executed when a button is pressed, only printed to the standard output. .TP .B \-V, \-\-verbose Report more information on processing the input file. Internal representation of the grammar and the dialog tree is also printed. Use this flag if Kaptain does not work as expected. .TP .B \-c , \-\-client Establish communication channel as a client connecting to a server on listening on . .TP .B \-s , \-\-server Listen to the specified and accept the first connection. This will be used as a communication channel. .TP .B \-p , \-\-pipe Start the given command and communicate with it on its standard input and output. Don't forget to quote if it contains spaces or other metacharacters used by the shell. .TP .B \-\-stdio Use standard input and output for communication. In this case you must specify an input file, thus grammar script cannot be read from the standard input when it is used as a communication channel. .TP .B \-\-no\-input Instructs Kaptain not to process messages received on the input channel. .TP .B \-\-no\-output If this flag is set, Kaptain will not send any messages on its output channel. .SH AUTHOR Zsolt Ter\['e]k . kaptain-0.73/doc/0000750023433300116100000000000011532667610012350 5ustar zsoltengkaptain-0.73/doc/crypt.gif0000640023433300116100000000634610120611327014174 0ustar zsoltengGIF87a```~}|zyxwutsqponlkjhgfecba`^]\ZYXWUTSQPONLKJHGFECBA@>=<:98754310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h:T)Ǘ@Mij2,Si;0QhXQF}kڠUkڻW+Vy3a%Li0jﴀawZƽ4_iLcӘ41iL;F+p\?M.Ua%LUBV L#i0-e7ϦyVsȅܙeO4жwJF (MYaK[cJ;?Li0Q4Jfo]f|UբIENDB`kaptain-0.73/doc/kaptain.html0000640023433300116100000027001710120611327014657 0ustar zsolteng Kaptain:
[Top] [Contents] [Index] [ ? ]

Kaptain

1. The Concepts of Kaptain  
2. Invoking Kaptain  
3. Grammar Scripts  
4. Examples  
5. External Control  
6. Errors  
7. Reference of Special Symbols  
A. Reference of Modifiers  
Concept Index  Concept index.

This is a manual for Kaptain, the Universal Graphical Front-end.

Copyright © 2000-2004 Zsolt Terk


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. The Concepts of Kaptain

Kaptain is a universal graphical front-end. It was originally developed in order to provide a simple and efficient tool for creating dialog-based interface for command line programs. Now, its communication features allow it to serve the graphical user interface of a program without directly using a graphical library, such as GTK or Qt.

When Kaptain is started, it reads a so-called grammar script. This is a text file, which contains a description in a form of a context-free grammar and optionally some other instructions. This manual refers to the input file of Kaptain as a grammar script. See 3. Grammar Scripts for a complete overview on grammar script syntax.

According to the grammar script, Kaptain builds a graphical dialog box. Certain parts of the dialog box are associated with certain elements of the grammar. This association is quite natural, thats why Kaptain's language is so easy to learn.

In the dialog box, several widgets are present. These objects can be manipulated by the user--text can be entered into input fields, checkboxes can be set on and off. When a certain push button is pressed, Kaptain reads the data specified by the user in the dialog box and uses the context-free grammar to generate text. The generated text is then executed as a command, just like as if it were entered at the command prompt.

Suppose we have a program named prog that runs in two different modes. For its first mode, an integer parameter should be given, and the second mode needs some text as parameter. An example for starting prog in its first mode:
 
and in second mode
 
Kaptain is a perfect tool for creating a graphical front-end for this program. First of all, we need to describe the possible command lines with a grammar.
 
start -> "prog " parameter ;
parameter -> "-x " @integer | "-y " @string ;

The grammar in the example above is almost enough for Kaptain to build a dialog containing an integer input box and a string input field, each having a radio button. Additionally a push button is needed and some text might be specified in order to label the input fields.

Given a file containing such a description, Kaptain parses the grammar and builds a dialog box. When the push button is pressed, the text is generated according to the settings of the user.

The complete grammar for the program above might look like this:
 
start -> "prog " parameter @action(start)="Ok";
parameter -> x | y ;
x "First mode" -> "-x " @integer;
y "Second mode" -> "-y " @string;

According to the settings in the figure, the generated text is `prog -x 0', since the first radio button is selected.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. Invoking Kaptain

Kaptain needs a grammar script in order to display the dialog. This is usually located in a file, and the name of that file is passed to Kaptain as an argument. The grammar script can be written to the standart input of Kaptain, too.

The running mode of Kaptain can be normal or test mode. In test mode, commands are not executed, they are printed to the standard output instead.

The command line of Kaptain generally looks like this:
 
Kaptain [options] file
If the file is omitted, the standard input is used as a source for the input file.

Some options are used to specify running mode, while others set up different kinds of communication channels for external control. Kaptain accepts the following switches and parameters:

`--version'
Print out the version information of Kaptain end quit.

`--help'
Write a brief help on command line options.

`--test'
Run in test mode. This means that commands are not executed when a button is pressed, only printed to the standard output.

`-V'
`--verbose'
Report more information on processing the input file. Internal representation of the grammar and the dialog tree is also printed. Use this flag if Kaptain does not work as expected.

`-c host:port'
`--client host:port'
Establish communication channel as a client connecting to a server on host listening on port.

`-s port'
`--server port'
Listen to the specified port and accept the first connection. This will be used as a communication channel.

`-p command'
`--pipe command'
Start the given command and communicate with it on its standard input and output. Don't forget to quote command if it contains spaces or other metacharacters used by the shell.
`--stdio'
Use standard input and output for communication. In this case you must specify an input file, thus grammar script cannot be read from the standard input when it is used as a communication channel.

`--no-input'
Instructs Kaptain not to process messages recieved on the input channel.

`--no-output'
If this flag is set, Kaptain will not send any messages on its output channel.

These are the possible parameters and options accepted by Kaptain called from the command prompt.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Grammar Scripts

The input file of Kaptain is a grammar script. It contains the description of a context-free grammar in a form of rules. Beside the rules, it might also contain so-called descriptions and constraints.

Comments can be placed in grammar scripts. Hashmark (`#') is a comment character, which means that all characters after the hashmark up to the end of the line are ignored together with the hashmark. This is not true if the hashmark appears inside a quoted string, see 3.3 Quotations.

3.1 Grammars  
3.2 Special symbols  
3.3 Quotations  
3.4 Regulas expressions and translations  
3.5 Using text manipulation in grammar rules  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Grammars

The program Kaptain reads an input file containing the description in the form of a context-free grammar. The concept of context-free grammar is coming form formal linguistic. A grammar is built up of several rules. Each rule contains a left hand side symbol and some symbols on the right hand side separated by an arrow:
 
start -> "progname" options parameters ;
An interpretation of a rule is the following. The symbol on the left hand side, which is a nonterminal symbol is considered as the concatenation of the symbols on the right, which can be either nonterminal or terminal symbols. In a Kaptain grammar, symbols are separated by whitespace and rules should end with a semicolon.

Nonterminal symbols are similar to variables in other programming languages. Their name can contain alphanumeric characters and underscore, and should not begin with numbers.

Terminal symbols are written between quotation marks. Kaptain has many ways for specifying terminal symbols, see 3.3 Quotations

The text generation process is an iterated application of rules on the current sentence. Starting from the nonterminal symbol `start', every step consists of an application of a rule. This means that a nonterminal symbol in the current sentence--which is the left hand side of the applied rule--is replaced by the symbols on right hand side of the rule. This process ends if there are no more nonterminal symbols in the current sentence.

To illustrate text generation, let us have the following grammar:
 
start -> "Your " animal "is " size ;
animal -> "dog " ;
animal -> "cat " ;
size -> "big." ;
size -> "small." ;

Starting with the sentence `start', only the first rule can be applied. The current sentence is then `"Your " animal "is " size'. Here both `animal' and `size' is nonterminal, thus any of the rules but the first can be applied. This way exactly four different sentences can be generated by this grammar:
 
Your dog is big.
Your cat is small.
Your dog is big.
Your cat is small.

As a syntactic simplification, different rules of the same left hand side can be written in one complex rule using `|' character as a separator of the different right hand sides. The grammar above is equivalent to the following:
 
start -> "Your " animal "is " size ;
animal -> "dog " | "cat " ;
size -> "big." | "small." ;

The set of sentences that can be generated using a certain grammar is called the language generated by that grammar. Formal languages is a branch of mathematics that deals with languages and grammars.

3.2 Special symbols  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Special symbols

The expression power of grammars is great. However, sometimes it is quite comlicated to express simple things. For example, the definition of numbers is quite long and messy: (Of course, it is possible to write a different grammar for the numbers, this is not a unique definition.)
 
number -> digits ;
digits -> digit digits | digit ;
digit -> "0" | "1" | "2" | "3" | "4" 
       | "5" | "6" | "7" | "8" | "9" ;

Beside terminal and nonterminal symbols, Kaptain offers so-called special symbols to appear in grammars. Special symbols always start with `@'. Such a symbol almost always refers to a widget in the dialog. For example `@integer' represents a widget, which is a rectangular area where the user can write a decimal number. The special symbol evaluates to the value that it contains at the time of the text generation process.

Special symbols may accept different number of parameters and an optional initial value. The general form is as follows:
 
@specname(param_1, param_2, ..., param_n)=initvalue
If no parameters are given, the parentheses can be omitted. The same simplification can be applied to the initvalue, what's more, equality sign must not be written if no initvalue is present. The following forms are thus enabled:
 
@specname
@specname=initvalue
@specname(param_1, param_2, ...)
@specname(param_1, param_2, ...)=initvalue
Note that the number and type of parameters is not unique, but if Kaptain cannot interpret a certain parameter in some position, then it will be simply ignored.

The complete reference of special symbols can be found in 7. Reference of Special Symbols.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 Quotations

Quotations are the constructions for specifying a literal string, which is a terminal symbol in the grammar. Kaptain understands a great variety of quotations in order to make it possible to write character sequences in the easiest way. The possibble quotations are similar to those of the language perl and the unix shells.

Double quotes
Strings between double quotes are weakly quoted strings. This means that some characters are treated as meta-characters. For example, backslash (\) is an escape-character. The following escape-sequences are available: \n, \t, \", \\. Other characters are not modified if preceeded by backslash. This way one can place double quote character inside a string:
 
"Double quotes \" are easy to write."
which stands for
 
Double quotes " are easy to write.

An other meta-character is the dollar sign ($), which is used for inserting environmental variables into strings. For example in "$HOME/hello" the sequence $HELLO is replaced by the content of the HELLO environmental variable. If the environmental variable name contains other characters than letters, the following form should be used: ${ANY89}.

This kind of quotation should always end on the same line it was started. If the end-of-line symbol is reached within the string, Kaptain prints a warning.

Single quotes
Strings quoted by a single apostrophe are strongly quoted strings. This means that each character inside the string stands for itself, except the apostrophe, which always means the ending of the string. There is no way to include apostrophe in single quoted strings.
 
'No way to have apostrophes in this string'
This kind of quotation should always end on the same line it was started. If the end-of-line symbol is reached within the string, Kaptain prints a warning.

Backquotes
Strings in backquotes are treated in a special way. Immediately after the string is parsed, Kaptain executes the given string as a shell command, and inserts the text it has written to the standard output instead of the original string. For example, placing `ls` evaluates to a string which contains the file names of the current directory. An easy way to create a list box containing the available files is the following:
 
@list(`ls`)
Since command ls returns the files separated by a newline symbol, `@list' inserts the different lines of its parameter value as different list items. See section 7. Reference of Special Symbols.

The commands are passed to `/bin/sh', so any shell constructions can be given, e.g., pipes.

Using backquots is a strong form of quoting: there are no special characters. As a consequence of this, no backquote (`) can appear inside.

Perlish single quotes
Single quotes are used when no apostrophes appear in the string. Perl introduced a quotation form where the user chooses the most appropriate delimiter and any other character can be placed between the delimiters without modification. The following
 
q%any characters except the delimiter%
is evaluated to
 
any characters except the delimiter
and the delimiter character, here % can be replaced by any except the following: letters, numbers, ;().=:_- and whitespace.

The letter `q' at the beginning stands for quotation.

Perlish exection quotes
Analogous to the previous generalization of single quotes, perl generalizes backquotes using the following form:
 
x%shell command line not containing the delimiter%
which evaluates to
 
shell command line not containing the delimiter
The delimiter can be of the same set as above, and the letter `x' stands for execution.

Multiline quotes
A long string spreading on more than one line is usually written using the line-delimiter construction.

When Kaptain parses two less signs (<<), the text up to the end of the line is stored as a delimiter string and it starts to scan a quotation. The quotation is ended if a line occurs that is exactly same as the delimiter string.

 
... <<LINE_DELIMITER
Here goes
the long text
LINE_DELIMITER
The sample above evaluates to the following two lines:
 
Here goes
the long text
The ellipses indicates that the << sequence needs not to be on the beginning of a line. The quotation above is equivalent to the following:
 
... "Here goes\nthe long text"


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4 Regulas expressions and translations

3.4.1 Regular expressions  
3.4.2 Substitutions  
3.4.3 Transliterations  

All expressions mentioned here use / (slash) as bounding character. This can be replaced by any expect letters, numbers, blanks, underscore, hyphen and semicolon. But the beginning and the ending bounding characters must be the same, there is no way to refer to that character inside the expression. For example, instead of m/hello/, one can write m%hello%, m^hello^, and so on.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.1 Regular expressions

Kaptain understands regular expressions like grep or perl. For a detailed review, type man grep or man perlre at the command prompt. You can give a regular expression as a parameter to some special symbols, like this:
 
@string(m/$[0-9]*^/, ...

Here m/$[0-9]*^/ means that the string value in the input line must match the corresponding regular expression. In this particular case, this means the user can only type integers into the line input field.

When parentheses are found in the regular expression, a subexpression is matched which can be referred with \d where d is a digit. (\1, \2, ... \9) For example:
 
@multicol(m/([^[:blank:]]*)[[:blank:]]+([^[:blank:]]*)/, 
          "First_name Last_name",
          "Albert Einstein Dr.", "Isaac Newton", "Rudolf Kepler")
Here the regular expression matches each separate string and the subexpressions match the first and the second word. In this case, a twocolumn listview is displayed, each line contains a name. The first column contains their first name, the second the last name. Note that the third word "Dr." in line "Albert Einstein Dr." is not matched by the second subexpression, so it is not displayed.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.2 Substitutions

Substitution is based on regular expression matching just like in perl or sed. (For some metacharacters, sed uses different syntax.) Substitution expression needs a regular expression and a substitution string as an input:
 
s/regexp/subs/

For example, to replace the words "dog" in a text to "cat, just write s/dog/cat/g. That g at the end means that substitution is repeated until the regular expression cannot match. In the second part, you can refer to the matched subexpressions by \d, where d is a digit. \0 refers to the whole matched string. Thus the following swaps the first two words in the text:
 
s/([^[:blank:]]*)[[:blank:]]+([^[:blank:]]*)/\2 \1/

You can use it in listbox:
 
@list(s/([^[:blank:]]*)[[:blank:]]+([^[:blank:]]*)/\2 \1/,
     "Albert Einstein Dr.", "Isaac Newton", "Rudolf Kepler")
Here, the names in the listbox will appear in reverse order (this is common in Hungary) while the selected name will appear in the generated text in western style.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.3 Transliterations

Transliteration is a very simple operation which replaces some characters with some others.
 
tr/abc/def/
This replaces a with d, b with e, c with f.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5 Using text manipulation in grammar rules

If you put some substitution or transliteration expressions on the beginning of the right side of a rule, those are executed each time when text is generated with that rule. This means that for
 
no_jim_and_joe -> s/Jim/Peter/g s/Joe/Peter/g tr/+/-/ @string;
If the user writes Jim or Joe into the input box, it is replaced with Peter, and plus signs are changet to minus when the text is generated.

You can only mention s/// and tr/// operations just after the arrow of a rule, but any number of such expressions can be written there. They are executed from right to left, as it is expected naturally (in my opinion).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Examples

If you write your own grammars, and you think they might be useful for others, please send them to me terek@users.sourceforge.net, I will put them to the main Kaptain site.

4.1 Sound recording  
4.2 Creating archives  
4.3 Calling perl  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Sound recording

Let's record from the microphone connected to the computer. The command is
 
terek@fido:~$ dd count=5 bs=8 < /dev/audio > myfile.au
It would be better to see a beautiful dialog. The grammar
 
#!/usr/local/bin/Kaptain
start:framed -> "dd count=" count " bs=" size "k <" input " > " output ;
count "Number of blocks" -> @integer=5 ;
size "Size of blocks (k)" -> @integer=8 ;
input "Input device" -> audio | dsp ;
audio "Audio" -> "/dev/audio" ;
dsp "DSP" -> "/dev/dsp" ;
output "Output file" -> @outfile("*.au");


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Creating archives

Here is a simple grammar, just witten in 5 minutes (may contain errors, check before you try to use it!)
 
#!/usr/bin/kaptn

start "Tar" -> tar buttons;

tar -> "tar " choice " " opt archive " " files;
opt:framed :horizontal  -> extropt createopt ;

createopt "Write options" -> dump remove verb comp;
extropt "Read options" -> noerr keep same abs;

dump "Dump files, not just symlinks" -> "--dereference " | @;
noerr"Ignore failed read" -> "--ignore-failed-read " | @;
keep "Keep existing files" -> "-k " | @;
same "Extract all protection information" -> "-p " | @;
abs "Absolute path names" -> "-P " | @;
remove "Remove files after adding to archive" 
   -> "--remove-files " | @;
verb "Verbosely list files proceeded" -> "-v " | @;

comp -> compress | @;
compress "Compression" -> gzip | bzip;
gzip "gzip" -> "-z ";
bzip "bzip2" -> "--use-compress-program bzip2 ";

choice:framed  -> work;
work "Main choice" -> concat | ! create | diff | del | append 
                     | list | update | extract;
concat "Append to archive" -> "A";
create "Create archive" -> "c";
diff "Find differences between archive and file system" -> "d";
del "Delete from archive" -> "-delete";
append "Append to the end of an archive" -> "r";
list "List contents" -> "t";
update "Update archive" -> "u";
extract "Extract from archive" -> "x";

archive "Archive name" -> @infile;

files "Files to work with" -> @string ;

buttons :horizontal -> @action(tar)="OK" @close="Cancel";

It looks like this: <#if output="html">

This produces a command like
 
tar c --remove-files --use-compress-program bzip2 files.tar *.cpp *.h


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Calling perl

Kaptain can generate various texts, such as complicated pipes or a piece of perl code. To create your encrpyted password, use the perl command:
 
print crypt('passwd','sa')."\n";

Let's make the grammar:

 
#!/usr/local/bin/Kaptain
start "Password encrypter" -> code @action("perl","-e",code)="Crypt";
code:framed -> "print crypt('" passw "','" sa q%')."\n"% ;
passw "Password" -> @string="notsimple";
sa "Random chars(2)" -> @string(2)="y4";

Notice that the @action has three parameters; the perl compiler is called without the shell, having two parameters: -e and the evaluated text of code;

Simple but great:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. External Control

This chapter describes the communication with the dialog in Kaptain.

The most interesting new feature in Kaptain 0.7 is the possibility of modifying the data in the widgets while Kaptain is running. For this, Kaptain needs a communication channel, which can be some network communicaton, redirection to an other program (using pipes) or the standard input and output.

On a communication channel Kaptain can recieve messages. There are two kinds of messages:

  1. Setting message: This can be sent to rules that contain exactly one special symbol on the right side. A message consists of two parts: first comes a nonterminal name, which specifies the target of the message. This should be followed by a the real message (till the end of that line), which can be in fact anything that can be written after the special symbol you are refferring to by the rule. For example, having a rule like
     
    number -> @string
    
    then you can send a message like
     
    number="Hello"
    
    and the string input field will be set to the given value.

    Thus the general form of a setting message is:
     
    nonterminal(par1,par2,...)=initvalue
    nonterminal=initvalue
    
    The later one is the simplified form, i.e., when no parameters are given. This was the case in the example above.

    For a detailed overview of the possible parameters and initial values for a given type of special symbol, See section 7. Reference of Special Symbols.

  2. Asking message: If a nonterminal is followed by a question mark in a message sent to Kaptain on a communication chanel, Kaptain sends back the generated text by the given nonterminal in the following form:
     
    start?                                          <- to Kaptain
    start!<...here comes the generated text...>     <- from kaptin
    
    This way data can be retrieved at any time from the widgets.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Errors

Kaptain reads the given file and parses the grammar according the rules in 3. Grammar Scripts.

If Kaptain finds something that is not according the rules described in this manual, it either signals an error or just a warning.

For example, warnings are generated if string, regular expressions, or other language constructs are opened but not closed till the end of the line. This is often handy when typoes are made in the grammar script.

On the other hand, Kaptain might find syntax error, and it immediately stops. In this case, the name of the last rule that was read successfully is printed together with its line number. Thus one has to look at the errors after the last correct rule. The most usual mistake is that the closing semicolon is forgotten from the end of a rule.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Reference of Special Symbols

`@integer'
creates an integer input field with up and down arrows, which can be used to increase or decrease the number in the field. Two integer parameters are accepted, these are the minimum and maximum values. Initial value can be an integer, too. For example,
 
@integer(-10,20)=4 
will create an integer input which can store a number between -10 and 20, and is initially set to 4. The minimum and maximum value default to 0 and 99, respectively, while the uninitialized field is set to 0.

This object evaluates to the value of the input field.

`@string'
makes a one-line input field. If an integer parameter is given, the maximum length of the string is bounded by that number. For example,
 
@string(20)="Hello" 
creates an input field with `Hello' inside, allowing strings of at most 20 characters.

This object evaluates to the value of the input field.

`@float'
makes a line input field than can contain a real number. Initial value should be given in quotes if it contains other characters than numbers, for example @float="1.13".

This object evaluates to the value of the input field.

`@regexp'
Similar input field to @string, but the regular expression parameter is used to control the string that is entered. For example, @regexp(m/^[ab]*$/) enables only characters a and b to be entered. Initial string value is processed if it matches the regular expression.

`@password'
This is identical to `@string', the only difference is that the characters are not shown; an asterix appears like in usual password input fields.

`@list'
`@combo'
`@combow'
These specials generate a list box, a combo box or a writable combo box, respectively. Each given parameter is inserted into the box if it is a number or a string. If a multi-line string occurs, every line is inserted as a separate item. Thus @list("hello",`ls`,"bye") creates a list box containing the files from the current directory, and two more lines: `hello' and `bye'.

If the given initial value is a number, it indicates which line should initially be selected. In case of a string, the first occurrence of that string is highlighted. Finally, if a regular expression is given as an initial value, the first line matching that regular expression will be selected.

If a substitution expression comes in the parameter list, it is applied to the following string parameters until a new substitution parameter is reached. This is useful to make different text in the dialog box than that appears in the generated text. For example, in @list(s/^.*://,"a:A","b:B","c:C") only the text after the colon is inserted into the list box, and the whole string is used when the symbol is evaluated. Note that the initial value selection described in the previous paragraph is made by comparison to the original strings, not the modified ones that appear on the screen.

The @list and @combo objects evaluate to the line from which the currently selected line was generated using substitutions. The @combow evaluates the line in the combo widget.

`@button'
Places a simple push button with label given as initial value. The label can be an image, if a filename is given in braces, like @button="{ok.png}". creates a push button using the given initial value. If the value is in the form of "{filename}", then it is considered to be a pixmap file, otherwise the initial value is used as a text label. For example @button="OK" creates a simple push button with label `OK'.

One push button in a dialog can be the default button: This can be achieved by putting a space to the beginning of its name. For example, a default ok button is created for the following code: @button=" OK".

`@close'
Creates a button, which closes the current dialog when pressed.

`@action'
Synchronous execution. When this button is pressed, the given command is executed. During the execution, the button is disabled.

`@fork'
Asynchronous execution. When this button is pressed, the given command is started in the background, without any effect to the dialog.

`@exec'
Final execution. When this button is pressed, the given command is started and Kaptain quits immediately.

`@execclose'
This is similar to `@exec', the only difference is that Kaptain only closes the current dialog. In the topmost dialog, this has the same effect as `@exec', since Kaptain quits when it closes the topmost dialog.

`@echo'
Creates a button, which causes the generated text to be printed to the standard output.

`@dump'
Creates a similar button to `@echo', but Kaptain quits after printing the generated text to the standard output.

`@execbuffer'
This button causes the synchronous execution of the given command, when pressed. The standard output of the executed command is captured and stored. Later, this symbol evaluates to the stored text. This is the only button-like special that can evaluate to nonempty text.

`@preview'

Creates a push button, which shows up a new dialog when pressed. The new dialog contains the code generated for a given nonterminal. The accepted parameters are the following: the nonterminal,font descriptor(string), minimum width and height (integers) and the closing button's text.
 
@preview(start,"Lucidatypewriter",300,200,"Close")

`@infile'
`@outfile'
`@directory'
These special symbols generate a line input field together with a push button. When the button is pressed, a file or directory choosing dialog appears. The name of file selected by the user is then inserted into the input field. @infile stands for a file open dialog, while @outfile for file saving dialog. Using @directory, one can select an existing directory.

The initial value given to these symbols is inserted to the input field at startup. When the button is pressed, the dialog is starting on the file/directory currently specified in the input field, if exists.

The file-like specials (@infile, @outfile) accept one string argument. It can be a filter for the file selection dialog. An example for a multiple filter is the following:
 
The separators between filter groups can be either double semicolons or newline characters.

A complete example for @infile:
 
If no filter is specified, all files can be selected. In case of no initial value, the current directory is the starting point.

These items evaluate to the text in the input field.

`@container'
Creates two buttons and a list box. The first parameter should be a nonterminal symbol, the following two strings are interpreted as the labels for the buttons. When the first button is pressed, the given nonterminal symbol is evaluated, and the generated text is inserted as a line into the list box. When the second button is pressed, the current line is removed from the list box. Button names default to `Add' and `Remove'.

This object is useful in cases when recursion is needed in the grammar. (In Kaptain, recursion is forbidden.) For example, if one or more file name is needed, one can write this:
 
filename -> @infile; box -> @container(filename);
The container evaluates to its contents, its lines are simply concatenated.

`@multcol'
Creates a multi-column table with the given data filled. If the first parameter is a regular expression (m/.../), all the following string parameters are matched against this expression. Each such string parameter stands for one line, which is separated according to the regular expression.The subexpressions matched form the columns of the given row. If there is no regular expression, the rows are separated at the tab characters.

The forthcoming string parameters are the rows of the table, except the first one, which is specially the header. Initial value, if an integer is given determines the selected element in the table.

The @multicol special symbol generates to the content of the selected row.
 
@multicol("Header 1\tHeader 2","data\tdata\tdata","abc")=1;
@multicol(m/([^ ]+) ([^ ]+) ([^ ]+)/,"1 2 3","a b c",
          "xx yy zz")=0;

`@fill'
Inserts some stretchable space into the dialog. No other functionality, evaluates to empty string.

`@text'
This special symbol creates slightly sunken box in the dialog with the given text inside. The text to be displayed is the concatenation of the initial value and all the string parameters. Since it has no functions, it is only good for informing the user.

This object evaluates to the empty string.

`@icon'
Displays an image in the dialog. The first parameter should be string, which is the name of a graphic file. Several file formats are recognized. From Qt's manual:
Qt currently supports the following image file formats: PNG, BMP, XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if specially configured during compilation. The different PNM formats are: PBM (P1 or P4), PGM (P2 or P5), PPM (P3 or P6).

Icons evaluate to empty string.

`@edit'
This is a multi-line text editor field. Initial value is inserted, it can be a multiline text, too. The first parameter, if it is a string, is treated as a font name, Kaptain tries to set the editor font. The next two parameters of integer type can be specified to set the minimum width and height for the editor field, in pixels. For example, @edit("lucidatypewriter",300,200)="Hello,\nEditor!" creates an editor field of 300x200 pixels, using a nice font.

If the given font name starts with a minus sign, it is treated as an XLDF (X Logical Font Description). Note that Qt does not handle wildcards in font descriptions, nor the aliases at this time. A fully specified font looks like this:
 


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A. Reference of Modifiers

Modifiers always begin with a colon and are related to the nonterminal after which they appear. For example:

 
start :framed :horizontal -> a b c ;

means that a, b and c are placed horizontally one by one, and each is in a frame.

Modifiers usually have effect on the appearence of the dialog.

`:framed'
Makes the child widgets to appear in a frame.

`:tabbed'
Makes the child widgets to appear on different tabs.

`:horizontal'
Makes the child widgets to appear horizontal one by one, instead of the default vertical arrangement.

`:reverse'
Makes the child widgets to appear in reverse order. That is down to top if :horizontal is not present, otherwise right to left.

`:noeval'
The nonterminal will evaluate to an empty string. It is useful when you use a @string input field by a @container, and you want to have only those items which were inserted into the container.

`:double'
Place child elements in two rows or columns. It is useful when you have many radio buttons.

`:beside'
Place child elements immediately to the right of the label of this rule (if it's a radio button or check box), not below as by default. Use it in the similar situations as this:
 
number :beside "Number" -> @integer | @ ;

`:dialog'
Create a pushbutton, which if pressed, makes a subdialog to appear with the right side of the rule.

`:wizard'
Create a pushbutton, which stands for a subdialog, having all the nonterminals from the right side as pages in a so called Wizard dialog (with Next, Back, Cancel and Finish buttons). Must be on a conjunctive rule.

`:tree'
Places all children in a tree widget. If the children are also marked with :tree, they will appear on the second level in the tree. Look at the example grammar for indent. This is a very good way to place a great amount of structured information in the dialog. Checkboxes and radio buttons can appear in the tree, but if other things are present, they will be placed under or beside the QListView object. Use it with :beside if you want to create things like KControlCenter. If the label of the tree item is like {icons/my.gif}Text", then the picture mentioned between the braces will be placed beside the Text--this can be very attractive.

`:detailed'
Together with :tree, it makes a second column appear in the TreeView where the tooltip information is placed.

`:stack'
Creates a widget stack, which means all chind widgets of the corresponding rule are located in the same area, and only one is visible. To control which one is on the top of the stack (that is, visible) external communication can be used. See section 5. External Control.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Concept Index

Jump to:   A   B   C   D   E   F   G   H   I   L   M   N   P   Q   R   S   T   V   W  

Index Entry Section

A
action7. Reference of Special Symbols
Asking message5. External Control

B
Backquotes3.3 Quotations
besideA. Reference of Modifiers
button7. Reference of Special Symbols

C
Client socket2. Invoking Kaptain
close7. Reference of Special Symbols
Comments3. Grammar Scripts
Communication channels5. External Control
container7. Reference of Special Symbols
Context-free grammar1. The Concepts of Kaptain

D
detailedA. Reference of Modifiers
dialogA. Reference of Modifiers
Dialog box1. The Concepts of Kaptain
doubleA. Reference of Modifiers
Double quotes3.3 Quotations
dump7. Reference of Special Symbols

E
echo7. Reference of Special Symbols
edit7. Reference of Special Symbols
exec7. Reference of Special Symbols
execclose7. Reference of Special Symbols
External control5. External Control

F
fill7. Reference of Special Symbols
float7. Reference of Special Symbols
fork7. Reference of Special Symbols
Formal languages3.1 Grammars
framedA. Reference of Modifiers

G
Generating text3.1 Grammars
Grammar1. The Concepts of Kaptain
Grammar script1. The Concepts of Kaptain
Grammar scripts3.1 Grammars
Grammars3.1 Grammars

H
help2. Invoking Kaptain
horizontalA. Reference of Modifiers

I
icon7. Reference of Special Symbols
infile7. Reference of Special Symbols
integer7. Reference of Special Symbols

L
Language3.1 Grammars
list7. Reference of Special Symbols

M
Multiline quotes3.3 Quotations

N
No input2. Invoking Kaptain
No output2. Invoking Kaptain
noevalA. Reference of Modifiers
Nonterminal symbol3.1 Grammars

P
password7. Reference of Special Symbols
Perlish exection quotes3.3 Quotations
Perlish single quotes3.3 Quotations
Pipe2. Invoking Kaptain

Q
Quotations3.3 Quotations

R
regexp7. Reference of Special Symbols
Regular expression based substitution3.4.2 Substitutions
Regular expression's subexpression3.4.1 Regular expressions
Regular expressions3.4.1 Regular expressions
reverseA. Reference of Modifiers

S
Scripts3.1 Grammars
Sentence3.1 Grammars
Server socket2. Invoking Kaptain
Setting message5. External Control
Single quotes3.3 Quotations
Special symbol3.2 Special symbols
stackA. Reference of Modifiers
Standard input2. Invoking Kaptain
string7. Reference of Special Symbols
Subexpression3.4.1 Regular expressions
Substitution3.4.2 Substitutions

T
tabbedA. Reference of Modifiers
Terminal symbols3.1 Grammars
Test mode2. Invoking Kaptain
text7. Reference of Special Symbols
Text generation3.1 Grammars
transliteration3.4.3 Transliterations
treeA. Reference of Modifiers

V
Version2. Invoking Kaptain

W
wizardA. Reference of Modifiers

Jump to:   A   B   C   D   E   F   G   H   I   L   M   N   P   Q   R   S   T   V   W  


[Top] [Contents] [Index] [ ? ]

Table of Contents

1. The Concepts of Kaptain
2. Invoking Kaptain
3. Grammar Scripts
3.1 Grammars
3.2 Special symbols
3.3 Quotations
3.4 Regulas expressions and translations
3.4.1 Regular expressions
3.4.2 Substitutions
3.4.3 Transliterations
3.5 Using text manipulation in grammar rules
4. Examples
4.1 Sound recording
4.2 Creating archives
4.3 Calling perl
5. External Control
6. Errors
7. Reference of Special Symbols
A. Reference of Modifiers
Concept Index

[Top] [Contents] [Index] [ ? ]

Short Table of Contents

1. The Concepts of Kaptain
2. Invoking Kaptain
3. Grammar Scripts
4. Examples
5. External Control
6. Errors
7. Reference of Special Symbols
A. Reference of Modifiers
Concept Index

[Top] [Contents] [Index] [ ? ]

About this document

This document was generated using texi2html

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back previous section in reading order 1.2.2
[ > ] Forward next section in reading order 1.2.4
[ << ] FastBack previous or up-and-previous section 1.1
[ Up ] Up up section 1.2
[ >> ] FastForward next or up-and-next section 1.3
[Top] Top cover (top) of document  
[Contents] Contents table of contents  
[Index] Index concept index  
[ ? ] About this page  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
  • 1. Section One
    • 1.1 Subsection One-One
      • ...
    • 1.2 Subsection One-Two
      • 1.2.1 Subsubsection One-Two-One
      • 1.2.2 Subsubsection One-Two-Two
      • 1.2.3 Subsubsection One-Two-Three     <== Current Position
      • 1.2.4 Subsubsection One-Two-Four
    • 1.3 Subsection One-Three
      • ...
    • 1.4 Subsection One-Four


This document was generated by Terk Zsolt on September, 11 2004 using texi2html kaptain-0.73/doc/kaptain.info0000640023433300116100000014054411532667541014670 0ustar zsoltengThis is kaptain.info, produced by makeinfo version 4.13 from kaptain.texi. INFO-DIR-SECTION Utilities START-INFO-DIR-ENTRY * Kaptain: (kaptain). Universal graphical front-end. END-INFO-DIR-ENTRY This is a manual for Kaptain, the Universal Graphical Front-end. Copyright (C) 2000-2004 Zsolt Tere'k  File: kaptain.info, Node: Top, Next: The Concepts of Kaptain, Prev: (dir), Up: (dir) * Menu: * The Concepts of Kaptain:: * Invoking Kaptain:: * Grammar Scripts:: * Examples:: * External Control:: * Errors:: * Reference of Special Symbols:: * Reference of Modifiers:: * Concept Index:: Concept index.  File: kaptain.info, Node: The Concepts of Kaptain, Next: Invoking Kaptain, Prev: Top, Up: Top 1 The Concepts of Kaptain ************************* Kaptain is a universal graphical front-end. It was originally developed in order to provide a simple and efficient tool for creating dialog-based interface for command line programs. Now, its communication features allow it to serve the graphical user interface of a program without directly using a graphical library, such as GTK or Qt. When Kaptain is started, it reads a so-called grammar script. This is a text file, which contains a description in a form of a context-free grammar and optionally some other instructions. This manual refers to the input file of Kaptain as a _grammar script._ See *note Grammar Scripts:: for a complete overview on grammar script syntax. According to the grammar script, Kaptain builds a _graphical dialog box_. Certain parts of the dialog box are associated with certain elements of the grammar. This association is quite natural, thats why Kaptain's language is so easy to learn. In the dialog box, several widgets are present. These objects can be manipulated by the user--text can be entered into input fields, checkboxes can be set on and off. When a certain push button is pressed, Kaptain reads the data specified by the user in the dialog box and uses the context-free grammar to generate text. The generated text is then executed as a command, just like as if it were entered at the command prompt. Suppose we have a program named `prog' that runs in two different modes. For its first mode, an integer parameter should be given, and the second mode needs some text as parameter. An example for starting `prog' in its first mode: and in second mode Kaptain is a perfect tool for creating a graphical front-end for this program. First of all, we need to describe the possible command lines with a grammar. start -> "prog " parameter ; parameter -> "-x " @integer | "-y " @string ; The grammar in the example above is almost enough for Kaptain to build a dialog containing an integer input box and a string input field, each having a radio button. Additionally a push button is needed and some text might be specified in order to label the input fields. Given a file containing such a description, Kaptain parses the grammar and builds a dialog box. When the push button is pressed, the text is generated according to the settings of the user. The complete grammar for the program above might look like this: start -> "prog " parameter @action(start)="Ok"; parameter -> x | y ; x "First mode" -> "-x " @integer; y "Second mode" -> "-y " @string;  File: kaptain.info, Node: Invoking Kaptain, Next: Grammar Scripts, Prev: The Concepts of Kaptain, Up: Top 2 Invoking Kaptain ****************** Kaptain needs a grammar script in order to display the dialog. This is usually located in a file, and the name of that file is passed to Kaptain as an argument. The grammar script can be written to the standart input of Kaptain, too. The running mode of Kaptain can be normal or test mode. In test mode, commands are not executed, they are printed to the standard output instead. The command line of Kaptain generally looks like this: Kaptain [options] FILE If the FILE is omitted, the standard input is used as a source for the input file. Some options are used to specify running mode, while others set up different kinds of communication channels for external control. Kaptain accepts the following switches and parameters: `--version' Print out the version information of Kaptain end quit. `--help' Write a brief help on command line options. `--test' Run in test mode. This means that commands are not executed when a button is pressed, only printed to the standard output. `-V' `--verbose' Report more information on processing the input file. Internal representation of the grammar and the dialog tree is also printed. Use this flag if Kaptain does not work as expected. `-c HOST:PORT' `--client HOST:PORT' Establish communication channel as a client connecting to a server on HOST listening on PORT. `-s PORT' `--server PORT' Listen to the specified PORT and accept the first connection. This will be used as a communication channel. `-p COMMAND' `--pipe COMMAND' Start the given command and communicate with it on its standard input and output. Don't forget to quote COMMAND if it contains spaces or other metacharacters used by the shell. `--stdio' Use standard input and output for communication. In this case you must specify an input file, thus grammar script cannot be read from the standard input when it is used as a communication channel. `--no-input' Instructs Kaptain not to process messages recieved on the input channel. `--no-output' If this flag is set, Kaptain will not send any messages on its output channel. These are the possible parameters and options accepted by Kaptain called from the command prompt.  File: kaptain.info, Node: Grammar Scripts, Next: Examples, Prev: Invoking Kaptain, Up: Top 3 Grammar Scripts ***************** The input file of Kaptain is a grammar script. It contains the description of a context-free grammar in a form of rules. Beside the rules, it might also contain so-called descriptions and constraints. Comments can be placed in grammar scripts. Hashmark (`#') is a comment character, which means that all characters after the hashmark up to the end of the line are ignored together with the hashmark. This is not true if the hashmark appears inside a quoted string, see *note Quotations::. * Menu: * Grammars:: * Special symbols:: * Quotations:: * Regulas expressions and translations:: * Using text manipulation in grammar rules::  File: kaptain.info, Node: Grammars, Next: Special symbols, Prev: Grammar Scripts, Up: Grammar Scripts 3.1 Grammars ============ The program Kaptain reads an input file containing the description in the form of a context-free grammar. The concept of context-free grammar is coming form formal linguistic. A grammar is built up of several rules. Each rule contains a left hand side symbol and some symbols on the right hand side separated by an arrow: start -> "progname" options parameters ; An interpretation of a rule is the following. The symbol on the left hand side, which is a _nonterminal symbol_ is considered as the concatenation of the symbols on the right, which can be either _nonterminal_ or _terminal symbols_. In a Kaptain grammar, symbols are separated by whitespace and rules should end with a semicolon. Nonterminal symbols are similar to variables in other programming languages. Their name can contain alphanumeric characters and underscore, and should not begin with numbers. Terminal symbols are written between quotation marks. Kaptain has many ways for specifying terminal symbols, see *note Quotations:: The text generation process is an iterated application of rules on the current sentence. Starting from the nonterminal symbol `start', every step consists of an application of a rule. This means that a nonterminal symbol in the current sentence--which is the left hand side of the applied rule--is replaced by the symbols on right hand side of the rule. This process ends if there are no more nonterminal symbols in the current sentence. To illustrate text generation, let us have the following grammar: start -> "Your " animal "is " size ; animal -> "dog " ; animal -> "cat " ; size -> "big." ; size -> "small." ; Starting with the sentence `start', only the first rule can be applied. The current sentence is then `"Your " animal "is " size'. Here both `animal' and `size' is nonterminal, thus any of the rules but the first can be applied. This way exactly four different sentences can be generated by this grammar: Your dog is big. Your cat is small. Your dog is big. Your cat is small. As a syntactic simplification, different rules of the same left hand side can be written in one complex rule using `|' character as a separator of the different right hand sides. The grammar above is equivalent to the following: start -> "Your " animal "is " size ; animal -> "dog " | "cat " ; size -> "big." | "small." ; The set of sentences that can be generated using a certain grammar is called the _language_ generated by that grammar. _Formal languages_ is a branch of mathematics that deals with languages and grammars. * Menu: * Special symbols::  File: kaptain.info, Node: Special symbols, Next: Quotations, Prev: Grammars, Up: Grammar Scripts 3.2 Special symbols =================== The expression power of grammars is great. However, sometimes it is quite comlicated to express simple things. For example, the definition of numbers is quite long and messy: (Of course, it is possible to write a different grammar for the numbers, this is not a unique definition.) number -> digits ; digits -> digit digits | digit ; digit -> "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; Beside terminal and nonterminal symbols, Kaptain offers so-called _special symbols_ to appear in grammars. Special symbols always start with `@'. Such a symbol almost always refers to a widget in the dialog. For example `@integer' represents a widget, which is a rectangular area where the user can write a decimal number. The special symbol evaluates to the value that it contains at the time of the text generation process. Special symbols may accept different number of parameters and an optional initial value. The general form is as follows: @specname(param_1, param_2, ..., param_n)=initvalue If no parameters are given, the parentheses can be omitted. The same simplification can be applied to the initvalue, what's more, equality sign must not be written if no initvalue is present. The following forms are thus enabled: @specname @specname=initvalue @specname(param_1, param_2, ...) @specname(param_1, param_2, ...)=initvalue Note that the number and type of parameters is not unique, but if Kaptain cannot interpret a certain parameter in some position, then it will be simply ignored. The complete reference of special symbols can be found in *note Reference of Special Symbols::.  File: kaptain.info, Node: Quotations, Next: Regulas expressions and translations, Prev: Special symbols, Up: Grammar Scripts 3.3 Quotations ============== Quotations are the constructions for specifying a literal string, which is a terminal symbol in the grammar. Kaptain understands a great variety of quotations in order to make it possible to write character sequences in the easiest way. The possibble quotations are similar to those of the language perl and the unix shells. _Double quotes_ Strings between double quotes are weakly quoted strings. This means that some characters are treated as meta-characters. For example, backslash (\) is an escape-character. The following escape-sequences are available: `\n', `\t', `\"', `\\'. Other characters are not modified if preceeded by backslash. This way one can place double quote character inside a string: "Double quotes \" are easy to write." which stands for Double quotes " are easy to write. An other meta-character is the dollar sign ($), which is used for inserting environmental variables into strings. For example in `"$HOME/hello"' the sequence `$HELLO' is replaced by the content of the `HELLO' environmental variable. If the environmental variable name contains other characters than letters, the following form should be used: `${ANY89}'. This kind of quotation should always end on the same line it was started. If the end-of-line symbol is reached within the string, Kaptain prints a warning. _Single quotes_ Strings quoted by a single apostrophe are strongly quoted strings. This means that each character inside the string stands for itself, except the apostrophe, which always means the ending of the string. There is no way to include apostrophe in single quoted strings. 'No way to have apostrophes in this string' This kind of quotation should always end on the same line it was started. If the end-of-line symbol is reached within the string, Kaptain prints a warning. _Backquotes_ Strings in backquotes are treated in a special way. Immediately after the string is parsed, Kaptain executes the given string as a shell command, and inserts the text it has written to the standard output instead of the original string. For example, placing ``ls`' evaluates to a string which contains the file names of the current directory. An easy way to create a list box containing the available files is the following: @list(`ls`) Since command `ls' returns the files separated by a newline symbol, `@list' inserts the different lines of its parameter value as different list items. *Note Reference of Special Symbols::. The commands are passed to `/bin/sh', so any shell constructions can be given, e.g., pipes. Using backquots is a strong form of quoting: there are no special characters. As a consequence of this, no backquote (`) can appear inside. _Perlish single quotes_ Single quotes are used when no apostrophes appear in the string. Perl introduced a quotation form where the user chooses the most appropriate delimiter and any other character can be placed between the delimiters without modification. The following q%any characters except the delimiter% is evaluated to any characters except the delimiter and the delimiter character, here `%' can be replaced by any _except_ the following: letters, numbers, `;().=:_-' and whitespace. The letter `q' at the beginning stands for _quotation_. _Perlish exection quotes_ Analogous to the previous generalization of single quotes, perl generalizes backquotes using the following form: x%shell command line not containing the delimiter% which evaluates to shell command line not containing the delimiter The delimiter can be of the same set as above, and the letter `x' stands for _execution_. _Multiline quotes_ A long string spreading on more than one line is usually written using the line-delimiter construction. When Kaptain parses two less signs (`<<'), the text up to the end of the line is stored as a delimiter string and it starts to scan a quotation. The quotation is ended if a line occurs that is exactly same as the delimiter string. ... < s/Jim/Peter/g s/Joe/Peter/g tr/+/-/ @string; If the user writes Jim or Joe into the input box, it is replaced with Peter, and plus signs are changet to minus when the text is generated. You can only mention `s///' and `tr///' operations just after the arrow of a rule, but any number of such expressions can be written there. They are executed from right to left, as it is expected naturally (in my opinion).  File: kaptain.info, Node: Examples, Next: External Control, Prev: Grammar Scripts, Up: Top 4 Examples ********** If you write your own grammars, and you think they might be useful for others, please send them to me , I will put them to the main Kaptain site. * Menu: * Sound recording:: * Creating archives:: * Calling perl::  File: kaptain.info, Node: Sound recording, Next: Creating archives, Prev: Examples, Up: Examples 4.1 Sound recording =================== Let's record from the microphone connected to the computer. The command is terek@fido:~$ dd count=5 bs=8 < /dev/audio > myfile.au It would be better to see a beautiful dialog. The grammar #!/usr/local/bin/Kaptain start:framed -> "dd count=" count " bs=" size "k <" input " > " output ; count "Number of blocks" -> @integer=5 ; size "Size of blocks (k)" -> @integer=8 ; input "Input device" -> audio | dsp ; audio "Audio" -> "/dev/audio" ; dsp "DSP" -> "/dev/dsp" ; output "Output file" -> @outfile("*.au");  File: kaptain.info, Node: Creating archives, Next: Calling perl, Prev: Sound recording, Up: Examples 4.2 Creating archives ===================== Here is a simple grammar, just witten in 5 minutes (may contain errors, check before you try to use it!) #!/usr/bin/kaptn start "Tar" -> tar buttons; tar -> "tar " choice " " opt archive " " files; opt:framed :horizontal -> extropt createopt ; createopt "Write options" -> dump remove verb comp; extropt "Read options" -> noerr keep same abs; dump "Dump files, not just symlinks" -> "--dereference " | @; noerr"Ignore failed read" -> "--ignore-failed-read " | @; keep "Keep existing files" -> "-k " | @; same "Extract all protection information" -> "-p " | @; abs "Absolute path names" -> "-P " | @; remove "Remove files after adding to archive" -> "--remove-files " | @; verb "Verbosely list files proceeded" -> "-v " | @; comp -> compress | @; compress "Compression" -> gzip | bzip; gzip "gzip" -> "-z "; bzip "bzip2" -> "--use-compress-program bzip2 "; choice:framed -> work; work "Main choice" -> concat | ! create | diff | del | append | list | update | extract; concat "Append to archive" -> "A"; create "Create archive" -> "c"; diff "Find differences between archive and file system" -> "d"; del "Delete from archive" -> "-delete"; append "Append to the end of an archive" -> "r"; list "List contents" -> "t"; update "Update archive" -> "u"; extract "Extract from archive" -> "x"; archive "Archive name" -> @infile; files "Files to work with" -> @string ; buttons :horizontal -> @action(tar)="OK" @close="Cancel"; <#if output="html"> This produces a command like tar c --remove-files --use-compress-program bzip2 files.tar *.cpp *.h  File: kaptain.info, Node: Calling perl, Prev: Creating archives, Up: Examples 4.3 Calling perl ================ Kaptain can generate various texts, such as complicated pipes or a piece of perl code. To create your encrpyted password, use the perl command: print crypt('passwd','sa')."\n"; Let's make the grammar: #!/usr/local/bin/Kaptain start "Password encrypter" -> code @action("perl","-e",code)="Crypt"; code:framed -> "print crypt('" passw "','" sa q%')."\n"% ; passw "Password" -> @string="notsimple"; sa "Random chars(2)" -> @string(2)="y4"; Notice that the `@action' has three parameters; the `perl' compiler is called without the shell, having two parameters: `-e' and the evaluated text of `code';  File: kaptain.info, Node: External Control, Next: Errors, Prev: Examples, Up: Top 5 External Control ****************** This chapter describes the communication with the dialog in Kaptain. The most interesting new feature in Kaptain 0.7 is the possibility of modifying the data in the widgets while Kaptain is running. For this, Kaptain needs a communication channel, which can be some network communicaton, redirection to an other program (using pipes) or the standard input and output. On a communication channel Kaptain can recieve messages. There are two kinds of messages: 1. Setting message: This can be sent to rules that contain exactly one special symbol on the right side. A message consists of two parts: first comes a nonterminal name, which specifies the target of the message. This should be followed by a the real message (till the end of that line), which can be in fact anything that can be written after the special symbol you are refferring to by the rule. For example, having a rule like number -> @string then you can send a message like number="Hello" and the string input field will be set to the given value. Thus the general form of a _setting message_ is: nonterminal(par1,par2,...)=initvalue nonterminal=initvalue The later one is the simplified form, i.e., when no parameters are given. This was the case in the example above. For a detailed overview of the possible parameters and initial values for a given type of special symbol, *Note Reference of Special Symbols::. 2. Asking message: If a nonterminal is followed by a question mark in a message sent to Kaptain on a communication chanel, Kaptain sends back the generated text by the given nonterminal in the following form: start? <- to Kaptain start!<...here comes the generated text...> <- from kaptin This way data can be retrieved at any time from the widgets.  File: kaptain.info, Node: Errors, Next: Reference of Special Symbols, Prev: External Control, Up: Top 6 Errors ******** Kaptain reads the given file and parses the grammar according the rules in *note Grammar Scripts::. If Kaptain finds something that is not according the rules described in this manual, it either signals an error or just a warning. For example, warnings are generated if string, regular expressions, or other language constructs are opened but not closed till the end of the line. This is often handy when typoes are made in the grammar script. On the other hand, Kaptain might find syntax error, and it immediately stops. In this case, the name of the last rule that was read successfully is printed together with its line number. Thus one has to look at the errors after the last correct rule. The most usual mistake is that the closing semicolon is forgotten from the end of a rule.  File: kaptain.info, Node: Reference of Special Symbols, Next: Reference of Modifiers, Prev: Errors, Up: Top 7 Reference of Special Symbols ****************************** `@integer' creates an integer input field with up and down arrows, which can be used to increase or decrease the number in the field. Two integer parameters are accepted, these are the minimum and maximum values. Initial value can be an integer, too. For example, @integer(-10,20)=4 will create an integer input which can store a number between -10 and 20, and is initially set to 4. The minimum and maximum value default to 0 and 99, respectively, while the uninitialized field is set to 0. This object evaluates to the value of the input field. `@string' makes a one-line input field. If an integer parameter is given, the maximum length of the string is bounded by that number. For example, @string(20)="Hello" creates an input field with `Hello' inside, allowing strings of at most 20 characters. This object evaluates to the value of the input field. `@float' makes a line input field than can contain a real number. Initial value should be given in quotes if it contains other characters than numbers, for example `@float="1.13"'. This object evaluates to the value of the input field. `@regexp' Similar input field to `@string', but the regular expression parameter is used to control the string that is entered. For example, `@regexp(m/^[ab]*$/)' enables only characters `a' and `b' to be entered. Initial string value is processed if it matches the regular expression. `@password' This is identical to `@string', the only difference is that the characters are not shown; an asterix appears like in usual password input fields. `@list' `@combo' `@combow' These specials generate a list box, a combo box or a writable combo box, respectively. Each given parameter is inserted into the box if it is a number or a string. If a multi-line string occurs, every line is inserted as a separate item. Thus `@list("hello",`ls`,"bye")' creates a list box containing the files from the current directory, and two more lines: `hello' and `bye'. If the given initial value is a number, it indicates which line should initially be selected. In case of a string, the first occurrence of that string is highlighted. Finally, if a regular expression is given as an initial value, the first line matching that regular expression will be selected. If a _substitution expression_ comes in the parameter list, it is applied to the following string parameters until a new substitution parameter is reached. This is useful to make different text in the dialog box than that appears in the generated text. For example, in `@list(s/^.*://,"a:A","b:B","c:C")' only the text after the colon is inserted into the list box, and the whole string is used when the symbol is evaluated. Note that the initial value selection described in the previous paragraph is made by comparison to the original strings, not the modified ones that appear on the screen. The `@list' and `@combo' objects evaluate to the line from which the currently selected line was generated using substitutions. The `@combow' evaluates the line in the combo widget. `@button' Places a simple push button with label given as initial value. The label can be an image, if a filename is given in braces, like `@button="{ok.png}"'. creates a push button using the given initial value. If the value is in the form of `"{FILENAME}"', then it is considered to be a pixmap file, otherwise the initial value is used as a text label. For example `@button="OK"' creates a simple push button with label `OK'. One push button in a dialog can be the default button: This can be achieved by putting a space to the beginning of its name. For example, a default ok button is created for the following code: `@button=" OK"'. `@close' Creates a button, which closes the current dialog when pressed. `@action' _Synchronous execution._ When this button is pressed, the given command is executed. During the execution, the button is disabled. `@fork' _Asynchronous execution._ When this button is pressed, the given command is started in the background, without any effect to the dialog. `@exec' _Final execution._ When this button is pressed, the given command is started and Kaptain quits immediately. `@execclose' This is similar to `@exec', the only difference is that Kaptain only closes the current dialog. In the topmost dialog, this has the same effect as `@exec', since Kaptain quits when it closes the topmost dialog. `@echo' Creates a button, which causes the generated text to be printed to the standard output. `@dump' Creates a similar button to `@echo', but Kaptain quits after printing the generated text to the standard output. `@execbuffer' This button causes the synchronous execution of the given command, when pressed. The standard output of the executed command is captured and stored. Later, this symbol evaluates to the stored text. This is the only button-like special that can evaluate to nonempty text. `@preview' Creates a push button, which shows up a new dialog when pressed. The new dialog contains the code generated for a given nonterminal. The accepted parameters are the following: the nonterminal,font descriptor(string), minimum width and height (integers) and the closing button's text. @preview(start,"Lucidatypewriter",300,200,"Close") `@infile' `@outfile' `@directory' These special symbols generate a line input field together with a push button. When the button is pressed, a file or directory choosing dialog appears. The name of file selected by the user is then inserted into the input field. `@infile' stands for a _file open dialog_, while `@outfile' for _file saving dialog._ Using `@directory', one can select an existing _directory._ The initial value given to these symbols is inserted to the input field at startup. When the button is pressed, the dialog is starting on the file/directory currently specified in the input field, if exists. The file-like specials (`@infile', `@outfile') accept one string argument. It can be a _filter_ for the file selection dialog. An example for a multiple filter is the following: The separators between filter groups can be either double semicolons or newline characters. A complete example for `@infile': If no filter is specified, all files can be selected. In case of no initial value, the current directory is the starting point. These items evaluate to the text in the input field. `@container' Creates _two buttons_ and a _list box_. The first parameter should be a nonterminal symbol, the following two strings are interpreted as the labels for the buttons. When the first button is pressed, the given nonterminal symbol is evaluated, and the generated text is inserted as a line into the list box. When the second button is pressed, the current line is removed from the list box. Button names default to `Add' and `Remove'. This object is useful in cases when recursion is needed in the grammar. (In Kaptain, recursion is forbidden.) For example, if one or more file name is needed, one can write this: filename -> @infile; box -> @container(filename); The container evaluates to its contents, its lines are simply concatenated. `@multcol' Creates a multi-column table with the given data filled. If the first parameter is a regular expression (`m/.../'), all the following string parameters are matched against this expression. Each such string parameter stands for one line, which is separated according to the regular expression.The subexpressions matched form the columns of the given row. If there is no regular expression, the rows are separated at the tab characters. The forthcoming string parameters are the rows of the table, except the first one, which is specially the header. Initial value, if an integer is given determines the selected element in the table. The `@multicol' special symbol generates to the content of the selected row. @multicol("Header 1\tHeader 2","data\tdata\tdata","abc")=1; @multicol(m/([^ ]+) ([^ ]+) ([^ ]+)/,"1 2 3","a b c", "xx yy zz")=0; `@fill' Inserts some stretchable space into the dialog. No other functionality, evaluates to empty string. `@text' This special symbol creates slightly sunken box in the dialog with the given text inside. The text to be displayed is the concatenation of the initial value and all the string parameters. Since it has no functions, it is only good for informing the user. This object evaluates to the empty string. `@icon' Displays an image in the dialog. The first parameter should be string, which is the name of a graphic file. Several file formats are recognized. From Qt's manual: Qt currently supports the following image file formats: PNG, BMP, XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if specially configured during compilation. The different PNM formats are: PBM (P1 or P4), PGM (P2 or P5), PPM (P3 or P6). Icons evaluate to empty string. `@edit' This is a multi-line text editor field. Initial value is inserted, it can be a multiline text, too. The first parameter, if it is a string, is treated as a font name, Kaptain tries to set the editor font. The next two parameters of integer type can be specified to set the minimum width and height for the editor field, in pixels. For example, `@edit("lucidatypewriter",300,200)="Hello,\nEditor!"' creates an editor field of 300x200 pixels, using a nice font. If the given font name starts with a minus sign, it is treated as an XLDF (X Logical Font Description). Note that Qt does not handle wildcards in font descriptions, nor the aliases at this time. A fully specified font looks like this:  File: kaptain.info, Node: Reference of Modifiers, Next: Concept Index, Prev: Reference of Special Symbols, Up: Top Appendix A Reference of Modifiers ********************************* Modifiers always begin with a colon and are related to the nonterminal after which they appear. For example: start :framed :horizontal -> a b c ; means that a, b and c are placed horizontally one by one, and each is in a frame. Modifiers usually have effect on the appearence of the dialog. `:framed' Makes the child widgets to appear in a frame. `:tabbed' Makes the child widgets to appear on different tabs. `:horizontal' Makes the child widgets to appear horizontal one by one, instead of the default vertical arrangement. `:reverse' Makes the child widgets to appear in reverse order. That is down to top if `:horizontal' is not present, otherwise right to left. `:noeval' The nonterminal will evaluate to an empty string. It is useful when you use a @string input field by a @container, and you want to have only those items which were inserted into the container. `:double' Place child elements in two rows or columns. It is useful when you have many radio buttons. `:beside' Place child elements immediately to the right of the label of this rule (if it's a radio button or check box), not below as by default. Use it in the similar situations as this: number :beside "Number" -> @integer | @ ; `:dialog' Create a pushbutton, which if pressed, makes a subdialog to appear with the right side of the rule. `:wizard' Create a pushbutton, which stands for a subdialog, having all the nonterminals from the right side as pages in a so called _Wizard_ dialog (with _Next_, _Back_, _Cancel_ and _Finish_ buttons). Must be on a conjunctive rule. `:tree' Places all children in a tree widget. If the children are also marked with :tree, they will appear on the second level in the tree. Look at the example grammar for indent. This is a very good way to place a great amount of structured information in the dialog. Checkboxes and radio buttons can appear in the tree, but if other things are present, they will be placed under or beside the QListView object. Use it with :beside if you want to create things like KControlCenter. If the label of the tree item is like `{icons/my.gif}Text"', then the picture mentioned between the braces will be placed beside the Text--this can be very attractive. `:detailed' Together with `:tree', it makes a second column appear in the TreeView where the tooltip information is placed. `:stack' Creates a widget stack, which means all chind widgets of the corresponding rule are located in the same area, and only one is visible. To control which one is on the top of the stack (that is, visible) external communication can be used. *Note External Control::.  File: kaptain.info, Node: Concept Index, Prev: Reference of Modifiers, Up: Top Concept Index ************* [index] * Menu: * action: Reference of Special Symbols. (line 97) * Asking message: External Control. (line 39) * Backquotes: Quotations. (line 46) * beside: Reference of Modifiers. (line 40) * button: Reference of Special Symbols. (line 80) * Client socket: Invoking Kaptain. (line 41) * close: Reference of Special Symbols. (line 94) * Comments: Grammar Scripts. (line 14) * Communication channels: External Control. (line 6) * container: Reference of Special Symbols. (line 166) * Context-free grammar: The Concepts of Kaptain. (line 16) * detailed: Reference of Modifiers. (line 68) * dialog: Reference of Modifiers. (line 46) * Dialog box: The Concepts of Kaptain. (line 21) * double: Reference of Modifiers. (line 36) * Double quotes: Quotations. (line 13) * dump: Reference of Special Symbols. (line 120) * echo: Reference of Special Symbols. (line 116) * edit: Reference of Special Symbols. (line 226) * exec: Reference of Special Symbols. (line 106) * execclose: Reference of Special Symbols. (line 110) * External control: External Control. (line 6) * fill: Reference of Special Symbols. (line 202) * float: Reference of Special Symbols. (line 30) * fork: Reference of Special Symbols. (line 101) * Formal languages: Grammars. (line 60) * framed: Reference of Modifiers. (line 17) * Generating text: Grammars. (line 31) * Grammar: The Concepts of Kaptain. (line 16) * Grammar script: The Concepts of Kaptain. (line 16) * Grammar scripts: Grammars. (line 6) * Grammars: Grammars. (line 6) * help: Invoking Kaptain. (line 27) * horizontal: Reference of Modifiers. (line 23) * icon: Reference of Special Symbols. (line 214) * infile: Reference of Special Symbols. (line 139) * integer: Reference of Special Symbols. (line 7) * Language: Grammars. (line 60) * list: Reference of Special Symbols. (line 49) * Multiline quotes: Quotations. (line 89) * No input: Invoking Kaptain. (line 61) * No output: Invoking Kaptain. (line 65) * noeval: Reference of Modifiers. (line 31) * Nonterminal symbol: Grammars. (line 20) * password: Reference of Special Symbols. (line 44) * Perlish exection quotes: Quotations. (line 80) * Perlish single quotes: Quotations. (line 66) * Pipe: Invoking Kaptain. (line 51) * Quotations: Quotations. (line 6) * regexp: Reference of Special Symbols. (line 37) * Regular expression based substitution: Substitutions. (line 6) * Regular expression's subexpression: Regular expressions. (line 23) * Regular expressions: Regular expressions. (line 6) * reverse: Reference of Modifiers. (line 27) * Scripts: Grammars. (line 6) * Sentence: Grammars. (line 60) * Server socket: Invoking Kaptain. (line 46) * Setting message: External Control. (line 17) * Single quotes: Quotations. (line 35) * Special symbol: Special symbols. (line 16) * stack: Reference of Modifiers. (line 72) * Standard input: Invoking Kaptain. (line 56) * string: Reference of Special Symbols. (line 20) * Subexpression: Regular expressions. (line 23) * Substitution: Substitutions. (line 6) * tabbed: Reference of Modifiers. (line 20) * Terminal symbols: Grammars. (line 23) * Test mode: Invoking Kaptain. (line 30) * text: Reference of Special Symbols. (line 206) * Text generation: Grammars. (line 31) * transliteration: Transliterations. (line 6) * tree: Reference of Modifiers. (line 56) * Version: Invoking Kaptain. (line 24) * wizard: Reference of Modifiers. (line 50)  Tag Table: Node: Top317 Node: The Concepts of Kaptain640 Node: Invoking Kaptain3354 Node: Grammar Scripts5779 Node: Grammars6554 Node: Special symbols9343 Node: Quotations11155 Node: Regulas expressions and translations16029 Node: Regular expressions16733 Node: Substitutions18160 Node: Transliterations19352 Node: Using text manipulation in grammar rules19680 Node: Examples20543 Node: Sound recording20909 Node: Creating archives21610 Node: Calling perl23512 Node: External Control24268 Node: Errors26340 Node: Reference of Special Symbols27266 Node: Reference of Modifiers37849 Node: Concept Index40860  End Tag Table kaptain-0.73/doc/kaptain.texi0000640023433300116100000012724211532667302014701 0ustar zsolteng\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename kaptain.info @settitle Kaptain @dircategory Utilities @direntry * Kaptain: (kaptain). Universal graphical front-end. @end direntry @finalout @c %**end of header @c @setchapternewpage odd @c @iftex @c \input epsf @c @end iftex @ifinfo This is a manual for Kaptain, the Universal Graphical Front-end. Copyright @copyright{} 2000-2004 Zsolt Ter@'{e}k @end ifinfo @titlepage @title Kaptain @subtitle Universal Graphical Front-end, version 0.72 @author Zsolt Ter@'{e}k @page @vskip 0pt plus 1filll Copyright @copyright{} 2000-2004 Zsolt Ter@'{e}k Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. @end titlepage @node Top, The Concepts of Kaptain, (dir), (dir) @comment node-name, next, previous, up @menu * The Concepts of Kaptain:: * Invoking Kaptain:: * Grammar Scripts:: * Examples:: * External Control:: * Errors:: * Reference of Special Symbols:: * Reference of Modifiers:: * Concept Index:: Concept index. @end menu @ifhtml This is a manual for Kaptain, the Universal Graphical Front-end. Copyright @copyright{} 2000-2004 Zsolt Terk @end ifhtml @node The Concepts of Kaptain, Invoking Kaptain, Top, Top @comment node-name, next, previous, up @chapter The Concepts of Kaptain Kaptain is a universal graphical front-end. It was originally developed in order to provide a simple and efficient tool for creating dialog-based interface for command line programs. Now, its communication features allow it to serve the graphical user interface of a program without directly using a graphical library, such as GTK or Qt. When Kaptain is started, it reads a so-called grammar script. This is a text file, which contains a description in a form of a context-free grammar and optionally some other instructions. This manual refers to the input file of Kaptain as a @emph{grammar script.} See @ref{Grammar Scripts} for a complete overview on grammar script syntax. @cindex Context-free grammar @cindex Grammar @cindex Grammar script According to the grammar script, Kaptain builds a @emph{graphical dialog box}. Certain parts of the dialog box are associated with certain elements of the grammar. This association is quite natural, thats why Kaptain's language is so easy to learn. @cindex Dialog box In the dialog box, several widgets are present. These objects can be manipulated by the user---text can be entered into input fields, checkboxes can be set on and off. When a certain push button is pressed, Kaptain reads the data specified by the user in the dialog box and uses the context-free grammar to generate text. The generated text is then executed as a command, just like as if it were entered at the command prompt. Suppose we have a program named @code{prog} that runs in two different modes. For its first mode, an integer parameter should be given, and the second mode needs some text as parameter. An example for starting @code{prog} in its first mode: @example prog -x 12 @end example @noindent and in second mode @example prog -y 'hello' @end example @noindent Kaptain is a perfect tool for creating a graphical front-end for this program. First of all, we need to describe the possible command lines with a grammar. @example start -> "prog " parameter ; parameter -> "-x " @@integer | "-y " @@string ; @end example The grammar in the example above is almost enough for Kaptain to build a dialog containing an integer input box and a string input field, each having a radio button. Additionally a push button is needed and some text might be specified in order to label the input fields. Given a file containing such a description, Kaptain parses the grammar and builds a dialog box. When the push button is pressed, the text is generated according to the settings of the user. The complete grammar for the program above might look like this: @example start -> "prog " parameter @@action(start)="Ok"; parameter -> x | y ; x "First mode" -> "-x " @@integer; y "Second mode" -> "-y " @@string; @end example @c @iftex @c @tex @c $$\epsfbox{fig1.eps}$$ @c @end tex @c According to the settings in the figure, the generated text is @c @samp{prog -x 0}, since the first radio button is selected. @c @end iftex @ifhtml @html @end html According to the settings in the figure, the generated text is @samp{prog -x 0}, since the first radio button is selected. @end ifhtml @node Invoking Kaptain, Grammar Scripts, The Concepts of Kaptain, Top @comment node-name, next, previous, up @chapter Invoking Kaptain Kaptain needs a grammar script in order to display the dialog. This is usually located in a file, and the name of that file is passed to Kaptain as an argument. The grammar script can be written to the standart input of Kaptain, too. The running mode of Kaptain can be normal or test mode. In test mode, commands are not executed, they are printed to the standard output instead. The command line of Kaptain generally looks like this: @example Kaptain @r{[options]} @var{file} @end example @noindent If the @var{file} is omitted, the standard input is used as a source for the input file. Some options are used to specify running mode, while others set up different kinds of communication channels for external control. Kaptain accepts the following switches and parameters: @table @samp @c @item --author @c @itemx --about @item --version @cindex Version Print out the version information of Kaptain end quit. @item --help @cindex help Write a brief help on command line options. @item --test @cindex Test mode Run in test mode. This means that commands are not executed when a button is pressed, only printed to the standard output. @item -V @itemx --verbose @c @itemx --debug Report more information on processing the input file. Internal representation of the grammar and the dialog tree is also printed. Use this flag if Kaptain does not work as expected. @item -c @var{host:port} @itemx --client @var{host:port} @cindex Client socket Establish communication channel as a client connecting to a server on @var{host} listening on @var{port.} @item -s @var{port} @itemx --server @var{port} @cindex Server socket Listen to the specified @var{port} and accept the first connection. This will be used as a communication channel. @item -p @var{command} @itemx --pipe @var{command} @cindex Pipe Start the given command and communicate with it on its standard input and output. Don't forget to quote @var{command} if it contains spaces or other metacharacters used by the shell. @item --stdio @cindex Standard input Use standard input and output for communication. In this case you must specify an input file, thus grammar script cannot be read from the standard input when it is used as a communication channel. @item --no-input @cindex No input Instructs Kaptain not to process messages received on the input channel. @item --no-output @cindex No output If this flag is set, Kaptain will not send any messages on its output channel. @end table These are the possible parameters and options accepted by Kaptain called from the command prompt. @node Grammar Scripts, Examples, Invoking Kaptain, Top @comment node-name, next, previous, up @chapter Grammar Scripts The input file of Kaptain is a grammar script. It contains the description of a context-free grammar in a form of rules. Beside the rules, it might also contain so-called descriptions and constraints. Comments can be placed in grammar scripts. Hashmark (@samp{#}) is a comment character, which means that all characters after the hashmark up to the end of the line are ignored together with the hashmark. This is not true if the hashmark appears inside a quoted string, see @ref{Quotations}. @cindex Comments @menu * Grammars:: * Special symbols:: * Quotations:: * Regulas expressions and translations:: * Using text manipulation in grammar rules:: @end menu @node Grammars, Special symbols, Grammar Scripts, Grammar Scripts @comment node-name, next, previous, up @section Grammars @cindex Grammars @cindex Scripts @cindex Grammar scripts The program Kaptain reads an input file containing the description in the form of a context-free grammar. The concept of context-free grammar is coming form formal linguistic. A grammar is built up of several rules. Each rule contains a left hand side symbol and some symbols on the right hand side separated by an arrow: @example start -> "progname" options parameters ; @end example An interpretation of a rule is the following. The symbol on the left hand side, which is a @emph{nonterminal symbol} is considered as the concatenation of the symbols on the right, which can be either @emph{nonterminal} or @emph{terminal symbols}. In a Kaptain grammar, symbols are separated by whitespace and rules should end with a semicolon. Nonterminal symbols are similar to variables in other programming languages. Their name can contain alphanumeric characters and underscore, and should not begin with numbers. @cindex Nonterminal symbol Terminal symbols are written between quotation marks. Kaptain has many ways for specifying terminal symbols, see @ref{Quotations} @cindex Terminal symbols The text generation process is an iterated application of rules on the current sentence. Starting from the nonterminal symbol @samp{start}, every step consists of an application of a rule. This means that a nonterminal symbol in the current sentence---which is the left hand side of the applied rule---is replaced by the symbols on right hand side of the rule. This process ends if there are no more nonterminal symbols in the current sentence. @cindex Text generation @cindex Generating text To illustrate text generation, let us have the following grammar: @example start -> "Your " animal "is " size ; animal -> "dog " ; animal -> "cat " ; size -> "big." ; size -> "small." ; @end example Starting with the sentence @samp{start}, only the first rule can be applied. The current sentence is then @samp{"Your " animal "is " size}. Here both @samp{animal} and @samp{size} is nonterminal, thus any of the rules but the first can be applied. This way exactly four different sentences can be generated by this grammar: @example Your dog is big. Your cat is small. Your dog is big. Your cat is small. @end example As a syntactic simplification, different rules of the same left hand side can be written in one complex rule using @samp{|} character as a separator of the different right hand sides. The grammar above is equivalent to the following: @example start -> "Your " animal "is " size ; animal -> "dog " | "cat " ; size -> "big." | "small." ; @end example The set of sentences that can be generated using a certain grammar is called the @emph{language} generated by that grammar. @emph{Formal languages} is a branch of mathematics that deals with languages and grammars. @cindex Formal languages @cindex Language @cindex Sentence @menu * Special symbols:: @end menu @node Special symbols, Quotations, Grammars, Grammar Scripts @comment node-name, next, previous, up @section Special symbols The expression power of grammars is great. However, sometimes it is quite comlicated to express simple things. For example, the definition of numbers is quite long and messy: (Of course, it is possible to write a different grammar for the numbers, this is not a unique definition.) @example number -> digits ; digits -> digit digits | digit ; digit -> "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; @end example Beside terminal and nonterminal symbols, Kaptain offers so-called @emph{special symbols} to appear in grammars. @cindex Special symbol Special symbols always start with @samp{@@}. Such a symbol almost always refers to a widget in the dialog. For example @samp{@@integer} represents a widget, which is a rectangular area where the user can write a decimal number. The special symbol evaluates to the value that it contains at the time of the text generation process. Special symbols may accept different number of parameters and an optional initial value. The general form is as follows: @example @@specname(param_1, param_2, ..., param_n)=initvalue @end example If no parameters are given, the parentheses can be omitted. The same simplification can be applied to the initvalue, what's more, equality sign must not be written if no initvalue is present. The following forms are thus enabled: @example @@specname @@specname=initvalue @@specname(param_1, param_2, ...) @@specname(param_1, param_2, ...)=initvalue @end example @noindent Note that the number and type of parameters is not unique, but if Kaptain cannot interpret a certain parameter in some position, then it will be simply ignored. The complete reference of special symbols can be found in @ref{Reference of Special Symbols}. @node Quotations, Regulas expressions and translations, Special symbols, Grammar Scripts @comment node-name, next, previous, up @section Quotations @cindex Quotations Quotations are the constructions for specifying a literal string, which is a terminal symbol in the grammar. Kaptain understands a great variety of quotations in order to make it possible to write character sequences in the easiest way. The possibble quotations are similar to those of the language perl and the unix shells. @table @emph @item Double quotes @cindex Double quotes Strings between double quotes are weakly quoted strings. This means that some characters are treated as meta-characters. For example, backslash (\) is an escape-character. The following escape-sequences are available: @code{\n}, @code{\t}, @code{\"}, @code{\\}. Other characters are not modified if preceeded by backslash. This way one can place double quote character inside a string: @example "Double quotes \" are easy to write." @end example which stands for @example Double quotes " are easy to write. @end example An other meta-character is the dollar sign ($), which is used for inserting environmental variables into strings. For example in @code{"$HOME/hello"} the sequence @code{$HELLO} is replaced by the content of the @code{HELLO} environmental variable. If the environmental variable name contains other characters than letters, the following form should be used: @code{$@{ANY89@}}. This kind of quotation should always end on the same line it was started. If the end-of-line symbol is reached within the string, Kaptain prints a warning. @item Single quotes @cindex Single quotes Strings quoted by a single apostrophe are strongly quoted strings. This means that each character inside the string stands for itself, except the apostrophe, which always means the ending of the string. There is no way to include apostrophe in single quoted strings. @example 'No way to have apostrophes in this string' @end example This kind of quotation should always end on the same line it was started. If the end-of-line symbol is reached within the string, Kaptain prints a warning. @item Backquotes @cindex Backquotes Strings in backquotes are treated in a special way. Immediately after the string is parsed, Kaptain executes the given string as a shell command, and inserts the text it has written to the standard output instead of the original string. For example, placing @code{`ls`} evaluates to a string which contains the file names of the current directory. An easy way to create a list box containing the available files is the following: @example @@list(`ls`) @end example Since command @code{ls} returns the files separated by a newline symbol, @samp{@@list} inserts the different lines of its parameter value as different list items. @xref{Reference of Special Symbols}. The commands are passed to @samp{/bin/sh}, so any shell constructions can be given, e.g., pipes. Using backquots is a strong form of quoting: there are no special characters. As a consequence of this, no backquote (`) can appear inside. @item Perlish single quotes @cindex Perlish single quotes Single quotes are used when no apostrophes appear in the string. Perl introduced a quotation form where the user chooses the most appropriate delimiter and any other character can be placed between the delimiters without modification. The following @example q%any characters except the delimiter% @end example is evaluated to @example any characters except the delimiter @end example and the delimiter character, here @code{%} can be replaced by any @emph{except} the following: letters, numbers, @code{;().=:_-} and whitespace. The letter @samp{q} at the beginning stands for @emph{quotation}. @item Perlish exection quotes @cindex Perlish exection quotes Analogous to the previous generalization of single quotes, perl generalizes backquotes using the following form: @example x%shell command line not containing the delimiter% @end example which evaluates to @example shell command line not containing the delimiter @end example The delimiter can be of the same set as above, and the letter @samp{x} stands for @emph{execution}. @item Multiline quotes @cindex Multiline quotes A long string spreading on more than one line is usually written using the line-delimiter construction. When Kaptain parses two less signs (@code{<<}), the text up to the end of the line is stored as a delimiter string and it starts to scan a quotation. The quotation is ended if a line occurs that is exactly same as the delimiter string. @example ... < s/Jim/Peter/g s/Joe/Peter/g tr/+/-/ @@string; @end example If the user writes Jim or Joe into the input box, it is replaced with Peter, and plus signs are changet to minus when the text is generated. You can only mention @code{s///} and @code{tr///} operations just after the arrow of a rule, but any number of such expressions can be written there. They are executed from right to left, as it is expected naturally (in my opinion). @node Examples, External Control, Grammar Scripts, Top @comment node-name, next, previous, up @chapter Examples @c @ifhtml @c @html @c @c @end html @c @end ifhtml If you write your own grammars, and you think they might be useful for others, please send them to me @email{terek@@users.sourceforge.net}, I will put them to the main Kaptain site. @menu * Sound recording:: * Creating archives:: * Calling perl:: @end menu @node Sound recording, Creating archives, Examples, Examples @section Sound recording Let's record from the microphone connected to the computer. The command is @example terek@@fido:~$ dd count=5 bs=8 < /dev/audio > myfile.au @end example It would be better to see a beautiful dialog. The grammar @example #!/usr/local/bin/Kaptain start:framed -> "dd count=" count " bs=" size "k <" input " > " output ; count "Number of blocks" -> @@integer=5 ; size "Size of blocks (k)" -> @@integer=8 ; input "Input device" -> audio | dsp ; audio "Audio" -> "/dev/audio" ; dsp "DSP" -> "/dev/dsp" ; output "Output file" -> @@outfile("*.au"); @end example @ifhtml @html @end html @end ifhtml @node Creating archives, Calling perl, Sound recording, Examples @section Creating archives Here is a simple grammar, just witten in 5 minutes (may contain errors, check before you try to use it!) @example #!/usr/bin/kaptn start "Tar" -> tar buttons; tar -> "tar " choice " " opt archive " " files; opt:framed :horizontal -> extropt createopt ; createopt "Write options" -> dump remove verb comp; extropt "Read options" -> noerr keep same abs; dump "Dump files, not just symlinks" -> "--dereference " | @@; noerr"Ignore failed read" -> "--ignore-failed-read " | @@; keep "Keep existing files" -> "-k " | @@; same "Extract all protection information" -> "-p " | @@; abs "Absolute path names" -> "-P " | @@; remove "Remove files after adding to archive" -> "--remove-files " | @@; verb "Verbosely list files proceeded" -> "-v " | @@; comp -> compress | @@; compress "Compression" -> gzip | bzip; gzip "gzip" -> "-z "; bzip "bzip2" -> "--use-compress-program bzip2 "; choice:framed -> work; work "Main choice" -> concat | ! create | diff | del | append | list | update | extract; concat "Append to archive" -> "A"; create "Create archive" -> "c"; diff "Find differences between archive and file system" -> "d"; del "Delete from archive" -> "-delete"; append "Append to the end of an archive" -> "r"; list "List contents" -> "t"; update "Update archive" -> "u"; extract "Extract from archive" -> "x"; archive "Archive name" -> @@infile; files "Files to work with" -> @@string ; buttons :horizontal -> @@action(tar)="OK" @@close="Cancel"; @end example @ifhtml @html It looks like this: @end html @end ifhtml <#if output="html"> This produces a command like @example tar c --remove-files --use-compress-program bzip2 files.tar *.cpp *.h @end example @node Calling perl, , Creating archives, Examples @section Calling perl Kaptain can generate various texts, such as complicated pipes or a piece of perl code. To create your encrpyted password, use the perl command: @example print crypt('passwd','sa')."\n"; @end example Let's make the grammar: @example #!/usr/local/bin/Kaptain start "Password encrypter" -> code @@action("perl","-e",code)="Crypt"; code:framed -> "print crypt('" passw "','" sa q%')."\n"% ; passw "Password" -> @@string="notsimple"; sa "Random chars(2)" -> @@string(2)="y4"; @end example Notice that the @code{@@action} has three parameters; the @code{perl} compiler is called without the shell, having two parameters: @code{-e} and the evaluated text of @code{code}; @ifhtml @html Simple but great: @end html @end ifhtml @node External Control, Errors, Examples, Top @comment node-name, next, previous, up @chapter External Control @cindex External control @cindex Communication channels This chapter describes the communication with the dialog in Kaptain. The most interesting new feature in Kaptain 0.7 is the possibility of modifying the data in the widgets while Kaptain is running. For this, Kaptain needs a communication channel, which can be some network communicaton, redirection to an other program (using pipes) or the standard input and output. On a communication channel Kaptain can recieve messages. There are two kinds of messages: @enumerate @item Setting message: @cindex Setting message This can be sent to rules that contain exactly one special symbol on the right side. A message consists of two parts: first comes a nonterminal name, which specifies the target of the message. This should be followed by a the real message (till the end of that line), which can be in fact anything that can be written after the special symbol you are refferring to by the rule. For example, having a rule like @example number -> @@string @end example then you can send a message like @example number="Hello" @end example and the string input field will be set to the given value. Thus the general form of a @emph{setting message} is: @example nonterminal(par1,par2,...)=initvalue nonterminal=initvalue @end example The later one is the simplified form, i.e., when no parameters are given. This was the case in the example above. For a detailed overview of the possible parameters and initial values for a given type of special symbol, @xref{Reference of Special Symbols}. @item Asking message: @cindex Asking message If a nonterminal is followed by a question mark in a message sent to Kaptain on a communication chanel, Kaptain sends back the generated text by the given nonterminal in the following form: @example start? <- to Kaptain start!<...here comes the generated text...> <- from kaptin @end example This way data can be retrieved at any time from the widgets. @end enumerate @node Errors, Reference of Special Symbols, External Control, Top @comment node-name, next, previous, up @chapter Errors Kaptain reads the given file and parses the grammar according the rules in @ref{Grammar Scripts}. If Kaptain finds something that is not according the rules described in this manual, it either signals an error or just a warning. For example, warnings are generated if string, regular expressions, or other language constructs are opened but not closed till the end of the line. This is often handy when typoes are made in the grammar script. On the other hand, Kaptain might find syntax error, and it immediately stops. In this case, the name of the last rule that was read successfully is printed together with its line number. Thus one has to look at the errors after the last correct rule. The most usual mistake is that the closing semicolon is forgotten from the end of a rule. @node Reference of Special Symbols, Reference of Modifiers, Errors, Top @comment node-name, next, previous, up @chapter Reference of Special Symbols @table @samp @item @@integer @cindex integer creates an integer input field with up and down arrows, which can be used to increase or decrease the number in the field. Two integer parameters are accepted, these are the minimum and maximum values. Initial value can be an integer, too. For example, @example @@integer(-10,20)=4 @end example @noindent will create an integer input which can store a number between -10 and 20, and is initially set to 4. The minimum and maximum value default to 0 and 99, respectively, while the uninitialized field is set to 0. This object evaluates to the value of the input field. @item @@string @cindex string makes a one-line input field. If an integer parameter is given, the maximum length of the string is bounded by that number. For example, @example @@string(20)="Hello" @end example @noindent creates an input field with @samp{Hello} inside, allowing strings of at most 20 characters. This object evaluates to the value of the input field. @item @@float @cindex float makes a line input field than can contain a real number. Initial value should be given in quotes if it contains other characters than numbers, for example @code{@@float="1.13"}. This object evaluates to the value of the input field. @item @@regexp @cindex regexp Similar input field to @code{@@string}, but the regular expression parameter is used to control the string that is entered. For example, @code{@@regexp(m/^[ab]*$/)} enables only characters @code{a} and @code{b} to be entered. Initial string value is processed if it matches the regular expression. @item @@password @cindex password This is identical to @samp{@@string}, the only difference is that the characters are not shown; an asterix appears like in usual password input fields. @item @@list @cindex list @itemx @@combo @itemx @@combow These specials generate a list box, a combo box or a writable combo box, respectively. Each given parameter is inserted into the box if it is a number or a string. If a multi-line string occurs, every line is inserted as a separate item. Thus @code{@@list("hello",`ls`,"bye")} creates a list box containing the files from the current directory, and two more lines: @samp{hello} and @samp{bye}. If the given initial value is a number, it indicates which line should initially be selected. In case of a string, the first occurrence of that string is highlighted. Finally, if a regular expression is given as an initial value, the first line matching that regular expression will be selected. If a @emph{substitution expression} comes in the parameter list, it is applied to the following string parameters until a new substitution parameter is reached. This is useful to make different text in the dialog box than that appears in the generated text. For example, in @code{@@list(s/^.*://,"a:A","b:B","c:C")} only the text after the colon is inserted into the list box, and the whole string is used when the symbol is evaluated. Note that the initial value selection described in the previous paragraph is made by comparison to the original strings, not the modified ones that appear on the screen. The @code{@@list} and @code{@@combo} objects evaluate to the line from which the currently selected line was generated using substitutions. The @code{@@combow} evaluates the line in the combo widget. @c buttons ------------------------------------------------------------- @item @@button @cindex button Places a simple push button with label given as initial value. The label can be an image, if a filename is given in braces, like @code{@@button="@{ok.png@}"}. creates a push button using the given initial value. If the value is in the form of @code{"@{@var{filename}@}"}, then it is considered to be a pixmap file, otherwise the initial value is used as a text label. For example @code{@@button="OK"} creates a simple push button with label @samp{OK}. One push button in a dialog can be the default button: This can be achieved by putting a space to the beginning of its name. For example, a default ok button is created for the following code: @code{@@button=" OK"}. @item @@close @cindex close Creates a button, which closes the current dialog when pressed. @item @@action @cindex action @emph{Synchronous execution.} When this button is pressed, the given command is executed. During the execution, the button is disabled. @item @@fork @cindex fork @emph{Asynchronous execution.} When this button is pressed, the given command is started in the background, without any effect to the dialog. @item @@exec @cindex exec @emph{Final execution.} When this button is pressed, the given command is started and Kaptain quits immediately. @item @@execclose @cindex execclose This is similar to @samp{@@exec}, the only difference is that Kaptain only closes the current dialog. In the topmost dialog, this has the same effect as @samp{@@exec}, since Kaptain quits when it closes the topmost dialog. @item @@echo @cindex echo Creates a button, which causes the generated text to be printed to the standard output. @item @@dump @cindex dump Creates a similar button to @samp{@@echo}, but Kaptain quits after printing the generated text to the standard output. @itemx @@execbuffer This button causes the synchronous execution of the given command, when pressed. The standard output of the executed command is captured and stored. Later, this symbol evaluates to the stored text. This is the only button-like special that can evaluate to nonempty text. @itemx @@preview Creates a push button, which shows up a new dialog when pressed. The new dialog contains the code generated for a given nonterminal. The accepted parameters are the following: the nonterminal,font descriptor(string), minimum width and height (integers) and the closing button's text. @example @@preview(start,"Lucidatypewriter",300,200,"Close") @end example @c end buttons --------------------------------------------------------- @item @@infile @cindex infile @itemx @@outfile @itemx @@directory These special symbols generate a line input field together with a push button. When the button is pressed, a file or directory choosing dialog appears. The name of file selected by the user is then inserted into the input field. @code{@@infile} stands for a @emph{file open dialog}, while @code{@@outfile} for @emph{file saving dialog.} Using @code{@@directory}, one can select an existing @emph{directory.} The initial value given to these symbols is inserted to the input field at startup. When the button is pressed, the dialog is starting on the file/directory currently specified in the input field, if exists. The file-like specials (@code{@@infile}, @code{@@outfile}) accept one string argument. It can be a @emph{filter} for the file selection dialog. An example for a multiple filter is the following: @example @code{"C++ Files (*.cpp *.cc *.C *.cxx);;Headers (*.h *.hxx)"} @end example The separators between filter groups can be either double semicolons or newline characters. A complete example for @code{@@infile}: @example @code{@@infile("*.xpm *.png *.gif")="/usr/share/pixmaps"} @end example If no filter is specified, all files can be selected. In case of no initial value, the current directory is the starting point. These items evaluate to the text in the input field. @item @@container @cindex container Creates @emph{two buttons} and a @emph{list box}. The first parameter should be a nonterminal symbol, the following two strings are interpreted as the labels for the buttons. When the first button is pressed, the given nonterminal symbol is evaluated, and the generated text is inserted as a line into the list box. When the second button is pressed, the current line is removed from the list box. Button names default to @samp{Add} and @samp{Remove}. This object is useful in cases when recursion is needed in the grammar. (In Kaptain, recursion is forbidden.) For example, if one or more file name is needed, one can write this: @example filename -> @@infile; box -> @@container(filename); @end example The container evaluates to its contents, its lines are simply concatenated. @itemx @@multcol Creates a multi-column table with the given data filled. If the first parameter is a regular expression (@code{m/.../}), all the following string parameters are matched against this expression. Each such string parameter stands for one line, which is separated according to the regular expression.The subexpressions matched form the columns of the given row. If there is no regular expression, the rows are separated at the tab characters. The forthcoming string parameters are the rows of the table, except the first one, which is specially the header. Initial value, if an integer is given determines the selected element in the table. The @code{@@multicol} special symbol generates to the content of the selected row. @example @@multicol("Header 1\tHeader 2","data\tdata\tdata","abc")=1; @@multicol(m/([^ ]+) ([^ ]+) ([^ ]+)/,"1 2 3","a b c", "xx yy zz")=0; @end example @item @@fill @cindex fill Inserts some stretchable space into the dialog. No other functionality, evaluates to empty string. @item @@text @cindex text This special symbol creates slightly sunken box in the dialog with the given text inside. The text to be displayed is the concatenation of the initial value and all the string parameters. Since it has no functions, it is only good for informing the user. This object evaluates to the empty string. @item @@icon @cindex icon Displays an image in the dialog. The first parameter should be string, which is the name of a graphic file. Several file formats are recognized. From Qt's manual: @quotation Qt currently supports the following image file formats: PNG, BMP, XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if specially configured during compilation. The different PNM formats are: PBM (P1 or P4), PGM (P2 or P5), PPM (P3 or P6). @end quotation Icons evaluate to empty string. @item @@edit @cindex edit This is a multi-line text editor field. Initial value is inserted, it can be a multiline text, too. The first parameter, if it is a string, is treated as a font name, Kaptain tries to set the editor font. The next two parameters of integer type can be specified to set the minimum width and height for the editor field, in pixels. For example, @code{@@edit("lucidatypewriter",300,200)="Hello,\nEditor!"} creates an editor field of @math{300x200} pixels, using a nice font. If the given font name starts with a minus sign, it is treated as an XLDF (X Logical Font Description). Note that Qt does not handle wildcards in font descriptions, nor the aliases at this time. A fully specified font looks like this: @example -misc-fixed-medium-r-normal--12-120-75-75-c-70-iso8859-2 @end example @end table @node Reference of Modifiers, Concept Index, Reference of Special Symbols, Top @comment node-name, next, previous, up @appendix Reference of Modifiers Modifiers always begin with a colon and are related to the nonterminal after which they appear. For example: @example start :framed :horizontal -> a b c ; @end example means that a, b and c are placed horizontally one by one, and each is in a frame. Modifiers usually have effect on the appearence of the dialog. @table @samp @item :framed @cindex framed Makes the child widgets to appear in a frame. @item :tabbed @cindex tabbed Makes the child widgets to appear on different tabs. @item :horizontal @cindex horizontal Makes the child widgets to appear horizontal one by one, instead of the default vertical arrangement. @item :reverse @cindex reverse Makes the child widgets to appear in reverse order. That is down to top if @code{:horizontal} is not present, otherwise right to left. @item :noeval @cindex noeval The nonterminal will evaluate to an empty string. It is useful when you use a @@string input field by a @@container, and you want to have only those items which were inserted into the container. @item :double @cindex double Place child elements in two rows or columns. It is useful when you have many radio buttons. @item :beside @cindex beside Place child elements immediately to the right of the label of this rule (if it's a radio button or check box), not below as by default. Use it in the similar situations as this: @example number :beside "Number" -> @@integer | @@ ; @end example @item :dialog @cindex dialog Create a pushbutton, which if pressed, makes a subdialog to appear with the right side of the rule. @item :wizard @cindex wizard Create a pushbutton, which stands for a subdialog, having all the nonterminals from the right side as pages in a so called @emph{Wizard} dialog (with @emph{Next}, @emph{Back}, @emph{Cancel} and @emph{Finish} buttons). Must be on a conjunctive rule. @item :tree @cindex tree Places all children in a tree widget. If the children are also marked with :tree, they will appear on the second level in the tree. Look at the example grammar for indent. This is a very good way to place a great amount of structured information in the dialog. Checkboxes and radio buttons can appear in the tree, but if other things are present, they will be placed under or beside the QListView object. Use it with :beside if you want to create things like KControlCenter. If the label of the tree item is like @code{@{icons/my.gif@}Text"}, then the picture mentioned between the braces will be placed beside the Text---this can be very attractive. @item :detailed @cindex detailed Together with @code{:tree}, it makes a second column appear in the TreeView where the tooltip information is placed. @item :stack @cindex stack Creates a widget stack, which means all chind widgets of the corresponding rule are located in the same area, and only one is visible. To control which one is on the top of the stack (that is, visible) external communication can be used. @xref{External Control}. @c internal modifiers DO NOT USE THEM EXPLICITLY @c @item :checkbox @c @item :tristate @c @item :radioparent @c @item :leftaligned @c @item :rightaligned @c @item :radio @end table @node Concept Index, , Reference of Modifiers, Top @comment node-name, next, previous, up @unnumbered Concept Index @printindex cp @contents @bye kaptain-0.73/doc/record.gif0000640023433300116100000001334610120611327014307 0ustar zsoltengGIF87a```~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!  ppp,@H*\ȰÇ#JHbȱǏ0`(Q2` D a *XpC 6l @!b %L8E *V`Ѣ/`Ĉ!c 5jظqJ(y @2"E9$I%K0iɓ'PD"e *UXK-Zpŋ/_ #f2eʘ9sM4j֬aæ7o#G:tرs7-B-5&#EXg}\"d}thfb -`'%s罪 [4v\ ^7,ۊߝ箾ir,1q7齺.{_츷 {;h7ٱo:^׿iԒ@~ľ ZUʻ zpN`7= 9IoZBKpZ׭ \sa`X?l5TU G/vMb5X̢{UqKCzb6  HJPG6O0(HQJJ$( WZD)I JlB _B0YLcT2Lg>є4YMk^6Mo~8YNsT:Nw]P|̈F(`+iKb2$';O2tR ST*Yي"eBki r@.t ^Ȓ%$8OH1*%PyUȕ=%h9[II%aJLKH_Lቬmn!ÑB|.`5S ty;ৠ&ĚKSSLy>)I_=M*LTViH:-u@1CQnZY1 0\[#dxͫ^WbxFT֩)_jUWE2e,0ZjwҮȺNZKIKZamwvXl!PKMk*vܺir۹>K=s+ d>uIV馪ncK} L놯6!|+.5Xzi^ɛTvo+7$[XV@Uo-@},'s(NQ\s.nnTc,Ţ 6ba9L8fv0imj˂h3F0HcaU LT2~|2όK`rkD'< PBos)MyJ9t+aKYΒx`\r/$0yMȓ- %H9SH9j%`Y ɖE%x_:IQrgf$*i}GG@ɜ%%PU!R4@ * mCIH)$@QȔ5J%XWHA%py]*ɗM &B\!ipkpc~9QwP $π RHRB#/HpH@䶻}o>ϽO~DO=}?:%X)fZ M4ɛ)gnql+; ͖CӞd4^TN\A5mnzZ%jjy[T֨YTUgx2{<)FI|Z\+j|Z,RWz=:2gW+|KbOhr8OW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TYPE typedef union { int integer; string * pstring; Rule * prule; Disjunction * pdisjunction; Conjunction * pconjunction; Parameter * pparameter; list * pparamlist; string * string_array[3]; list * pstringlist; list * ptrafolist; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif # define NUMBER 257 # define NONTERMINAL 258 # define TERMINAL 259 # define SPECIAL 260 # define MODIFIER 261 # define RARROW 262 # define LARROW 263 # define SUBSTITUTION 264 # define TRANSLITERATION 265 # define REGEXP 266 # define ERROR 267 #define yylval parserlval extern YYSTYPE yylval; #endif /* not BISON_PARSER_TAB_HPP */ kaptain-0.73/parser.ypp0000640023433300116100000001307511162156215013631 0ustar zsolteng%{ #include #include #include #include #include "grammar.h" using namespace std; int yylex(); int yyerror(const char *); extern int yylineno; extern Grammar * yygrammar; extern int rarrow_lineno, larrow_lineno, nonterminal_lineno, last_correct_lineno; extern int glob_parse_result; extern list * glob_param_list; extern Parameter * glob_init_value; %} %union { int integer; string * pstring; Rule * prule; Disjunction * pdisjunction; Conjunction * pconjunction; Parameter * pparameter; list * pparamlist; string * string_array[3]; list * pstringlist; list * ptrafolist; } %token NUMBER %token NONTERMINAL %token TERMINAL %token SPECIAL %token MODIFIER %token RARROW %token LARROW %token SUBSTITUTION %token TRANSLITERATION %token REGEXP %token ERROR %type start; %type rules; %type rule; %type disjunction; %type conjunction; %type parameters; %type parameter; %type textinfo; %type modifiers; %type transformations; %type initvalue; %type description; %type constraint; %% start: rules { glob_parse_result=0; glob_param_list=0; glob_init_value=0; } | '(' parameters ')' initvalue { glob_parse_result=1; glob_param_list=$2; glob_init_value=$4; ; } | '(' ')' initvalue { glob_parse_result=1; glob_param_list=0; glob_init_value=$3; ; } | '=' parameter /* same as `initvalue' */ { glob_parse_result=1; glob_param_list=0; glob_init_value=$2; ; } ; rules: /* epsilon */ { $$=0; } | rules rule { yygrammar->add_rule($2); //cout << yygrammar->broker.get_string($2->get_left()).c_str() << endl; $$=0; } | rules description { $$=0; } | rules constraint { $$=0; } ; description: NONTERMINAL modifiers '=' textinfo ';' { last_correct_lineno=nonterminal_lineno; yygrammar->add_description($1, $2, $4); if ($4[0]) delete $4[0]; if ($4[1]) delete $4[1]; if ($4[2]) delete $4[2]; delete $1; } ; constraint: NONTERMINAL LARROW NONTERMINAL ';' { last_correct_lineno=larrow_lineno; yygrammar->add_constraint($1, $3); delete $1; delete $3; } ; rule: NONTERMINAL modifiers textinfo RARROW transformations disjunction { last_correct_lineno=rarrow_lineno; $$=new Rule(yygrammar); $$->set_disjunction($6); $$->set_left($1); $$->set_textinfo($3); $$->set_transformations($5); $$->add_modifiers($2); if ($3[0]) delete $3[0]; if ($3[1]) delete $3[1]; if ($3[2]) delete $3[2]; delete $1; } ; disjunction: conjunction ';' { $$=new Disjunction(yygrammar); $$->add_conjunction($1); } | conjunction '|' disjunction { $3->add_conjunction($1); $$=$3; } ; conjunction: /* epsilon */ { $$=new Conjunction(yygrammar); } | '@' conjunction { $$=$2; } | '!' conjunction { $2->set_default(); $$=$2; } | NONTERMINAL conjunction { $2->add_nonterminal($1); $$=$2; delete $1; } | TERMINAL conjunction { $2->add_terminal($1); $$=$2; delete $1; } | SPECIAL initvalue conjunction { $3->add_special($1, new list, $2); $$=$3; delete $1; } | SPECIAL '(' parameters ')' initvalue conjunction { $6->add_special($1, $3, $5); $$=$6; delete $1; } | SPECIAL '(' ')' initvalue conjunction { $5->add_special($1, new list, $4); $$=$5; delete $1; } ; parameters: parameter { $$=new list; $$->push_front($1); } | parameter ',' parameters { $3->push_front($1); $$=$3; } ; parameter: NUMBER { $$=new Parameter(yygrammar); $$->set_numeral($1); } | NONTERMINAL { $$=new Parameter(yygrammar); $$->set_nonterminal($1); delete $1; } | TERMINAL { $$=new Parameter(yygrammar); $$->set_string($1); delete $1; } | REGEXP { $$=new Parameter(yygrammar); $$->set_regexp($1); delete $1; } | TRANSLITERATION { $$=new Parameter(yygrammar); $$->set_transliteration($1); delete $1[0]; delete $1[1]; } | SUBSTITUTION { $$=new Parameter(yygrammar); $$->set_substitution($1); delete $1[0]; delete $1[1]; delete $1[2]; } ; initvalue: /* epsilon */ { $$=0; } | '=' parameter { $$=$2; } ; textinfo: /* epsilon */ { $$[0]=0; $$[1]=0; $$[2]=0; } | TERMINAL { $$[0]=$1; $$[1]=0; $$[2]=0; } | TERMINAL TERMINAL { $$[0]=$1; $$[1]=$2; $$[2]=0; } | TERMINAL TERMINAL TERMINAL { $$[0]=$1; $$[1]=$2; $$[2]=$3; } ; modifiers: /* epsilon */ { $$=new list; } | MODIFIER modifiers { $2->push_back($1); $$=$2; // $1 is deleted in rule `rule' :) } ; transformations: /* epsilon */ { $$=new list; } | TRANSLITERATION transformations { Parameter * t=new Parameter(yygrammar); t->set_transliteration($1); $2->push_back(t); $$=$2; delete $1[0]; delete $1[1]; } | SUBSTITUTION transformations { Parameter * t=new Parameter(yygrammar); t->set_substitution($1); $2->push_back(t); $$=$2; delete $1[0]; delete $1[1]; delete $1[2]; } ; %% int yyerror(const char *) { return 0; } kaptain-0.73/y.tab.c0000640023433300116100000015514711531163401012766 0ustar zsolteng /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse parserparse #define yylex parserlex #define yyerror parsererror #define yylval parserlval #define yychar parserchar #define yydebug parserdebug #define yynerrs parsernerrs /* Copy the first part of user declarations. */ /* Line 189 of yacc.c */ #line 1 "parser.ypp" #include #include #include #include #include "grammar.h" using namespace std; int yylex(); int yyerror(const char *); extern int yylineno; extern Grammar * yygrammar; extern int rarrow_lineno, larrow_lineno, nonterminal_lineno, last_correct_lineno; extern int glob_parse_result; extern list * glob_param_list; extern Parameter * glob_init_value; /* Line 189 of yacc.c */ #line 100 "y.tab.c" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUMBER = 258, NONTERMINAL = 259, TERMINAL = 260, SPECIAL = 261, MODIFIER = 262, RARROW = 263, LARROW = 264, SUBSTITUTION = 265, TRANSLITERATION = 266, REGEXP = 267, ERROR = 268 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 214 of yacc.c */ #line 20 "parser.ypp" int integer; string * pstring; Rule * prule; Disjunction * pdisjunction; Conjunction * pconjunction; Parameter * pparameter; list * pparamlist; string * string_array[3]; list * pstringlist; list * ptrafolist; /* Line 214 of yacc.c */ #line 164 "y.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ #line 176 "y.tab.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 15 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 70 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 22 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 14 /* YYNRULES -- Number of rules. */ #define YYNRULES 41 /* YYNRULES -- Number of states. */ #define YYNSTATES 70 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 268 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 20, 2, 2, 2, 2, 2, 2, 14, 15, 2, 2, 21, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 17, 2, 16, 2, 2, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 10, 14, 17, 18, 21, 24, 27, 33, 38, 45, 48, 52, 53, 56, 59, 62, 65, 69, 76, 82, 84, 88, 90, 92, 94, 96, 98, 100, 101, 104, 105, 107, 110, 114, 115, 118, 119, 122 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 23, 0, -1, 24, -1, 14, 30, 15, 32, -1, 14, 15, 32, -1, 16, 31, -1, -1, 24, 27, -1, 24, 25, -1, 24, 26, -1, 4, 34, 16, 33, 17, -1, 4, 9, 4, 17, -1, 4, 34, 33, 8, 35, 28, -1, 29, 17, -1, 29, 18, 28, -1, -1, 19, 29, -1, 20, 29, -1, 4, 29, -1, 5, 29, -1, 6, 32, 29, -1, 6, 14, 30, 15, 32, 29, -1, 6, 14, 15, 32, 29, -1, 31, -1, 31, 21, 30, -1, 3, -1, 4, -1, 5, -1, 12, -1, 11, -1, 10, -1, -1, 16, 31, -1, -1, 5, -1, 5, 5, -1, 5, 5, 5, -1, -1, 7, 34, -1, -1, 11, 35, -1, 10, 35, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 63, 63, 69, 76, 83, 93, 96, 102, 106, 114, 128, 139, 158, 163, 172, 175, 179, 184, 190, 196, 202, 208, 217, 222, 231, 236, 242, 248, 254, 261, 274, 277, 286, 291, 297, 303, 314, 317, 328, 331, 340 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NUMBER", "NONTERMINAL", "TERMINAL", "SPECIAL", "MODIFIER", "RARROW", "LARROW", "SUBSTITUTION", "TRANSLITERATION", "REGEXP", "ERROR", "'('", "')'", "'='", "';'", "'|'", "'@'", "'!'", "','", "$accept", "start", "rules", "description", "constraint", "rule", "disjunction", "conjunction", "parameters", "parameter", "initvalue", "textinfo", "modifiers", "transformations", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 40, 41, 61, 59, 124, 64, 33, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 26, 27, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 33, 33, 33, 33, 34, 34, 35, 35, 35 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 4, 3, 2, 0, 2, 2, 2, 5, 4, 6, 2, 3, 0, 2, 2, 2, 2, 3, 6, 5, 1, 3, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 3, 0, 2, 0, 2, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 6, 0, 0, 0, 2, 25, 26, 27, 30, 29, 28, 31, 0, 23, 5, 1, 37, 8, 9, 7, 0, 4, 31, 0, 37, 0, 33, 32, 3, 24, 38, 0, 34, 33, 0, 11, 35, 0, 39, 36, 10, 39, 39, 15, 41, 40, 15, 15, 31, 15, 15, 12, 0, 18, 19, 0, 15, 16, 17, 13, 15, 31, 0, 20, 14, 15, 31, 22, 15, 21 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 3, 4, 17, 18, 19, 51, 52, 12, 13, 21, 34, 26, 43 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -44 static const yytype_int8 yypact[] = { -2, 25, 51, 11, 14, -44, -44, -44, -44, -44, -44, 22, 12, 26, -44, -44, 8, -44, -44, -44, 51, -44, 22, 51, 44, 48, 0, -44, -44, -44, -44, 15, 54, 55, 56, -44, 60, 49, 10, -44, -44, 10, 10, 4, -44, -44, 4, 4, 17, 4, 4, -44, 28, -44, -44, 38, 4, -44, -44, -44, 4, 22, 52, -44, -44, 4, 22, -44, 4, -44 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -44, -44, -44, -44, -44, -44, 9, -43, -21, -1, -22, 35, 46, 16 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 28, 14, 29, 53, 54, 32, 57, 58, 46, 47, 48, 15, 1, 63, 2, 24, 33, 25, 16, 27, 41, 42, 67, 49, 50, 69, 56, 22, 5, 6, 7, 55, 35, 20, 62, 8, 9, 10, 20, 65, 11, 5, 6, 7, 68, 59, 60, 23, 8, 9, 10, 24, 31, 61, 5, 6, 7, 44, 45, 36, 32, 8, 9, 10, 38, 39, 40, 66, 37, 64, 30 }; static const yytype_uint8 yycheck[] = { 22, 2, 23, 46, 47, 5, 49, 50, 4, 5, 6, 0, 14, 56, 16, 7, 16, 9, 4, 20, 10, 11, 65, 19, 20, 68, 48, 15, 3, 4, 5, 14, 17, 16, 55, 10, 11, 12, 16, 61, 15, 3, 4, 5, 66, 17, 18, 21, 10, 11, 12, 7, 4, 15, 3, 4, 5, 41, 42, 5, 5, 10, 11, 12, 8, 5, 17, 15, 33, 60, 24 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 14, 16, 23, 24, 3, 4, 5, 10, 11, 12, 15, 30, 31, 31, 0, 4, 25, 26, 27, 16, 32, 15, 21, 7, 9, 34, 31, 32, 30, 34, 4, 5, 16, 33, 17, 5, 33, 8, 5, 17, 10, 11, 35, 35, 35, 4, 5, 6, 19, 20, 28, 29, 29, 29, 14, 32, 29, 29, 17, 18, 15, 30, 29, 28, 32, 15, 29, 32, 29 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* Line 1455 of yacc.c */ #line 64 "parser.ypp" { glob_parse_result=0; glob_param_list=0; glob_init_value=0; ;} break; case 3: /* Line 1455 of yacc.c */ #line 70 "parser.ypp" { glob_parse_result=1; glob_param_list=(yyvsp[(2) - (4)].pparamlist); glob_init_value=(yyvsp[(4) - (4)].pparameter); ; ;} break; case 4: /* Line 1455 of yacc.c */ #line 77 "parser.ypp" { glob_parse_result=1; glob_param_list=0; glob_init_value=(yyvsp[(3) - (3)].pparameter); ; ;} break; case 5: /* Line 1455 of yacc.c */ #line 84 "parser.ypp" { glob_parse_result=1; glob_param_list=0; glob_init_value=(yyvsp[(2) - (2)].pparameter); ; ;} break; case 6: /* Line 1455 of yacc.c */ #line 93 "parser.ypp" { (yyval.integer)=0; ;} break; case 7: /* Line 1455 of yacc.c */ #line 97 "parser.ypp" { yygrammar->add_rule((yyvsp[(2) - (2)].prule)); //cout << yygrammar->broker.get_string($2->get_left()).c_str() << endl; (yyval.integer)=0; ;} break; case 8: /* Line 1455 of yacc.c */ #line 103 "parser.ypp" { (yyval.integer)=0; ;} break; case 9: /* Line 1455 of yacc.c */ #line 107 "parser.ypp" { (yyval.integer)=0; ;} break; case 10: /* Line 1455 of yacc.c */ #line 115 "parser.ypp" { last_correct_lineno=nonterminal_lineno; yygrammar->add_description((yyvsp[(1) - (5)].pstring), (yyvsp[(2) - (5)].pstringlist), (yyvsp[(4) - (5)].string_array)); if ((yyvsp[(4) - (5)].string_array)[0]) delete (yyvsp[(4) - (5)].string_array)[0]; if ((yyvsp[(4) - (5)].string_array)[1]) delete (yyvsp[(4) - (5)].string_array)[1]; if ((yyvsp[(4) - (5)].string_array)[2]) delete (yyvsp[(4) - (5)].string_array)[2]; delete (yyvsp[(1) - (5)].pstring); ;} break; case 11: /* Line 1455 of yacc.c */ #line 129 "parser.ypp" { last_correct_lineno=larrow_lineno; yygrammar->add_constraint((yyvsp[(1) - (4)].pstring), (yyvsp[(3) - (4)].pstring)); delete (yyvsp[(1) - (4)].pstring); delete (yyvsp[(3) - (4)].pstring); ;} break; case 12: /* Line 1455 of yacc.c */ #line 140 "parser.ypp" { last_correct_lineno=rarrow_lineno; (yyval.prule)=new Rule(yygrammar); (yyval.prule)->set_disjunction((yyvsp[(6) - (6)].pdisjunction)); (yyval.prule)->set_left((yyvsp[(1) - (6)].pstring)); (yyval.prule)->set_textinfo((yyvsp[(3) - (6)].string_array)); (yyval.prule)->set_transformations((yyvsp[(5) - (6)].ptrafolist)); (yyval.prule)->add_modifiers((yyvsp[(2) - (6)].pstringlist)); if ((yyvsp[(3) - (6)].string_array)[0]) delete (yyvsp[(3) - (6)].string_array)[0]; if ((yyvsp[(3) - (6)].string_array)[1]) delete (yyvsp[(3) - (6)].string_array)[1]; if ((yyvsp[(3) - (6)].string_array)[2]) delete (yyvsp[(3) - (6)].string_array)[2]; delete (yyvsp[(1) - (6)].pstring); ;} break; case 13: /* Line 1455 of yacc.c */ #line 159 "parser.ypp" { (yyval.pdisjunction)=new Disjunction(yygrammar); (yyval.pdisjunction)->add_conjunction((yyvsp[(1) - (2)].pconjunction)); ;} break; case 14: /* Line 1455 of yacc.c */ #line 164 "parser.ypp" { (yyvsp[(3) - (3)].pdisjunction)->add_conjunction((yyvsp[(1) - (3)].pconjunction)); (yyval.pdisjunction)=(yyvsp[(3) - (3)].pdisjunction); ;} break; case 15: /* Line 1455 of yacc.c */ #line 172 "parser.ypp" { (yyval.pconjunction)=new Conjunction(yygrammar); ;} break; case 16: /* Line 1455 of yacc.c */ #line 176 "parser.ypp" { (yyval.pconjunction)=(yyvsp[(2) - (2)].pconjunction); ;} break; case 17: /* Line 1455 of yacc.c */ #line 180 "parser.ypp" { (yyvsp[(2) - (2)].pconjunction)->set_default(); (yyval.pconjunction)=(yyvsp[(2) - (2)].pconjunction); ;} break; case 18: /* Line 1455 of yacc.c */ #line 185 "parser.ypp" { (yyvsp[(2) - (2)].pconjunction)->add_nonterminal((yyvsp[(1) - (2)].pstring)); (yyval.pconjunction)=(yyvsp[(2) - (2)].pconjunction); delete (yyvsp[(1) - (2)].pstring); ;} break; case 19: /* Line 1455 of yacc.c */ #line 191 "parser.ypp" { (yyvsp[(2) - (2)].pconjunction)->add_terminal((yyvsp[(1) - (2)].pstring)); (yyval.pconjunction)=(yyvsp[(2) - (2)].pconjunction); delete (yyvsp[(1) - (2)].pstring); ;} break; case 20: /* Line 1455 of yacc.c */ #line 197 "parser.ypp" { (yyvsp[(3) - (3)].pconjunction)->add_special((yyvsp[(1) - (3)].pstring), new list, (yyvsp[(2) - (3)].pparameter)); (yyval.pconjunction)=(yyvsp[(3) - (3)].pconjunction); delete (yyvsp[(1) - (3)].pstring); ;} break; case 21: /* Line 1455 of yacc.c */ #line 203 "parser.ypp" { (yyvsp[(6) - (6)].pconjunction)->add_special((yyvsp[(1) - (6)].pstring), (yyvsp[(3) - (6)].pparamlist), (yyvsp[(5) - (6)].pparameter)); (yyval.pconjunction)=(yyvsp[(6) - (6)].pconjunction); delete (yyvsp[(1) - (6)].pstring); ;} break; case 22: /* Line 1455 of yacc.c */ #line 209 "parser.ypp" { (yyvsp[(5) - (5)].pconjunction)->add_special((yyvsp[(1) - (5)].pstring), new list, (yyvsp[(4) - (5)].pparameter)); (yyval.pconjunction)=(yyvsp[(5) - (5)].pconjunction); delete (yyvsp[(1) - (5)].pstring); ;} break; case 23: /* Line 1455 of yacc.c */ #line 218 "parser.ypp" { (yyval.pparamlist)=new list; (yyval.pparamlist)->push_front((yyvsp[(1) - (1)].pparameter)); ;} break; case 24: /* Line 1455 of yacc.c */ #line 223 "parser.ypp" { (yyvsp[(3) - (3)].pparamlist)->push_front((yyvsp[(1) - (3)].pparameter)); (yyval.pparamlist)=(yyvsp[(3) - (3)].pparamlist); ;} break; case 25: /* Line 1455 of yacc.c */ #line 232 "parser.ypp" { (yyval.pparameter)=new Parameter(yygrammar); (yyval.pparameter)->set_numeral((yyvsp[(1) - (1)].integer)); ;} break; case 26: /* Line 1455 of yacc.c */ #line 237 "parser.ypp" { (yyval.pparameter)=new Parameter(yygrammar); (yyval.pparameter)->set_nonterminal((yyvsp[(1) - (1)].pstring)); delete (yyvsp[(1) - (1)].pstring); ;} break; case 27: /* Line 1455 of yacc.c */ #line 243 "parser.ypp" { (yyval.pparameter)=new Parameter(yygrammar); (yyval.pparameter)->set_string((yyvsp[(1) - (1)].pstring)); delete (yyvsp[(1) - (1)].pstring); ;} break; case 28: /* Line 1455 of yacc.c */ #line 249 "parser.ypp" { (yyval.pparameter)=new Parameter(yygrammar); (yyval.pparameter)->set_regexp((yyvsp[(1) - (1)].pstring)); delete (yyvsp[(1) - (1)].pstring); ;} break; case 29: /* Line 1455 of yacc.c */ #line 255 "parser.ypp" { (yyval.pparameter)=new Parameter(yygrammar); (yyval.pparameter)->set_transliteration((yyvsp[(1) - (1)].string_array)); delete (yyvsp[(1) - (1)].string_array)[0]; delete (yyvsp[(1) - (1)].string_array)[1]; ;} break; case 30: /* Line 1455 of yacc.c */ #line 262 "parser.ypp" { (yyval.pparameter)=new Parameter(yygrammar); (yyval.pparameter)->set_substitution((yyvsp[(1) - (1)].string_array)); delete (yyvsp[(1) - (1)].string_array)[0]; delete (yyvsp[(1) - (1)].string_array)[1]; delete (yyvsp[(1) - (1)].string_array)[2]; ;} break; case 31: /* Line 1455 of yacc.c */ #line 274 "parser.ypp" { (yyval.pparameter)=0; ;} break; case 32: /* Line 1455 of yacc.c */ #line 278 "parser.ypp" { (yyval.pparameter)=(yyvsp[(2) - (2)].pparameter); ;} break; case 33: /* Line 1455 of yacc.c */ #line 286 "parser.ypp" { (yyval.string_array)[0]=0; (yyval.string_array)[1]=0; (yyval.string_array)[2]=0; ;} break; case 34: /* Line 1455 of yacc.c */ #line 292 "parser.ypp" { (yyval.string_array)[0]=(yyvsp[(1) - (1)].pstring); (yyval.string_array)[1]=0; (yyval.string_array)[2]=0; ;} break; case 35: /* Line 1455 of yacc.c */ #line 298 "parser.ypp" { (yyval.string_array)[0]=(yyvsp[(1) - (2)].pstring); (yyval.string_array)[1]=(yyvsp[(2) - (2)].pstring); (yyval.string_array)[2]=0; ;} break; case 36: /* Line 1455 of yacc.c */ #line 304 "parser.ypp" { (yyval.string_array)[0]=(yyvsp[(1) - (3)].pstring); (yyval.string_array)[1]=(yyvsp[(2) - (3)].pstring); (yyval.string_array)[2]=(yyvsp[(3) - (3)].pstring); ;} break; case 37: /* Line 1455 of yacc.c */ #line 314 "parser.ypp" { (yyval.pstringlist)=new list; ;} break; case 38: /* Line 1455 of yacc.c */ #line 318 "parser.ypp" { (yyvsp[(2) - (2)].pstringlist)->push_back((yyvsp[(1) - (2)].pstring)); (yyval.pstringlist)=(yyvsp[(2) - (2)].pstringlist); // $1 is deleted in rule `rule' :) ;} break; case 39: /* Line 1455 of yacc.c */ #line 328 "parser.ypp" { (yyval.ptrafolist)=new list; ;} break; case 40: /* Line 1455 of yacc.c */ #line 332 "parser.ypp" { Parameter * t=new Parameter(yygrammar); t->set_transliteration((yyvsp[(1) - (2)].string_array)); (yyvsp[(2) - (2)].ptrafolist)->push_back(t); (yyval.ptrafolist)=(yyvsp[(2) - (2)].ptrafolist); delete (yyvsp[(1) - (2)].string_array)[0]; delete (yyvsp[(1) - (2)].string_array)[1]; ;} break; case 41: /* Line 1455 of yacc.c */ #line 341 "parser.ypp" { Parameter * t=new Parameter(yygrammar); t->set_substitution((yyvsp[(1) - (2)].string_array)); (yyvsp[(2) - (2)].ptrafolist)->push_back(t); (yyval.ptrafolist)=(yyvsp[(2) - (2)].ptrafolist); delete (yyvsp[(1) - (2)].string_array)[0]; delete (yyvsp[(1) - (2)].string_array)[1]; delete (yyvsp[(1) - (2)].string_array)[2]; ;} break; /* Line 1455 of yacc.c */ #line 1865 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 1675 of yacc.c */ #line 352 "parser.ypp" int yyerror(const char *) { return 0; } kaptain-0.73/y.tab.h0000640023433300116100000000510011531163401012752 0ustar zsolteng /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUMBER = 258, NONTERMINAL = 259, TERMINAL = 260, SPECIAL = 261, MODIFIER = 262, RARROW = 263, LARROW = 264, SUBSTITUTION = 265, TRANSLITERATION = 266, REGEXP = 267, ERROR = 268 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 1676 of yacc.c */ #line 20 "parser.ypp" int integer; string * pstring; Rule * prule; Disjunction * pdisjunction; Conjunction * pconjunction; Parameter * pparameter; list * pparamlist; string * string_array[3]; list * pstringlist; list * ptrafolist; /* Line 1676 of yacc.c */ #line 80 "y.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE parserlval; kaptain-0.73/process.cpp0000640023433300116100000000623210120611331013746 0ustar zsolteng#include #include #include #include #include #include #include "process.h" /* ---------------------------------------------------------------------- */ void clean_up_child_process(int s) { cout << "Signal: " << s << endl; int status; wait(&status); } void POSIX_init() { signal(SIGCHLD, SIG_IGN); signal(SIGPIPE, SIG_IGN); /* // handle SIGCHLD by calling clean_up_child_process struct sigaction sigchld_action; memset(&sigchld_action, 0, sizeof(sigchld_action)); sigchld_action.sa_handler=&clean_up_child_process; sigaction(SIGCHLD, &sigchld_action, NULL); // handle SIGPIPE memset(&sigchld_action, 0, sizeof(sigchld_action)); sigchld_action.sa_handler=&clean_up_child_process; sigaction(SIGPIPE, &sigchld_action, NULL); */ } /* asynchronous program execution */ int exec_async(list & arguments) { pid_t child_pid; child_pid=fork(); if (child_pid == 0) { /* child process */ const char ** arglist=new const char *[arguments.size()+1]; list::iterator si; int ind=0; for (si=arguments.begin(); si!=arguments.end(); si++) arglist[ind++]=(*si).c_str(); arglist[ind]=0; // NULL terminated (char * array) execvp(arglist[0], (char * const *)arglist); } /* parent process */ return child_pid; } #define READ_BUFFER_SIZE 1000 string exec_sync_stdout(string & command) { string eval; char * buffer=new char[READ_BUFFER_SIZE+2]; FILE * fp; fp=popen(command.c_str(), "r"); if (fp) while (!feof(fp)) { if (fgets(buffer, READ_BUFFER_SIZE, fp)) eval+=buffer; } pclose(fp); return eval; } string exec_sync_stdout(list & arguments) { string eval; int fds[2]; pid_t pid; /* Create a pipe. File descriptors for the two ends of the pipe are placed in fds. */ pipe (fds); /* Fork a child process. */ pid = fork (); if (pid == (pid_t) 0) { /* This is the child process. Close our copy of the read end of the file descriptor. */ close (fds[0]); /* Connect the write end of the pipe to standard input. */ dup2 (fds[1], STDOUT_FILENO); /* Replace the child process with the given program. */ const char ** arglist=new const char *[arguments.size()+1]; list::iterator si; int ind=0; for (si=arguments.begin(); si!=arguments.end(); si++) arglist[ind++]=(*si).c_str(); arglist[ind]=0; // NULL terminated (char * array) execvp(arglist[0], (char * const *)arglist); } else { /* This is the parent process. */ FILE* stream; char * buffer=new char[READ_BUFFER_SIZE+2]; /* Close our copy of the write end of the file descriptor. */ close (fds[1]); /* Convert the write file descriptor to a FILE object, and write to it. */ stream = fdopen (fds[0], "r"); while (!feof(stream)) { if (fgets(buffer, READ_BUFFER_SIZE, stream)) eval+=buffer; } close (fds[0]); /* Wait for the child process to finish. */ waitpid (pid, NULL, 0); } return eval; } kaptain-0.73/process.h0000640023433300116100000000042710120611331013413 0ustar zsolteng#ifndef PROCESS_HH #define PROCESS_HH #include #include using namespace std; void clean_up_child_process(int); void POSIX_init(); int exec_async(list &); string exec_sync_stdout(string &); string exec_sync_stdout(list &); #endif // PROCESS_HH kaptain-0.73/tools.cpp0000640023433300116100000001107311162156747013455 0ustar zsolteng#include #include #include #include #include #include "tools.h" Error::Error() { stop=false; } void Error::warning(string s) { s.insert(0, "Warning: "); messages.push_back(s); } void Error::error(string s) { s.insert(0, "Error: "); messages.push_back(s); stop=true; } void Error::print() { copy(messages.begin(), messages.end(), ostream_iterator(cerr)); } /*----------------------------------------------------------------------*/ Regexp::Regexp() { } bool Regexp::matches(string pattern, string src, list & matches) { regex_t pattern_buffer; regmatch_t regs[10]; /* try to compile pattern */ int err=0; if (src.empty() || (err=regcomp(&pattern_buffer, pattern.c_str(), REG_EXTENDED)) ) { char msg[100]; if (!(src.empty())) { regerror(err, &pattern_buffer, msg, 100); cerr << "Error in regular expression: " << pattern << '\n' << msg << '\n'; } /* if error occured, no matching was found */ return false; } /* match the pattern against the given string */ if (regexec(&pattern_buffer, src.c_str(), 10, regs, 0)!=0) /* no match */ return false; /* copy the part left to the point where the matching starts */ int i; for (i=1; i<9; i++) { if (regs[i].rm_so>=0) matches.push_back(src.substr(regs[i].rm_so, regs[i].rm_eo - regs[i].rm_so)); } /* return the end of the last match */ return true; } bool Regexp::substitute_local(string pattern, string src, string replacement, string & dest, int & dest_end) { //cout << pattern << ":" << src << ":" << replacement << endl; regex_t pattern_buffer; regmatch_t regs[10]; /* try to compile pattern */ int err=0; if (src.empty() || (err=regcomp(&pattern_buffer, pattern.c_str(), REG_EXTENDED)) ) { char msg[100]; if (!src.empty()) { regerror(err, &pattern_buffer, msg, 100); cerr << "Error in regular expression: " << pattern << '\n' << msg << '\n'; } /* if error occured, do not make substitution */ dest=src; return false; } /* match the pattern against the given string */ if (regexec(&pattern_buffer, src.c_str(), 10, regs, 0)!=0) { /* no match */ dest=src; return false; } /* copy the part left to the point where the matching starts */ dest=src.substr(0,regs[0].rm_so); unsigned int i=0; while (i='0' && replacement[i]<='9') { int num=replacement[i]-'0'; dest+=src.substr(regs[num].rm_so, regs[num].rm_eo - regs[num].rm_so); } else dest+=replacement[i]; } else dest+=replacement[i]; i++; } dest_end=dest.length(); dest+=src.substr(regs[0].rm_eo, src.length() - regs[0].rm_eo); //cout << ":" << dest << endl; return true; } void Regexp::substitute(string pattern, string src, string replacement, string & dest, bool global) { string src_left, src_right, dest_right, result; int differ, index=0, de=0; //cout << "!" << src << "!" << global << endl; if (global) { result=src; do { src_left=result.substr(0,index); src_right=result.substr(index); differ=substitute_local(pattern, src_right, replacement, dest_right, de); result=src_left+dest_right; index+=de; } while (differ); dest=result; } else substitute_local(pattern, src, replacement, dest, de); } /* transliterate a string like sed's y */ void Regexp::transliterate(string from, string to, string src, string & dest) { int i, pos; dest=string(); for (i=0; i<(int)src.length(); i++) { pos=from.find(src[i]); if (pos>=0 && pos<(int)to.length()) dest+=to[pos]; else dest+=src[i]; } } void Regexp::split(char c, string s, list & r) { size_t b=0, e; e=s.find(c,b); if (e & r, string & s) { list::iterator it; for (it=r.begin(); it!=r.end(); it++) { if (it!=r.begin()) s+=c; s=(*it); } } kaptain-0.73/tools.h0000640023433300116100000000145710120611331013101 0ustar zsolteng#ifndef TOOLS_HH #define TOOLS_HH #include #include using namespace std; /**********/ class Error { list messages; bool stop; public: Error(); void warning(string); void error(string); bool go_on() { return !stop; } void print(); }; /***********/ class Regexp { private: public: Regexp(); static bool matches(string, string, list & ); static bool substitute_local(string, string, string, string &, int &); static void substitute(string, string, string, string &, bool); static void transliterate(string, string, string, string &); static void split(char, string, list &); static void join(char, list &, string &); }; #endif // TOOLS_HH kaptain-0.73/examples/0000750023433300116100000000000011531214266013413 5ustar zsoltengkaptain-0.73/examples/arping.kaptn0000640023433300116100000000176310120611343015730 0ustar zsolteng#!/usr/bin/kaptain # # arping grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # # arping: http://synscan.nss.nu/programs.php start "Arping" -> command buttons; buttons:horizontal -> @action(command)="OK" @close="Cancel"; command :framed -> "arping " opt object ; opt "Options" -> verbose raw interf maxcount finddup nullip ; verbose -> beverbose | ! @ ; beverbose "Be verbose" -> "-v " ; raw -> rawoutput | ! @ ; rawoutput "Raw output" -> "-r " ; interf -> interface | ! @ ; interface "Specify interface to use" -> "-i " interface2use " " ; interface2use -> @string="eth0" ; maxcount -> count | ! @ ; count "Number of packets to send" -> "-c " thecount " " ; thecount -> @integer=3 ; finddup -> findduplicates | ! @ ; findduplicates "Find duplicates" -> "-d " ; nullip -> usenullip | ! @ ; usenullip "Use null ip address" -> "-0 " ; object "Host/IP/MAC to query" -> @string="00:00:00:00:00:00" ; kaptain-0.73/examples/budget.kaptn0000640023433300116100000000205510120611342015714 0ustar zsolteng#!/usr/bin/kaptain start "Personal budget" -> data buttons; buttons:horizontal -> @exec("psql","-c",query)="OK" @close="Cancel"; #buttons:horizontal -> @echo(query)="OK" @close="Cancel"; query :framed "Data" -> 'INSERT INTO budget VALUES' data; data -> "(" trans_date ",'" description "'," amount ",'" currency "','" destination "');"; trans_date :framed -> trans_date0; trans_date0 :horizontal "Date"-> !today | specified_date; today "Today" -> "date('now')"; specified_date :beside "Other"-> "'" @regexp("^[0-9]+-[0-9]+-[0-9]+$")=x@date +%D | sed -e 's!\(..\)/\(..\)/\(..\)!20\3-\1-\2!'@ "'"; description "Description" -> @string(40)="BB"; amount :framed -> money; money "Amount" -> sign quant; sign :horizontal -> in | out; in "Pay-in" -> ""; out "Withdraw" -> "-"; quant :horizontal -> quantity currencyX; currencyX :noeval -> currency; quantity "Quantity" -> @regexp("^[0-9]*$"); currency "Currency" -> @combow('HUF','DEM','USD',"EUR"); destination "Destination" -> @combow("BANK","Family","Mother","Father","Other"); kaptain-0.73/examples/crypt.kaptn0000640023433300116100000000034710120611343015606 0ustar zsolteng#!/usr/bin/kaptain start "Password encrypter" -> code @action("perl","-e",code)="Crypt"; code:framed -> "print crypt('" passw "','" sa q%')."\n"% ; passw "Password" -> @string="notsimple"; sa "Random chars(2)" -> @string(2)="y4"; kaptain-0.73/examples/curl.kaptn0000640023433300116100000001202310120611343015404 0ustar zsolteng#!/usr/bin/kaptain # # curl grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "cURL" -> filespec url buttons ; buttons :horizontal -> @action(command)="OK" @button(opt)="Options" @close="Cancel" ; command :framed -> "curl " opt filespec url ; opt "Options" -> options @close="Close" ; options :framed :tabbed -> optc opthf ; optc :horizontal "Common options" -> optcommon optcommon2 optcommon3 ; opthf :horizontal "HTTP/FTP options" -> opthttp opthttp2 optftp ; optcommon -> norc dump gethead configf maxt netrc nobuf ; optcommon2 -> rang sil verb write proxy request progress ; optcommon3 -> speedlim timecon ssl stder ; opthttp -> ag cook cont dat ref ; opthttp2 -> cert fail for sethead inc loc app ; optftp -> useasc list ftpp quot ; app -> append | ! @ ; append "Append FTP uloads" -> "--append " ; ag -> agent | ! @ ; agent "Set User Agent to" -> "--user-agent " @string="Mozilla/4.0" " " ; cook -> cookie | ! @ ; cookie "Pass cookie(s)" -> "--cookie " @string="name1=value1;name2=value2;..." " " ; useasc -> useascii | ! @ ; useascii "Use ASCII for FTP gets and LDAP info" -> "--use-ascii " ; cont -> conti | ! @ ; conti "Continue HTTP/1.1 transfers" -> ! continue | continueat ; continue "Where previously stopped" -> "--continue " ; continueat "At offset" -> "--continue-at " @integer " " ; dat -> data | ! @ ; data "POST data" -> "--data " @string " " ; dump -> dumpheader | ! @ ; dumpheader "Write HTTP header/FTP info to file" -> "--dump-header " @outfile " " ; ref -> referrer | ! @ ; referrer "Set Referrer Page to" -> "--referer " @string="http://host.domain/directory/page.html" " " ; cert -> certificate | ! @ ; certificate "Use PEM certificate file for HTTPS" -> "--cert " @infile " " ; fail -> failsilently | ! @ ; failsilently "Fail silently on server errors" -> "--fail " ; for -> form | ! @ ; form "POST form data" -> "--form " @string " " ; sethead -> setheader | ! @ ; setheader "Set custom HTTP header" -> "--header " @string " " ; inc -> include | ! @ ; include "Include HTTP header in output" -> "--include " ; gethead -> getheader | ! @ ; getheader "Fetch HTTP header / FTP file size only" -> "--head " ; configf -> configfile | ! @ ; configfile "File to read arguments from" -> "--config " @infile " " ; list -> listonly | ! @ ; listonly "Filename only for FTP listings" -> "--list-only " ; loc -> location | ! @ ; location "Honor HTTP Location: headers" -> "--location " ; maxt -> maxtime | ! @ ; maxtime "Maximum allowed running time (sec.)" -> "--maxtime " mtime " " ; mtime -> @integer(1,32767)=1800 ; netrc -> netrcfile | ! @ ; netrcfile "Use .netrc file for account info" -> "--netrc " ; nobuf -> nobuffer | ! @ ; nobuffer "Disable output buffering" -> "--no-buffer " ; ftpp -> ftpport | ! @ ; ftpport "Use PORT instead of PASV" -> "--ftpport " ftppaddress " " ; ftppaddress -> interface | ip | hostname | !default ; interface "Interface name" -> @string="eth0" ; ip "IP address" -> @string ; hostname "Hostname" -> @string ; default "Machine's default" -> "-" ; norc -> nocurlrc | ! @ ; nocurlrc "Don't read ~/.curlrc" -> "-q " ; quot -> quote | ! @ ; quote "Send arbitrary FTP command" -> "--quote " @string " " ; rang -> range | ! @ ; range "Specify byte range" -> "--range " @string " " ; sil -> silent | ! @ ; silent "Silent mode" -> "--silent " showerrors " " ; showerrors -> ! showerr | dontshowerr ; showerr "Show errors" -> "-S " ; dontshowerr "Don't show errors" -> " " ; filespec :framed -> ! outfile | infile ; outfile "Download" -> outputfile | !remotename ; outputfile "file" -> "--output " @outfile " " ; remotename "Use remote file name" -> "--remote-name " ; infile "Upload" -> "--upload-file " @infile " " ; userinf -> userinfo | ! @ ; userinfo "Specify user:password" -> "--user " @string " " ; proxyinf -> proxyinfo | ! @ ; proxyinfo "Specify user:password for proxy" -> "--proxy-user" @string " " ; verb -> verbose | ! @ ; verbose "Verbose mode" -> "--verbose " ; write -> writeout | ! @ ; writeout "Writeout format" -> "--write-out " @string " " ; writeoutformat -> @string ; proxy -> useproxy | ! @ ; useproxy "Use proxy" -> "--proxy " @string="host:port" " " ; request -> crequest | ! @ ; crequest "Use this request instead of GET/LIST" -> "--request " @string " " ; speedlim -> speedlimit | ! @ ; speedlimit "Speed minimum" -> " --speed-limit " speedbytes " --speed-time " speedtime " "; speedbytes "at least ___ bytes" -> @integer=30 ; speedtime "per ___ seconds" -> @integer=1 ; timecon -> timecond | ! @ ; timecond "document time/date" -> "--time-cond " @string " " ; ssl "SSL version" -> force2 | force3 | !either ; force2 "force use of SSLv2" -> "--sslv2 " ; force3 "force use of SSLv3" -> "--sslv3 " ; either "allow both" -> " " ; progress -> progressbar | ! @ ; progressbar "display progress bar" -> "--progress-bar " ; crlf -> convertcrlf | ! @ ; convertcrlf "Convert CR/LF in uploads" -> "--crlf " ; stder -> stderr | ! @ ; stderr "Redirect stderr to file" -> "--stderr " @outfile " " ; url "URL" -> @string ; kaptain-0.73/examples/dia2code.kaptn0000640023433300116100000000207510120611342016116 0ustar zsolteng#!/usr/bin/kaptain start "Dia2Code" -> dia2code buttons; dia2code :tabbed -> main about; main "Dia2Code" -> "dia2code" language outdir classlist mask noclobber " " diagramfile; language "Output Language" -> " -t " outlanguage; outlanguage :double :horizontal -> ada | c | ! cpp | java | python | sql ; c "C" -> "c"; cpp "C++" -> "cpp"; java "Java" -> "java"; ada "Ada" -> "ada"; python "Python" -> "python"; sql "SQL" -> "sql"; outdir "Output Dir" -> " -d " @directory=`pwd`; classlist "Class list (foo,bar,...)" -> @ | " -cl " @string; mask "Reverse class list" -> @ | " -v"; noclobber "Don't overwrite existing files" -> @ | " -nc"; yesclobber -> ""; diagramfile "Diagram File" -> @infile("*.dia"); buttons :horizontal -> @action(dia2code)="Go" @preview(dia2code)="Preview Command" @close="Quit" ; about "About" -> @text("Kaptain grammar for Dia2Code\n\nVersion 1.0\n(c) 2001 Javier O'Hara\n\n\nDia2Code homepage:\nhttp://dia2code.sourceforge.net"); classlist="" "Generates code only for the classes specified\nin this comma-separated list"; kaptain-0.73/examples/emboss.tgz0000640023433300116100000006471010120611342015427 0ustar zsoltengGZ=]{W)y=1vc1lnݖ[=mg-W%/La&`uTURJU϶eAWE_,!^+++[߬nmTߩ *mxbV־+"kf^"7:nw?g˃4Yn2DoŞIeb 8龗fAFTtId^vPE"Q ͒5Ȕ2Een!HDd=%2S;|BUJPZaT ӝdIд ^hGqb-ga-d2;:f u(B/+[EmJE1ណћATu!1C]Źh(>4?nx0a)lAhlZ4vH7L4ip}L^4뢩T> 1ch;_[tGh3`a[+*Xa.w 4PG] bD #"-$dVeF~}Qlnm#/MEJ-=JvţXY[]~Q\4uVR7sݑF U+áV-DuH,)SOa3BG*hujM24miA_E&F RDՅH{l. VQGˇe][$[ƤY6kߚAơ7FA,J^WcAL1&5) ?kۋCO0`<=*a>\__c9Ե>DNA~ϋT;A e~7ã) *V ګj3!'Ay nJS JX-s5Ne͟ʧ;ۙjA~w@9d;Vܐ'|AbV;0ޖGA}n֓|nۣX4B+Ƞ=PQ'˩AJ^m,S!?̣&[Fb↚5&_\ yIZ`L:/3zӑ vXy*m= daFE] oNKCx0G~+J*jyѥ1r+j%45\ NKn17 WgD(/7Q_^FAG%,zMBOܿ[^}L*Md>  +[AtyI]S'Ӏfl?ʬ ]؛1jߩv۽ح`/*e"F3ꩣq`"k)},_Z/ ÑaSA"Aukj+&dAZIQ"K¦(1s]/S#Yz1Ig@O>&iH:kiVuO#K?I8^1&^ݩQ#ϼk [K?Z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Ï?o*I1M؉@W`ón6$xSxrYb,p0tP)c4\1JamahG!ß gTU=5IQ0%54rjq|gP<)Ox S(BP<)6f/#7E~_8., ?P4zqܘÊŲu+XVm3J7@S`fuP Vj2~Z9vRVĭM`1+XB /nAI6r_Wz t.9ɡ_v_/Xs(e9`f1U A:⏼֒bĪE l<P}ÿ0Q-pDfjYxemy-<9/J1CS,`1n7&gj p_)e`I`Z ᶉS(aU0ܼ5Fa_ oNg?vĥ+N3yDXvpHڋ,*zsL fscux01avX'\EUr4X5a'35F㛶lΧ`UoJ)ߚ\o $0莈PPf5*؃=n쒁d&֎p-i4+J|%mlˀ9u2 :c%RI5`9~-Ds (Xa@P(F/:`~<_AX_L")RO)`L41>J4ŅZEepUoRx{އo5x}ȶpc_*jHQCRԐ5!E )jHQCըVp9mhHgGDࢮ{O=>%BF{_ .bůnАۺV1 l =[ N8$߫C.r]KH$sDKfדa\7Gc x\kc/?'Q"Bm$a|$I'%BDHz饗^z饗^z饗^z饗^z饗^z饗^z饗^z饗^z饗^z饗^zz(kaptain-0.73/examples/enscript.kaptn0000640023433300116100000001144710120611342016276 0ustar zsolteng#!/usr/bin/kaptain # kaptain grammar for enscript # (c) 2000 Terek Zsolt start "Enscript" -> top bottom; top :tabbed -> body header; bottom :horizontal -> font_button ok_button cancel_button; ### Body tab body "Body" -> up down ; up :framed -> options; options :horizontal "Options" -> left center right; down :horizontal :framed ->files output; left -> wordwrap landscape media pretty_print encoding; center -> border trunc_lines nup columns high_bars linenum lines; right -> indent pages; # Options - column 1 wordwrap "Word wrap" "Wrap long lines from word boundaries" -> " --word-wrap"! | @; landscape "Landscape" -> " -r" | !@ ; border "Border around columns" -> " -j" | !@ ; trunc_lines "Truncate long lines" -> " -c" | !@ ; pretty_print "Pretty-print" -> !@ | " --pretty-print=" @combo( `enscript --help-pretty-print | sed -n -e /^Name:/s/Name:[[:space:]]*//p` ); media "Specify output media" -> @ | !" -M" @combo(x%enscript --list-media | sed -n -e 's/^\([A-Z][^[:space:]]*\).*$/\1/p' | sort %)=2; encoding "Encoding" -> !@ |" -X " @combo("latin1","latin2","latin3","latin4","cyrillic","greek","ascii","ibmpc","mac","vms","hp8","koi8","ps"); # Options - column 2 nup :beside "N-up printing" -> " -U " @integer=1 | @! ; columns :beside "Number of columns" -> " --columns=" @integer=1 | @! ; high_bars :beside "Highlight bars" -> " -H" @integer=2 | @! ; linenum :beside "Show line number starting at" -> " -C" @integer(-100,100)=1 | @! ; lines :beside "Number of lines per page" -> " -L " @integer=66 | @! ; # Options - column 3 indent :beside "Indent size" -> " -i " @regexp("^[0-9]*[cilp]?$")="8" | !@; pages :framed -> pages_ ; pages_ "Pages to print" -> pages0 | pages1; pages_ -> pages2 | pages3 | pages4; pages0 "All" -> @; pages1:horizontal:beside "Begin-End" -> " -a " @integer=1 to @integer=10; to "-" -> "-"; pages2:beside "Page" -> " -a " @integer=1; pages3 "Odd" -> " -a odd"; pages4 "Even" -> " -a even"; # Files files "Files to print" -> ifile @container(ifile); ifile :noeval -> " " @infile; # Output output "Output" -> stdout | ofile | printer; stdout "Standart output" -> " -p -"; ofile "To file" -> " -p " @outfile="out.ps" outops; outops:horizontal -> lang color; lang -> " -W " @combo("PostScript","html","overstrike","rtf"); color "Color" -> " --color" | @ ; printer "Printer" -> " -P " @string="lp"; # how to get printer list? from /etc/printcap? ### Header tab header:framed "Header" -> header_; header_ "Page header" -> header1 | header2 | header3 | userheader | !noheader ; header1 "File name, current date and current page/all pages left justified" -> q/ --header='$n %W Page $% of $='/; header2 "File name left, current date centered and current page/all pages right justified" -> q/ --header='$n|%W|Page $% of $='/; header3 "Current page number centered" -> q/ --header='|$%|'/; userheader "User specified header" -> headersymbols containers real_header; headersymbols :noeval :horizontal -> hdr_file | hdr_currdate | hdr_currpage | hdr_pagenum | hdr_any ; hdr_file "File name" -> '$n'; hdr_currdate "Current date" -> '%W'; hdr_currpage "Current page" -> '$%'; hdr_pagenum "Number of pages" -> '$='; hdr_any :beside "Text" -> @string; containers :framed :noeval :horizontal -> hdr_left hdr_center hdr_right ; hdr_left "Left" -> @container(headersymbols); hdr_center "Center" -> @container(headersymbols); hdr_right "Right" -> @container(headersymbols); real_header -> " --header='" hdr_left "|" hdr_center "|" hdr_right "'"; noheader "No header" -> " --no-header"; ### Font dialog fonts "Select fonts" -> fonts_ font_exit; fonts_ :framed -> font_choice; font_choice "Choose font" -> default | fixed | specfont ; default "Courier 10pt" -> @; fixed "Times 12pt" -> " -f Times-Roman12"; specfont "User specified" -> " -f " fontname fontsize; fontname "Font name" -> @list(`cat /usr/share/enscript/font.map | sed -n -e 's/[ ].*$//gp'`); fontsize "Font size (pt)" -> @combow("8\n10\n12\n14\n16\n18\n24")=2; font_exit -> @close="OK"; ### Button bar font_button -> @button(fonts) = "Fonts..."; ok_button -> @action(enscript)="Enscript"; # see the definition of enscript below cancel_button -> @close="Cancel"; # the command to be executed should contain data in the following order enscript -> "enscript" header fonts options output files ; #-------------------------------------------- #- the detailed description of some elements- #-------------------------------------------- indent= "" "Size of indentation" < command buttons ; buttons:horizontal -> @action(command)="OK" @close="Cancel" @button(help)="Help .." ; command :framed -> "find " up exec ; up :framed :horizontal -> left timeattr fileattr ; ## left :framed "options" -> path userattr print; path "starting directory" -> startdisp ; startdisp "default: current directory" -> @ | @string=`pwd` ; userattr :framed "User attritute" -> none | username | userid ; userid "user ID" -> " -user " @string ; username "username" -> " -user " @string=`echo $USER` ; none "all users" -> @ ; print "print search match on screen" -> " -print " | @ ; timeattr :framed "time attribute" -> alltime | ctime | mtime | newer ; alltime "all time" -> @ ; ctime "ctime in days ago" -> " -ctime +" ctimedisp " " ; ctimedisp -> @integer=30 ; mtime "mtime in days ago" -> " -mtime +" mtimedisp " " ; mtimedisp -> @integer=30 ; newer "newer then filename" -> " -newer " newdisp " "; newdisp -> @string="/tmp/time.sample" ; fileattr :framed "file attribute" -> filetype fstype match ; filetype :framed "filetype match" -> " -type " typedisp " " ; ##typedisp "filetype" -> @combo("file", "directory","link","device"); typedisp -> file | directory | link ; directory "directory" -> " d" ; file "regular file" -> " f" ; link "symbolic link" -> " l" ; fstype "File System type " -> fsdisp | @ ; fsdisp "ufs file system" -> "-fstype ufs " ; match "filename match (N/A)" -> @ | " -name " filedisp " "; filedisp "file name regexpr pattern" -> @string="\*.arc" ; ## down exec "exec command following sucessful find " -> execdisp ; execdisp "command" -> @ | " | xargs " nextcmd ; nextcmd -> @string="your command here (for example: ls -l )" ; help "No help current avaiable" -> @close="cancel" ; kaptain-0.73/examples/finger.kaptn0000640023433300116100000000174310120611342015717 0ustar zsolteng#!/usr/bin/kaptain # # finger grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "finger" -> command buttons; buttons:horizontal -> @action(command)="OK" @close="Cancel"; command :framed -> "finger " opt match user host ; opt :framed "Output format" -> short | ! long ; short "Short" -> "-s " shortdisp ; shortdisp -> hostname | office | ! default ; hostname "Display hostname" -> "-h " ; office "Display office phone" -> "-o " ; default "Default" -> " " ; long "Long" -> "-l " longdisp ; longdisp -> plan | ! @ ; plan "Don't show .plan / .project" -> "-p " ; match "Options" -> matching | ! @ ; matching "Users' real names" -> ! domatch | dontmatch ; domatch "Match" -> "-M " ; dontmatch "Don't match" -> "-m " ; user "User name" -> @string ; host "Hostname" -> ! localhost | foreign ; localhost "localhost" -> " " ; foreign "Foreign" -> "@" fhostname ; fhostname -> @string ; kaptain-0.73/examples/grep.kaptn0000640023433300116100000000402210120611343015374 0ustar zsolteng#!/usr/bin/kaptain # # grep utility for Kaptain # written by Bojan Kverh 28.9.2000 start "Grep" -> window buttons; window -> alloptions word directory mask ; grep -> show "grep " alloptions " -e \'" word "\' " directory mask "; echo; echo"; show -> upedge title author downedge banner; upedge -> "echo; echo; echo '########################################################'; "; downedge -> "echo '########################################################'; "; title -> "echo '# Grep script for Kaptain #';"; author -> "echo '# Written by Bojan Kverh (bojank@amanda.fri.uni-lj.si) #'; "; banner -> "echo; echo Grep results:; echo -------------; echo; echo;"; word "Expression to look for:" -> @string; directory "Start searching in directory (if non-null it should end with /):" -> @directory; mask "Search in files:" -> @string="*"; alloptions :horizontal -> options others; others -> interprete lines; interprete :framed -> radiobuttons; radiobuttons " Interprete expression as "-> basic | extended | fixed; basic "basic regular expression" -> "-G "; extended "extended regular expression" -> "-E "; fixed "fixed string" -> "-F "; options -> addoptions printoptions; addoptions :framed -> fr_addoptions; fr_addoptions " Additional options " -> case number nonmatch; number "Print leading line numbers" -> "-n " | ""; case "Ignore case" -> "-i " | ! ""; nonmatch "Invert matching expression" -> "-v " | ! ""; printoptions :framed -> print; print " Print only " -> printlines | printnumber | printfiles | printinvertfiles; printlines "whole lines containing expression" -> ""; printnumber "number of lines containing expression" -> "-c "; printfiles "files containing expression" -> "-l "; printinvertfiles "files not containing expression" -> "-L "; lines :framed -> alllines; alllines " Print additional lines " -> "-B"linesbefore " -A" linesafter " "; linesbefore "Before the match:" -> @integer(0,100)=0; linesafter "After the match:" -> @integer(0,100)=0; buttons :horizontal -> @action(grep)="OK" @close="Cancel"; kaptain-0.73/examples/indent.kaptn0000640023433300116100000001536610120611342015734 0ustar zsolteng#!/usr/bin/kaptain start "Indent" -> settings usersel buttonbar; settings :horizontal -> left files; left :framed -> choice0 options; files :framed -> files0; files0 "Files" -> onefile morefiles output; onefile :noeval -> thefile; thefile -> " " @infile; morefiles -> @container(onefile); output "Work on one input file, with output file" -> thefile " -o " @outfile | !@; choice0 "Coding style" -> kr | gnu | orig | profile |!user; realchoice -> " -kr" | " -gnu" | " -orig" | @ | usersel ; realchoice <- choice0; kr "Kernighan && Ritchie coding style" -> @; gnu "GNU coding style" -> @; orig "Original Berkeley" -> @; profile "User's profile" -> @; user "User defined" -> @; options "Options" -> modify; modify "Preserve access and modification time" -> "-pmt" | @; usersel:framed -> usersel0; usersel0 "User defined coding style" -> usersel1; usersel1 :tree :beside -> blank_lines comments statements declarations indentation breaklines; buttonbar :horizontal -> @echo(command)="OK" writeprofile @close="Cancel"; command -> "indent " options realchoice files; writeprofile :dialog "Write profile" -> message yesno; message :horizontal -> @icon("stop.png") text; text " Do you want to write settings to ~/.indent.pro ?" -> @; yesno :horizontal -> @execclose(cattoprofile)="Yes" @close="No"; cattoprofile -> "echo '" usersel "' > $HOME/.indent.pro"; #-------------------------------------------------------------- statements -> st_brace_left st_cuddle_else st_space_after ; st_brace_left -> " -bl" ! | " -br" ; st_cuddle_else -> " -ce" | ! " -nce"; st_space_after -> st_space_special st_space_proc_call st_space_cast st_space_sizeof st_space_parentheses ; st_space_special -> " -ss" | " -nss" ; st_space_proc_call -> " -pcs" ! | " -npcs" ; st_space_cast -> " -cs" ! | " -ncs" ; st_space_sizeof -> " -bs" | ! @ ; st_space_parentheses -> " -prs" | ! " -nprs" ; declarations -> dl_blank_comma dl_braces_struct dl_proc_line ; dl_blank_comma -> " -bc" | ! " -nbc" ; dl_braces_struct -> " -brs" | ! " -bls" ; dl_proc_line -> " -psl" ! | " -npsl" ; comments -> cm_format cm_format_first cm_delims_blank cm_star_comment cm_right; cm_format -> " -fca" | ! " -nfca" ; cm_format_first -> " -fc1" | ! " -nfc1" ; cm_delims_blank -> " -cdb" | ! " -ncdb" ; cm_star_comment -> " -sc" | ! " -nsc" ; cm_right -> cm_code_comment cm_decl_comment cm_prep_comment @fill; cm_code_comment -> " -c" @integer=1 | ! @ ; cm_decl_comment -> " -cd" @integer=1 | ! @ ; cm_prep_comment -> " -cp" @integer=1 ! | @ ; blank_lines -> bl_after_block_decl bl_after_proc_body bl_before_box_comment bl_swallow_optional ; bl_after_block_decl -> " -bad" | ! " -nbad" ; bl_after_proc_body -> " -bap" ! | " -nbap" ; bl_before_box_comment -> " -bbb" | ! @ ; bl_swallow_optional -> " -sob" | ! " -nsob" ; indentation -> in_cont_par in_leave_pp st_indent in_other; in_cont_par -> " -lp" ! | " -nlp" ; in_leave_pp -> " -lps" | ! @ ; st_indent -> st_brace_indent st_cont_indent st_case_label_indent st_case_brace_indent st_paren_indent @fill; st_brace_indent -> " -bli" @integer=2 ! | @ ; st_cont_indent -> " -ci" @integer=2 | ! @ ; st_case_label_indent -> " -cli" @integer=2 | ! @ ; st_case_brace_indent -> " -cbi" @integer=0 | ! @ ; st_paren_indent -> " -pi" @integer=1 | ! @ ; in_other -> in_level in_param in_brace in_tab_size dl_indent cm_line_comment_indent @fill; in_level -> " -i" @integer=2 ! | @ ; in_param -> " -ip" @integer=5 ! | " -nip" ; in_brace -> " -sin" @integer=0 | ! @; in_tab_size -> " -ts" @integer=8 | ! @; dl_indent -> " -di" @integer=2 ! | @; cm_line_comment_indent -> " -d" @integer=2 | ! @ ; breaklines -> bl_bool_op bl_pref_nl bl_break_length; bl_break_length -> bl_line_length cm_line_length @fill; bl_line_length -> " -l" @integer=78 | ! @; cm_line_length -> " -lc" @integer=78 | ! @ ; bl_bool_op -> " -bbo" ! | " -nbbo"; bl_pref_nl -> " -hnl" ! | " -nhnl"; #-------------------------------------------------------------- blank_lines :tree = "Blank lines" ; bl_after_block_decl = "After block declaration"; bl_after_proc_body = "After procedure body" "" "" ; bl_before_box_comment = "Before boxed comments" ; bl_swallow_optional = "Swallow optional blank lines"; comments :tree = "Comments"; cm_format = "Format comments" ; cm_format_first = "Format first column comments" ; cm_line_comment_indent :beside = "Line comment indention" ; cm_delims_blank = "Comment delimiters on blank lines" ; cm_right = "Comments right to ..." ; cm_code_comment :beside = "... the code in column" "Put comments to the right of the code in the given column." ; cm_decl_comment :beside = "... the declarations in column" "Put comments to the right of the declaration in the given column." ; cm_prep_comment :beside = "... the preprocessor in column" "Put comments to the right of the preprocessor statements in the given column." ; cm_star_comment = "Put * on the left of comments"; statements :tree = "Statements" ; st_brace_left = "Braces after the `if', `for', etc. lines" ; st_brace_indent :beside = "Indent braces" ; st_cuddle_else = "Cuddle up else and preceeding `}'" ; st_cont_indent :beside = "Continuation indentation of" ; st_case_label_indent :beside = "Indent case labels by" ; st_case_brace_indent :beside = "Case brace indentation of" ; st_paren_indent :beside = "Extra indentation per open parentheses" ; st_space_after :tree = "Space after"; st_space_special = "Single `for', `while' lines before `;'" ; st_space_proc_call = "Procedure calls" ; st_space_cast = "Cast" ; st_space_sizeof = "sizeof" ; st_space_parentheses = "parentheses (inside)" ; declarations :tree = "Declarations" ; dl_indent :beside = "Variable indentation" "Put variables in column n" ; dl_blank_comma = "Newlines after commas" "Insert newlines after commas in declarations"; dl_braces_struct = "Braces on struct declaration line" ; dl_proc_line = "Procname on a new line"; indentation :tree = "Indentation" ; in_level :beside = "Indentation level"; in_cont_par = "Continued lines lined up at parentheses" ; in_leave_pp = "Leave space before preprocessor directives" "Leave space between `#' and preprocessor directives"; in_param :beside = "Parameter indentation in old-style functions" ; in_brace :beside = "Braces of `enum', `struct', `union'"; in_tab_size :beside = "Tab size" ; st_indent = "Statements..."; in_other = "Others..."; breaklines :tree = "Break long lines" ; bl_break_length = "Line lengths..." ; bl_line_length :beside = "Maximum non-comment line length" ; cm_line_length :beside = "Maximum comment line length" ; bl_bool_op = "Break before boolean operators" ; bl_pref_nl = "Prefer break at newlines in the input";kaptain-0.73/examples/lameGUI.kaptn0000640023433300116100000005436110120611343015735 0ustar zsolteng#!/usr/bin/kaptain # # lameGUI version 0.21 using kaptain grammer (C) 2000 by Jens Henrik Goebbert, goebbert@epost.de # released under the GNU General Public License, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "LameGUI (Lame MP3 Encoder)"-> lame buttons; lame :tabbed :reverse -> audio_options lame_options general; #----------BASICS----------- general "general"-> up_1 down_1; up_1 :horizontal -> left right; left :framed -> input; input "input device" -> audio | file!; audio "direct recording" -> " - "; file "wav-file" -> " "@infile("*.wav")="~/test.wav"" "; input_2 -> ao_up" | " | ""; input_2 <- input; right :framed -> output konsole; output "output file" -> " "@outfile("*.mp3")="~/test.mp3"; konsole "konsole"-> the_konsole; the_konsole "see all output" -> "konsole --caption LameGUI-Output --notoolbar --nohist --nowelcome --vt_sz 120x20 -e bash -c '" |@; the_konsole_2->";echo;echo finished ... will close in 3 sec;sleep 3 '"|""; the_konsole_2<-the_konsole; down_1 -> @; #--------detailed BASICS description---------- output=""< an existing file would be overwritten END ; audio="""you want to record from your soundcard directly"; file="""you want to convert a WAV file to an mp3"; down_1=< please send ideas and bugreports <---- END ; #----------lame Options--------- lame_options "lame options" -> l_up l_down; l_up :horizontal :framed-> l_fixed | l_variable; l_fixed "fixed bitrate"->l_fixed_2; l_fixed_2 :framed ->l_bitraten l_quality; l_bitraten :beside "bitrate" -> " -b "@combo("32","40","48","56","64","80","96","112","128","160","192","224","256","320")=9" "; l_quality :horizontal "mp3 quality" ->l_high | l_normal ! | l_low ; l_high "high" -> " -h "; l_normal "normal" -> ""; l_low "low" -> " -f "; l_variable "variable bitrate" ->l_variable_2; l_variable_2 ->l_vb_up l_vb_down; l_vb_up :framed :horizontal->l_vb_min l_vb_max; l_vb_min :beside "min. bitrate" -> " -b " @combo("32","40","48","56","64","80","96","112","128","160","192","224","256","320")=4" "; l_vb_max :beside "max. bitrate" -> " -B " @combo("8","16","32","40","48","56","64","80","96","112","128","160","192","224","256","320")=16 " "; l_vb_down :horizontal -> l_vb_down_1 l_vb_down_2; l_vb_down_1 :framed -> l_vb_quality; l_vb_quality "VBR quality" ->" -V "@integer(0,9)=4" "; l_vb_down_2 :framed -> l_vbrheader; l_vbrheader "VBR header" -> l_vbrheader2; l_vbrheader2 "yes/no"-> " -t " | @; l_down -> l_forboth extras; l_forboth :horizontal-> l_sm l_resamplebox; l_sm :framed ->l_stereo_mono; l_stereo_mono :horizontal "encode in..." -> l_mono |l_stereo !| l_jointstereo | l_forcejoint; l_stereo "stereo" -> " -m s "; l_mono "mono" -> " -m m "; l_jointstereo "joint stereo" -> " -m j "; l_forcejoint "force joint stereo" ->" -m f "; l_resamplebox :framed -> l_resample; l_resample "resample to ..." ->l_rs; l_rs :beside -> " --resample " @combo("16","22.05","24","32","44.1","48")=5" " | @!; #--------detailed lame options description---------------- l_fixed="""use a fixed bitrate which is faster to encode"< al_up al_down; al_up :framed -> al_options; al_options :horizontal -> al_left al_center al_right; al_left -> al_c al_o al_g al_a al_d al_ath al_abr al_preset al_e; al_center -> al_nores al_noshort al_F al_p al_r al_S al_x al_strict_ISO al_nohist; al_right -> al_filter ; al_a "downmix stereo file to mono" -> " -a " |@!; al_abr :beside "average bitrate encoding" -> " -abr "@integer(4,310)=100 |@!; al_nohist "disable histogram display" ->" --nohist "|@!; al_nores "disable bit reservoir" ->" --nores "|@!; al_noshort "disable short block frames" ->" --noshort "|@!; al_o "mark mp3 as copy" ->" -o "|@!; al_p "error protection" ->" -p "|@!; al_preset :beside "use built in presets" ->" --preset "@combo("phone","voice","fm","tape","hifi","cd","studio")=4" " |@!; al_r "input file is raw pcm" ->" -r "|@!; al_S "silent operation" ->" -S "|@!; al_strict_ISO "strict ISO compliance" ->" --strictly-enforce-ISO "|@!; al_x "swapbytes" ->" -x "|@!; al_c "copyright" -> " -c " |@!; al_d "block type control" -> " -d "|@!; al_e :beside "de-emphasis" -> " -e "@combo("n","5","c")" "|@!; al_F "strictly enforce the -b option"-> " -F " |@!; al_g "graphical frame analyser" -> " -g " |@!; al_filter :framed ->al_filter_2; al_filter_2 "Bandwidth settings..." -> al_filter_default | al_filter_manual | al_k; al_filter_default "default settings" -> ""; al_filter_manual "manual filter settings" -> al_highpasstext al_lowpasstext; al_k "full bandwidth" ->" -k "; al_highpasstext :framed -> al_high; al_high "highpass" ->al_highpass al_highpass_width; al_highpass :beside "filtering frequency in kHz" ->" --highpass "@integer(0,20)=0" "|@!; al_highpass_width :beside "width of filtering in kHz" ->" --highpass-width "@integer(0,20)=0" "|@!; al_lowpasstext :framed ->al_low; al_low "lowpass" -> al_lowpass al_lowpass_width; al_lowpass :beside "filtering frequency in kHz" ->" --lowpass " @integer(0,20)=20|@!; al_lowpass_width :beside "width of filtering in kHz" ->" --lowpass-width " @integer(0,20)=20" "|@!; al_ath "ATH options ..." -> al_ath2 |@!; al_ath2 :horizontal -> al_athonly | al_noath; al_athonly "only ATH" -> " -athonly "; al_noath "no ATH" -> " --noath "; #al_mp3input #al_decode #al_disptime #al_comp "choose sompression ratio" -> " --comp " |@!; #al_freeformat "free format bitstream" -> " --freeformat " |@!; al_down -> @close="OK"; #-------------detailed description of advanced lame options ------------ al_filter_default="""Lame uses his default filter settings"; al_filter_manual="""You can set up your own filter settings here"; al_a="" "Mix the stereo input file to mono and encode as mono.(only for PCM input)" < ATH"; al_athonly="" "This option causes LAME to ignore the output of the psy-model and only use masking from the ATH" < ao_up ao_down; ao_up :horizontal :framed ->ao_arecord | ao_user; ao_arecord "use 'arecord'" -> ao_sample_fr; ao_sample_fr :framed -> ao_sample ao_stereo_mono; ao_sample "record from soundcard with ..."-> ao_dsp | ao_cd ! ; ao_cd "cd quality (44100Hz - 16-bit)"->"arecord -w -m "; ao_dsp "dat quality (48000Hz - 16-bit)"->"arecord -w -M "; ao_stereo_mono :horizontal "record from soundcard with..." -> ao_stereo | ao_mono ; ao_stereo "stereo" -> " -S "; ao_mono "mono" -> ""; ao_user "use manual settings" -> ao_up_right; ao_up_right :framed ->ao_direct; ao_direct :beside ->ao_manual ao_manual_text; ao_manual->@string="arecord -w -m "; ao_manual_text->@text(< ao_channel; ao_channel -> @action("kmix")="select input channel"; #---------------detailed audio options description------------ ao_cd="" < mp3_buttons gui_buttons; gui_buttons "LameGUI" -> @exec("rm -f ~/.lameGUI.pid")="exit"; mp3_buttons :horizontal "encoding" -> ba_start ba_preview ba_stop; ba_start ->@action(encode)="start"; ba_preview->@preview(encode)="preview"; ba_stop ->@action(stopit)="stop"; encode ->the_konsole input_2 " lame "l_stereo_mono l_resample l_up al_up input output the_konsole_2 " & echo $! > ~/.lameGUI.pid"; stopit -> "kill $(cat ~/.lameGUI.pid) & echo recording stopped"; #---------------detailed button-and-action description------------- ba_start=""< avoid pressing twice on the start button because that will start another prozess, which can only be stopped manuelly (with "ps -x" and "kill ...") END ; ba_preview=""< @; start "List Short" -> descr ecommand buttons; descr -> @text ( "GUI interface to the famous `ls' (list short) command." ); ecommand -> "e_cmd () { echo \"cmd # $1\"; eval \"$1\"; }; e_cmd '" command "'"; command -> "ls" args; args -> scope fformat forder fmoreargs; scope :horizontal :framed -> hidden recursion; hidden "Hidden files" "Show files starting with a period" -> all | almostall | !nohidden; all "all" "Do not hide entries starting with ." -> " -a"; almostall "almost all" "Do not list implied . and .." -> " -A"; nohidden "no hidden files" "Do not show hidden files" -> @; recursion "Recursion" -> recurse | !norecurse | nodirs; recurse "Recurse" "Recurse into subdirectories" -> " -R"; norecurse "Normal" "Do not recurse into subdirectories" -> @; nodirs "Directory entries" "List directory entries instead of contents" -> " -d"; fformat :framed -> format; format :horizontal "Format" -> col type; col :horizontal -> single | long | ! columns; single "Single" "Single column output" -> " -1"; long "Long" "Long listing format" -> " -l"; columns "Columns" "Standard multi-column format" -> @; type "Classify" "Append indicator (one of */=@|) to entries" -> " -F"| @; forder :framed -> order; order :double "Order" -> time | extension | version | size | !none | filesys; extension "Extension" -> " --sort=extension"; size "Size" -> " --sort=size"; filesys "File system" -> " --sort=none"; time "Time" -> " --sort=time"; version "Version" -> " --sort=version"; none "Name" -> @; fmoreargs :framed -> moreargs; moreargs "Arguments" -> useargs; useargs :horizontal "Use" -> !@ | " " @string="${KAPTAIN_SCRIPT_ARGS}"; buttons:horizontal -> @echo( command )="Echo" @action(ecommand)="Do it!" @close="Dismiss" help; help :dialog "Help" -> @edit( "courier", 500, 400 )=`mf () { sed 's,.,,g;'; }; PAGER=cat man ls | mf` @close="OK"; #help :dialog "Help" -> @edit("courier")=`ls --help` @close="OK"; #help :dialog "Help" -> @text( `ls --help` ) @close="OK"; # Local Variables: # mode: perl # End: kaptain-0.73/examples/mpage.kaptn0000640023433300116100000001646010120611342015540 0ustar zsolteng#!/usr/bin/kaptain ######################################################################## # # Kaptain grammar for mpage # # Version 0.9 by Javier O'Hara # ######################################################################## start "Mpage" -> mpage buttons; mpage :tabbed -> "mpage " paper " " margins headers misc range " " io about; ######################################################################## # Paper settings ######################################################################## paper "Paper" -> papersize " " scale orientation twoside; papersize :beside "Paper Size" -> "-b" @combo("A4","Legal","Letter") ; orientation :framed -> pageorientation direction; pageorientation :horizontal "Page Orientation" -> ! portrait | landscape; portrait "Portrait" -> ""; landscape "Landscape" -> " -l"; scale :beside "Pages per sheet" -> "-" @combo("1","2","4","8")=3 ; direction :horizontal "Run pages" -> ! updown | leftright ; updown "Up-Down" -> "" ; leftright "Left-Right" -> " -a"; twoside "Two side printing" -> @ | " -t" tumble; tumble "Tumble on second pages" -> @ | " -T"; ######################################################################## # Margins ######################################################################## margins :framed "Margins" -> sheetmargins " " logicalmargins " " textboxmargins; sheetmargins :horizontal "Sheet Margins" -> "-m" topsmargin leftsmargin rightsmargin bottomsmargin; topsmargin :beside "Top" -> @integer(-1000,1000)=20 "t"; leftsmargin :beside "Left" -> @integer(-1000,1000)=20 "l"; rightsmargin :beside "Right" -> @integer(-1000,1000)=20 "r"; bottomsmargin :beside "Bottom" -> @integer(-1000,1000)=20 "b"; logicalmargins :horizontal "Logical Page Margins" -> "-M" toplmargin leftlmargin rightlmargin bottomlmargin; toplmargin :beside "Top" -> @integer(-1000,1000)=8 "t"; leftlmargin :beside "Left" -> @integer(-1000,1000)=8 "l"; rightlmargin :beside "Right" -> @integer(-1000,1000)=8 "r"; bottomlmargin :beside "Bottom" -> @integer(-1000,1000)=8 "b"; textboxmargins :horizontal "Text Box Margins" -> "-B" toptmargin lefttmargin righttmargin bottomtmargin; toptmargin :beside "Top" -> @integer=0 "t"; lefttmargin :beside "Left" -> @integer=0 "l"; righttmargin :beside "Right" -> @integer=0 "r"; bottomtmargin :beside "Bottom" -> @integer=0 "b"; ######################################################################## # Misc ######################################################################## misc :framed "Misc" -> miscoptions; miscoptions "Misc" -> outlines force tabstop indent lines width fold; outlines "Page outlines" -> ! yesoutlines | nooutlines ; yesoutlines -> "" ; nooutlines -> " -o"; fold "Fold lines longer than page width" -> @ | " -f"; force "Force input to" -> @ | " -d" forced; forced :horizontal -> ascii | postscript; ascii "ASCII" -> "a"; postscript "Postscript" -> "p"; lines :beside "Lines to fit in a page" -> @ | " -L" @integer(0,1000); width :beside "Width of lines to fit in a page" -> @ | " -W" @integer(0,1000); indent :beside "Indent text by" -> @ | " -I" @integer(0,1000); tabstop :beside "Tab Stop length" -> " -s" @integer(2,1000)=8; ######################################################################## # Page range ######################################################################## range "Range" -> pagerange reverse leftrightmode; pagerange -> all | userdefined; all "Print all pages" -> ""; userdefined "User defined" -> " -j" first last interval ; first :beside "First" -> @integer = 1; last :beside "Last" -> @ | "-" @integer = 1; interval :beside "Interval" -> @ | "%" @integer = 1; reverse "Reverse pages" -> @ | " -r"; leftrightmode "Left-to-Right mode" -> @ | " -R"; ######################################################################## # Headers ######################################################################## headers "Headers" -> header physicalheader; header "Logical Page Header" -> @ | " -H" headercontent; headercontent "Content" -> @ | " -h" @string; physicalheader "Physical Page Header" -> @ | " -X " @string; ######################################################################## # Input/Output ######################################################################## io :reverse :framed "I/O" -> "-P" output " " inputfile; inputfile "Input File" -> @infile("*.ps"); output "Output" -> stdout | printer ; stdout "Standard Output" -> "-"; printer "Printer" -> defaultprinter | otherprinter; defaultprinter "Default" -> ""; otherprinter "Other" -> @combo(`ls /dev/lp*`); ######################################################################## # About ######################################################################## about "About" -> @text("Kaptain grammar for mpage.\n\nVersion 0.9 by Javier O'Hara \n\nThe tooltip text was taken from the original mpage manual.\n\nmpage is (c) Mark P. Hahn and Marcel Mol.") ; buttons :horizontal -> @action(mpage)="Go" @preview(mpage)="Preview command" @close="Quit"; leftrightmode="" "Switch to left to right mode, starting first page on left bottom corner.\nThis might be useful for landscape postscript files."; outlines="" "Toggle printing of outlines around each reduced page."; reverse="" "Reverse printing. The last sheet is printed first. The way of arranging\nreduced pages on the sheets doesn't change."; twoside="" "Toggle printing on both sides of the paper. This will toggle duplex mode of the printer.\nUse this option only if your printer is capable of printing in duplex mode."; tumble="" "Toggle tumble of every second pages when printing in duplex mode."; force="" " Force input to be taken as ascii or postscript text. This way you can print your postscript\n code as text, or print postscript code that mpage does not recognise. When using postscript,\n make sure that the the postscript code contains %Page page separators or else things will\n probably look odd."; papersize="" " Prepare output for selected paper size. Papersize can be A4 for European A4,\n Letter for US Letter or Legal for Legal sized paper."; leftright="" "Toggle layout of the pages on the sheet so that successively numbered pages\n run right the sheet, as opposed to up to down."; updown="" " Toggle layout of the pages on the sheet so that successively numbered pages\n run down the sheet, as opposed to left to right."; portrait="" "Toggle printing landscape or portrait mode. Landscape pages are 55\n lines long by 132 characters wide by default. Portrait pages are\n66 lines long by 80 characters wide by default."; landscape="" "Toggle printing landscape or portrait mode. Landscape pages are 55\n lines long by 132 characters wide by default. Portrait pages are\n66 lines long by 80 characters wide by default."; header="" "Create header line for each logical page separated from page text\nby a horizontal line. Unless a value is given, the header consist\nof last file changetime, filename and page number, all in bold and\nslightly larger font. This option only applies to non-postscript files."; physicalheader="" "Print header centered on each physical page (sheet). If no\nheader is given, the default is the current filename on the left\nand the page number on the right."; width="" "Adjust the page reduction parameters so that a line width characters\nlong will fit in the space of one page. This overrides the default\nzzzzzzzzvalues normally supplied."; kaptain-0.73/examples/nslookup.kaptn0000640023433300116100000000664610120611342016326 0ustar zsolteng#!/usr/bin/kaptain # # nslookup grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "nslookup" -> ui buttons ; ui :framed -> options server hosttofind ; buttons:horizontal -> @action(command)="OK" @button(qopt)="Query options" @close="Cancel"; command -> "nslookup " options qoptions hosttofind " " server ; options :horizontal "Options" -> opt1 opt2 ; opt1 -> domain defname search port recurse ; opt2 -> retries root timeout ignoretc vc debugmode ; qopt "Query options" -> qoptions @close="OK" ; qoptions :framed -> selectclass querytype ; selectclass "Query class" -> in | chaos | hesiod | ! classany ; in "Internet" -> "-class=in " ; chaos "Chaos" -> "-class=chaos " ; hesiod "MIT Athena Hesiod" -> "-class=hesiod " ; classany "Any" -> "-class=any " ; debugmode -> enabledebug | ! @ ; enabledebug "Enable debugging" -> ! normaldebug | alldebug ; normaldebug "Standard debug output" -> "-debug " ; alldebug "Exhaustive debug output" -> "-debug -d2 " ; domain -> domains | ! @ ; domains "Default domain names" -> ! setdomain | searchlist ; setdomain "Set default domain name only" -> "-domain=" domainname " " ; domainname -> @string ; searchlist "Set default domain name and searchlist" -> "-srchlist=" srchlist " " ; srchlist -> @string="name1/.../name6" ; defname -> nodefname | ! @ ; nodefname "Don't append default domain name to single-component lookup request" -> "-nodefname " ; search -> nosearch | ! @ ; nosearch "Never append domain names from domain search list" -> "-nosearch" ; port -> setport | ! @ ; setport "Use TCP/UDP port" -> "-port=" porttouse " "; porttouse -> @integer=53 ; querytype "Query for" -> a | cname | hinfo | minfo | mx | ns | ptr | soa | txt | uinfo | wks | ! any | axfr | mb | md | mf | null ; a "Internet address" -> "-type=a " ; cname "Canonical name for an alias" -> "-type=cname " ; hinfo "CPU and OS type" -> "-type=hinfo " ; minfo "Mailbox or mail list information" -> "-type=minfo " ; mx "Mail exchanger" -> "-type=mx " ; ns "Name server for the named zone" -> "-type=ns " ; ptr "Host name/other information" -> "-type=ptr " ; soa "State of Authority" -> "-type=soa " ; txt "Text information" -> "-type=txt " ; uinfo "User information" -> "-type=uinfo " ; wks "Well-known Services supported" -> "-type=wks " ; any "Any" -> "-type=any " ; axfr "AXFR (cf. RFC 1035)" -> "-type=axfr " ; mb "MB (cf. RFC 1035)" -> "-type=mb " ; md "MD (cf. RFC 1035)" -> "-type=md " ; mf "MF (cf. RFC 1035)" -> "-type=mf " ; null "NULL (cf. RFC 1035)" -> "-type=null " ; recurse -> norecurse | ! @ ; norecurse "Instruct name server not to query other servers" -> "-norecurse " ; retries -> setretries | ! @ ; setretries "Set number of retries" -> "-retry=" numberofretries " " ; numberofretries -> @integer=4 ; root -> setroot | ! @ ; setroot "Change the name of the root server" -> "-root=" roothost " " ; roothost -> @string="ns.internic.net" ; timeout -> settimeout | ! @ ; settimeout "Set timeout interval to ___ seconds" -> "-timeout=" timeoutsec " " ; timeoutsec -> @integer=5 ; vc -> virtualcircuit | ! @ ; virtualcircuit "Always use virtual circuit when sending requests" -> "-vc " ; ignoretc -> doignoretc | ! @ ; doignoretc "Ignore packet truncation errors" -> "-ignoretc " ; hosttofind "Host to look for" -> @string ; server "Server" -> setserver | ! @ ; setserver "Specify server to use" -> "-" servername ; servername -> @string ; kaptain-0.73/examples/open.kaptn0000640023433300116100000000111610120611342015400 0ustar zsolteng#!/usr/bin/kaptain # # open site using xterm grammer (C) 2000 by Jeffrey Johnson, johjeff@nortelnetworks.com # released under the GNU General Public License, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "Site Connect" -> commandx buttons; buttons:horizontal -> @action(commandx)="GO!" @close="Cancel"; commandx :framed -> "xterm -geometry 100x5+0+0 -e ""rexec " HOSTNAME " -l " UNAME PASSWORD " 'export DISPLAY=w8pph00m:0.0;xterm -name `uname -n`'" ; UNAME "Login Name: " -> @string ; HOSTNAME "Connect To Host: " -> @string ; PASSWORD "Enter Your Password: " -> @password ; kaptain-0.73/examples/ping.kaptn0000640023433300116100000000464210120611343015404 0ustar zsolteng#!/usr/bin/kaptain # # ping grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "Ping" -> command buttons ; buttons :horizontal -> @action(command)="OK" @close="Cancel" ; command :framed -> "ping " opt outp type host ; opt :framed :horizontal "Ping options" -> opt1 opt2 ; opt1 "Options" -> coun dontfrag sodeb interf pre num pad ; opt2 "More options" -> recroute noroute packsize tos ttl maxwai noloo ; outp "Output" -> output | ! @ ; output "Specify output type" -> ! verbose | quiet ; verbose "Verbose" -> "-v " ; quiet "Quiet" -> "-q " ; type "Ping type" -> flood | wait | !normal ; coun -> count | ! @ ; count "Maximum # of packets to transmit" -> "-c " countcount " "; countcount -> @integer=10 ; dontfrag -> dontfragment | ! @ ; dontfragment "Don't fragment packets" -> "-D " ; sodeb -> sodebug | ! @ ; sodebug "Set SO_DEBUG on the socket used" -> "-d " ; interf -> interface | ! @ ; interface "Specify interface address to use" -> "-I " ifaddr " "; ifaddr -> @string ; pre -> preload | ! @ ; preload "# of packets to spew out as fast as possible (root only)" -> "-l " preloadcount " " ; preloadcount -> @integer ; num -> numeric | ! @ ; numeric "Don't look up hostnames" -> "-n " ; pad -> padding | ! @ ; padding "Specify pad bytes (up to 16)" -> "-p " padpattern " " ; padpattern -> @string="ff" ; recroute -> recordroute | ! @ ; recordroute "Try to record route (may not work!)" -> "-R " ; noroute -> norouting | ! @ ; norouting "Bypass routing tables (works only on directly-attached networks!" -> "-r " ; packsize -> packetsize | ! @ ; packetsize "Specify number of data bytes in ICMP packet" -> "-s " packetbytes " " ; packetbytes -> @integer=56 ; tos -> typeos | ! @ ; typeos "Specify type of service" -> "-T " typeofservice " " ; typeofservice -> @integer ; ttl -> timetl | ! @ ; timetl "Specify time-to-live" -> "-t " timetolive " " ; timetolive -> @integer=30 ; maxwai -> maxwait | ! @ ; maxwait "Specify # of seconds to wait for response to a packet" -> "-w " maxwaittime " " ; maxwaittime -> @integer=10 ; noloo -> noloop | ! @ ; noloop "Disable loopback for multicast pings" -> "-L " ; flood "Flood ping (root only)" -> "-f " ; wait "Send individual packets with specified delay" -> "-i " waitsec ; waitsec "# of seconds to wait" -> @integer=5 ; normal "Normal ping" -> " " ; host "Address to ping" -> @string ; kaptain-0.73/examples/povray.kaptn0000640023433300116100000000232410120611342015761 0ustar zsolteng#!/usr/bin/kaptain # # Desc: PoV-Ray frontend script # Cration Date: 2001.12.29. # Author: Fabian Zoltan # e-mail: dzooli@freemail.hu # # Remarks: This is my first kaptain script # # Main dialog start -> "x-povray " ini input q_options options other_options resolution buttons ; ini "INI file:" -> @infile("*.ini"); input "Filename:" -> " -i"@infile("*.pov"); q_options:horizontal:framed -> quality buffsize use_aa; quality "Image quality:" -> " +Q" @integer(0,9) = 9; buffsize "Buffer size: " -> " +B" @integer(128,1024) = 128; use_aa "Antialiasing: " -> " +A" @float = "0.0"; options:horizontal:framed -> pause alias disp; alias "No Adaptive AA" -> " +AM1" | " +AM2"; pause "Pause when done" -> " +P" | " -P"; disp "Displaying" -> " +D" | " -D"; other_options:horizontal:framed -> tabort verbose; tabort "Test abort" -> " +X" | "-X"; verbose "Verbose output" -> " +V" | "-V"; resolution:horizontal:framed -> xresolution yresolution; xresolution "Horizontal image size:" -> " -w" @list("160","320","512","640","720","800","1024") = 2; yresolution "Vertical image size:" -> " -h" @list("120","240","384","480","576","600","768") = 2; buttons:horizontal -> @action(start)="Start" @close="Quit" @preview(start)="Preview"; kaptain-0.73/examples/procmail.kaptn0000640023433300116100000001013410120611343016246 0ustar zsolteng#!/usr/bin/kaptain start :wizard "Procmail" -> intro setup finish; intro "Hi,"-> intro1 intro2; intro1 :horizontal -> text1 introa; text1 -> @text("This is a graphical front-end for creating procmail\ configuration files made using Kaptain, the Universal graphical front-end."); intro2 "" -> @; introa "" -> maildir lockfile @fill; maildir "Mail Directory" -> "\nMAILDIR=" @directory="$HOME"; lockfile "Lock file" -> "\nLOCKFILE=" @string | @!; finish :horizontal "Finish" -> text3 other_settings; text3 -> @text("Now press the Preview button to see the settings you have made.\ Don't forget to press Write button in order to save the setting in the given file."); other_settings -> filename @fill @preview(allfile)="Preview" @action(writetofile)="Write"; writetofile-> "echo '" allfile "' > " filename ; filename -> @outfile="$HOME/.procmailrc"; setup :horizontal "Settings" -> recipe container; recipe :framed -> flags regexp action; flags :horizontal "Recipe" -> these_flags | !more_flags ; these_flags :beside -> ":0 " @string; more_flags :beside -> ":0 " more_flags0; regexp :horizontal "Delivery condition" -> this_regexp | !more_regexp; this_regexp :beside -> "* " @string "\n"; more_regexp :beside -> more_regexp0; action "Action" -> folder | forward | execute; folder "Append to mailbox" -> @infile="inbox"; forward "Forward to" -> "! " @string; execute "Feed to stdin of command" -> "| " @string; container :framed -> container0 ; container0 "Procmail rules" -> @container(procmailline); procmailline -> "\n" flags "\n" regexp_choices action "\n"; regexp_choices -> this_regexp | regexps; regexp_choices <- regexp; allfile -> "#This file was created by Kaptain" maildir lockfile "\n" container "\n#end\n" ; #buttons -> @echo(container)="OK"; more_regexp0 :dialog "More..." -> more_top more_buttons; more_buttons -> @close="Ok"; more_top :horizontal :framed -> choice regexps ; choice "Select condition"-> exactregexp | fieldcont!; exactregexp "Regular expression" -> @string; fieldcont :beside :horizontal-> "^" which "[: ][. ]*" what; which :beside "Field" -> @combow("From","Subject","To","Reply-to"); what :beside "contains" -> @string; # subjcont "Subj field contains" -> "^Subject[: ][. ]*" @string; regexps "Conditions so far"-> @container(regexpline); regexpline -> "* " choice "\n"; more_flags0 :dialog "Flags..." -> flags_top flags_buttons; flags_buttons -> @close="OK"; flags_top :horizontal :framed -> options;# extras; # extras "Extras" -> @; options "Options" -> header body condA conda condE conde feedh feedb; header "Egrep the header" -> "H"! | @; body "Egrep the body" -> "B" | !@; case "Case sensitive" -> "D" | !@; condA -> "A" | !@; conda -> "a" | !@; condE -> "E" | !@; conde -> "e" | !@; feedh -> "h"! | @; feedb -> "b"! | @; condA = "If last matched" "Match if the last preceding condition matched" "This recipe will not be executed unless the conditions on the last preceding recipe (on the current\ block-nesting level) without the `A' or `a' flag matched as well. This allows you to chain actions \ that depend on a common condition."; conda = "If last was succesfull" "Match if last recipe action was succesfully completed" "Has the same meaning as the `A' flag, with the additional condition that the immediately preceding \ recipe must have been successfully completed before this recipe is executed."; condE = "If last didn't match" "Match if last recipe was not executed" "This recipe only executes if the immediately preceding recipe was not executed. Execution of this \ recipe also disables any immediately following recipes with the 'E' flag. This allows you to specify \ `else if' actions." ; conde = "If last failed" "Match if last recipe action failed" "This recipe only executes if the immediately preceding recipe failed (i.e. the action line was \ attempted, but resulted in an error)." ; feedh = "Feed the header" "Feed the header to action" "Feed the header to the pipe, file or mail destination."; feedb = "Feed the body" "Feed the body to action" "Feed the body to the pipe, file or mail destination."; kaptain-0.73/examples/puf.tgz0000640023433300116100000005653110120611342014733 0ustar zsoltengHZ=P/ %(3IQI*"9 383 s9HNJΒ$=G<}z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wkRحl{1SY^;X)q̵QLO]GPpdmTkL*: "WOO`Ḅaw4"_zsLLRZv&cz"kkBcy= >awXD$q Ih4c"78G]%M_n&=n)D7s;cEcpj]N=lRc"i/97R%ݺS t3RQ]AR$m>FMcJ}15_5eѧddT,OzéUD=nfڷf:zSR;)7īF_4_JSF;d[99T"ƹ鰻zyK:>3e%$⎧d #CEK(A ׮Cdb†fK?.c܇緊uޤR7#ĦN0g۝;`Z}#\[?"m[GSF# `P-c0^)(@`F6 Cs=GmBEyFX]_[PKbL- ǏpnHōpkv u& 0o\LPhQ 04#~!Ɵ ~?&LpaaT`vB>}Dn5_*2C]4L X 8wQlwI.uuJ?/} !opkx3hÍ P?th^"_B'p`|>)]8/Xz)W"5=Hj{?4\~ 5 `q\܁|6\1>}F4 &5#b*͡䵍@aN?:T0 (D҂`P@[ p].H:ǀiw{ GCP3zw<‡fF@0c3K sDhCƐ =<[i?>? }ȍ8oNOO^?}tPF~Xb`3 0L gD yPd R.fM= p{7j^;4n:g>Կ,̀(: |f{C}>5`jVj" {ՈES#"8.7b Q03+rS)9pHh̏>uiڟiڟiڟiڟiڟiڟiڟiڟiڟiڟiwkaptain-0.73/examples/search.kaptn0000640023433300116100000000252010120611343015705 0ustar zsolteng#!/usr/bin/kaptain #glimpse control script #(C) 2001 by Oliver Kohll, oliver@gtwebmarque.com #released under the GNU General Public License, version 2 #http://www.fsf.org/copyleft/gpl.txt #glimpse is a search engine for your hard disk/network etc., much faster than find|grep :) #http://webglimpse.org/, you will need to install & setup glimpse in order to use this script # #Note. This script excercises a small subset of the glimpse commands, for simplicity # #WARNING------------------------------------------------------ #This script overwrites the file ~/glimpse-searchresults.txt #In the v. unlikely event you use this file, change the script start:framed "Search filesystem" -> options control; options "Options" -> searchterm wholewords accuracy; control "Control" -> filetypes buttons; searchterm:beside "Search for" -> @string; wholewords:beside "Whole words only" -> " -w" | @; filetypes:double -> includefiletype thefiletype; accuracy:beside "Fuzziness of search (0 = exact match)" -> @integer = 1; includefiletype "Only find files of type (e.g. doc)" -> @ | " -F "; thefiletype -> @string; buttons:double -> startbutton @close = "Close"; startbutton -> @action(command) = "Search"; command -> "glimpse -y -i -l -" accuracy wholewords includefiletype thefiletype " " searchterm " >~/glimpse-searchresults.txt;kwrite ~/glimpse-searchresults.txt"; kaptain-0.73/examples/tar.kaptn0000640023433300116100000000246710120611343015240 0ustar zsolteng#!/usr/bin/kaptain start "Tar" -> tar buttons; tar -> "tar " choice " " opt archive " " files; opt:framed :horizontal -> extropt createopt ; createopt "Write options" -> dump remove verb comp; extropt "Read options" -> noerr keep same abs; dump "Dump files, not just symlinks" -> "--dereference " | @; noerr"Ignore failed read" -> "--ignore-failed-read " | @; keep "Keep existing files" -> "-k " | @; same "Extract all protection information" -> "-p " | @; abs "Absolute path names" -> "-P " | @; remove "Remove files after adding to archive" -> "--remove-files " | @; verb "Verbosely list files proceeded" -> "-v " | @; comp -> compress | @; compress "Compression" -> gzip | bzip; gzip "gzip" -> "-z "; bzip "bzip2" -> "--use-compress-program bzip2 "; choice:framed -> work; work "Main choice" -> concat | ! create | diff | del | append | list | update | extract; concat "Append to archive" -> "A"; create "Create archive" -> "c"; diff "Find differences between archive and file system" -> "d"; del "Delete from archive" -> "-delete"; append "Append to the end of an archive" -> "r"; list "List contents" -> "t"; update "Update archive" -> "u"; extract "Extract from archive" -> "x"; archive "Archive name" -> @infile; files "Files to work with" -> @string ; buttons :horizontal -> @action(tar)="OK" @close="Cancel"; kaptain-0.73/examples/weblint.kaptn0000640023433300116100000000263210120611343016110 0ustar zsolteng#!/usr/bin/kaptain # # weblint grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # # weblint: http://www.weblint.org # start "weblint" -> command buttons; buttons:horizontal -> @action(command)="OK" @close="Cancel"; command :framed -> "weblint " opt mode files ; opt "Options" -> disid enid conf stderr ; disid -> disableid | ! @ ; disableid "Disable these identifiers" -> "-d " dislist " " ; dislist -> @string ; enid -> enableid | ! @ ; enableid "Enable these identifiers" -> "-e " enlist " " ; enlist -> @string ; conf -> config | ! @ ; config "Use configuration file" -> "-f " conffile " " ; conffile -> @infile ; stderr -> usestderr | ! @ ; usestderr "Print to STDERR rather than STDOUT" -> "-stderr " ; mode "Mode of operation" -> listmesg | ! unfluff ; listmesg "List known identifiers/messages" -> "-message " ; unfluff "Pick fluff off of HTML file(s)" -> nocase nosym pedantic short terse ; nocase -> ignorecase | ! @ ; ignorecase "Ignore case of element tags" -> "-i " ; nosym -> nosymlinks | ! @ ; nosymlinks "Don't unfluff symlinks" -> "-l " ; pedantic -> pedanticmode | ! @ ; pedanticmode "Pedantic mode" -> "-pedantic " ; short -> shortmesg | ! @ ; shortmesg "No filename in messages" -> "-s " ; terse -> tersemode | ! @ ; tersemode "Terse output mode" -> "-t " ; files "File(s) to check" -> @infile ; kaptain-0.73/examples/wget.kaptn0000640023433300116100000000671310120611343015416 0ustar zsolteng#!/usr/bin/kaptain #wget control program, only tested with GNU Wget 1.5.3 #(C) 2001 by Oliver Kohll, oliver@gtwebmarque.com #released under the GNU General Public License, version 2 #http://www.fsf.org/copyleft/gpl.txt #Show log... and Show files... need KDE to work. #Show log... will need to be changed if nohup doesn't write to wget-log start "Download website or file(s)" -> dialogue buttons; dialogue:tabbed -> url options recursion; url "URL and logging" -> theurl filesurl background nohuplog savetodir credits; theurl:beside "URL (http://... or ftp://...)" -> @string; filesurl -> readfilecheck infile; readfilecheck:beside "Read URLs from file" -> @ | " --input-file="; infile:beside -> @infile; background "Download in background" -> " -b" | @; nohuplog -> saveoutput nonverbose showlog; saveoutput "Log with nohup" -> "nohup " | @; showlog -> @action("kwrite wget-log") = "Show log..."; nonverbose "Non verbose logging" -> " -nv" | @; savetodir:beside "Download to" -> @directory = "~/"; credits -> @text("Kaptain graphical front end for command line programs from\nhttp://kaptain.sourceforge.net\nwget control script by Oliver Kohll\nwww.gtwebmarque.com, www.gtwebpublisher.co.uk\nwget 1.5.3 from http://www.gnu.org/software/wget/wget.html"); buttons:double -> startbutton progressbutton closebutton; startbutton -> @action(command)="Start download"; progressbutton -> @action(showprogress) = "Show files..."; closebutton -> @close="Close dialogue"; showprogress -> "konqueror " savetodir; options "Download options" -> dontoverwrite continue siteuser dontcache; dontoverwrite "Don't overwrite existing" -> @ | " -nc"; continue "Continue partially downloaded file" -> @ | " -c"; siteuser -> userneeded usersupplied passneeded passsupplied; userneeded "HTTP Username needed" -> @ | " --http-user="; usersupplied -> @string; passneeded "HTTP Password needed" -> @ | " --http-passwd="; passsupplied -> @password; dontcache "Disallow caching" -> " --cache=off" | @; recursion:double:framed "Recursion options" -> recursionoptions acceptreject; recursionoptions "Basic options" -> recurse specifydepth torelative followftp spanhosts; acceptreject "Accept/Reject" -> acceptext rejectext acceptdom rejectdom acceptdirs rejectdirs; recurse "Recurse" -> " -r" | @; specifydepth -> depthcheck depth; depthcheck:beside "Specify depth" -> " --level=" | @; depth:beside "Depth (0=unlimit)" -> @integer = 0; torelative "Convert absolute links to relative" -> @ | " --convert-links"; acceptext -> acceptextcheck acceptextlist; acceptextcheck "Accept extensions (htm,html,...)" -> @ | " --accept="; acceptextlist -> @string; rejectext -> rejectextcheck rejectextlist; rejectextcheck "Reject extensions" -> @ | " --reject="; rejectextlist -> @string; acceptdom -> acceptdomcheck acceptdomlist; acceptdomcheck "Accept domains" -> @ | " --domains="; acceptdomlist -> @string; rejectdom -> rejectdomcheck rejectdomlist; rejectdomcheck "Reject domains" -> @ | " --exclude-domains="; rejectdomlist -> @string; acceptdirs -> acceptdircheck acceptdirlist; acceptdircheck "Accept directories" -> @ | " --include-directories="; acceptdirlist -> @string; rejectdirs -> rejectdircheck rejectdirlist; rejectdircheck "Reject directories" -> @ | " --exclude-directories="; rejectdirlist -> @string; followftp "Follow FTP links" -> @ | " --follow-ftp"; spanhosts "Go to foreign hosts" -> @ | " --span-hosts"; command -> saveoutput "wget" readfilecheck infile background nonverbose " --directory-prefix=" savetodir options recursion " " theurl; kaptain-0.73/examples/whois.kaptn0000640023433300116100000000161210120611343015572 0ustar zsolteng#!/usr/bin/kaptain # # whois grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # start "whois" -> command buttons; buttons:horizontal -> @action(command)="OK" @close="Cancel"; command :framed -> "whois " opt hosttoquery moreopt object ; opt "Options" -> verbose ; hosttoquery "Host to query" -> byhand | ! gtld ; byhand "Select by hand" -> host port ; gtld "Use www.crsnic.net to find registrar for a GTLD subdomain" -> "-C " ; host -> usehost | ! @ ; usehost "Use specified host" -> "-h " @string " "; port -> useport | ! @ ; useport "Use specified port" -> "-p " @integer " "; verbose -> beverbose | ! @ ; beverbose "Verbose mode" -> "-V " ; moreopt "Server flags" -> passmoreopts | ! @ ; passmoreopts "Flags to pass to RIPE-like server" -> @string ; object "Object to query for" -> @string ; kaptain-0.73/examples/zangband.kaptn0000640023433300116100000000267210120611342016233 0ustar zsolteng#!/usr/bin/kaptain # # ZAngband grammar (C) 2000 by Schneelocke, Schneelocke@gmx.net # released under the GNU General Public license, version 2 # http://www.fsf.org/copyleft/gpl.txt # # ZAngband: http://thangorodrim.angband.org/zangband.html # start "ZAngband" -> command buttons; buttons:horizontal -> @action(command)="OK" @close="Cancel"; command :framed -> "/usr/local/bin/angband " opt output keys mode ; opt "Options" -> fiddle wizard sound graphics mono lib ; fiddle -> fiddlemode | ! @ ; fiddlemode "Request fiddle mode" -> "-f " ; wizard -> wizardmode | ! @ ; wizardmode "Request wizard mode" -> "-w " ; sound -> soundmode | ! @ ; soundmode "Request sound mode" -> "-v " ; graphics -> graphicsmode | ! @ ; graphicsmode "Request graphics mode" -> "-g " ; mono -> monochrome | ! @ ; monochrome "Request monochrome mode" -> "-M " ; lib -> library | ! @ ; library "Define lib dir sub-path" -> "-d" libdir " " ; libdir -> @string ; output "Output" -> x11 | ! terminal | sys ; x11 "X11" -> "-mx11 " ; terminal "Terminal" -> "-mgcu " ; sys "Use main-.c" -> "-m" sysfile " " ; sysfile -> @string="xaw" ; keys "Keyset" -> ! original | rogue ; original "Original" -> "-o " ; rogue "Rogue-like" -> "-r " ; mode "Action" -> ! saved | new | showscores ; saved "Use a saved character" -> "-u" charname " " ; charname -> @string ; new "Start a new character" -> "-n " ; showscores "Show ___ highscores" -> "-s" scores " " ; scores -> @integer=10 ;