├── COPYING ├── ChangeLog ├── INSTALL ├── README ├── ansi_art_samples ├── 2013-16-TCF-16-Colors.bin ├── Luciano-6-FreedomTrainGameCities.ans ├── README └── misfit_LetsGoCrazy.xb ├── ansifilter.desktop ├── ansifilter.kdev4 ├── ansifilter.spec ├── makefile ├── man └── ansifilter.1.gz └── src ├── Doxyfile ├── arg_parser.cpp ├── arg_parser.h ├── bbcodegenerator.cpp ├── bbcodegenerator.h ├── charcodes.h ├── cmdlineoptions.cpp ├── cmdlineoptions.h ├── codegenerator.cpp ├── codegenerator.h ├── elementstyle.cpp ├── elementstyle.h ├── enums.h ├── htmlgenerator.cpp ├── htmlgenerator.h ├── input.col ├── latexgenerator.cpp ├── latexgenerator.h ├── main.cpp ├── main.h ├── makefile ├── pangogenerator.cpp ├── pangogenerator.h ├── plaintextgenerator.cpp ├── plaintextgenerator.h ├── platform_fs.cpp ├── platform_fs.h ├── preformatter.cpp ├── preformatter.h ├── qt-gui ├── Actions-drop-icon.png ├── Makefile ├── Makefile.Debug ├── Makefile.Release ├── ansifilter-gui.pro ├── ansifilter.icns ├── ansifilter.ico ├── ansifilter.qrc ├── ansifilter.ui ├── ansifilter.xpm ├── icon.rc ├── main.cpp ├── moc_mydialog.cpp ├── mydialog.cpp ├── mydialog.h └── ui_ansifilter.h ├── rtfgenerator.cpp ├── rtfgenerator.h ├── stringtools.cpp ├── stringtools.h ├── stylecolour.cpp ├── stylecolour.h ├── tcl ├── README ├── makefile ├── pkgIndex.tcl └── tclansifilter.c ├── testansi.py ├── texgenerator.cpp ├── texgenerator.h ├── version.h └── w32-projects └── ansifilter_cli.pro /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/ChangeLog -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Ansifilter installation instructions 2 | ------------------------------------ 3 | 4 | Ansifilter is a small utility without external dependencies. 5 | There are no configuration files or libs to take care of. 6 | 7 | 1. Compilation and installation 8 | =============================== 9 | 10 | 1.1 Linux 11 | ----------- 12 | 13 | 1. tar xjvf ansifilter-x.x.tar.bz2 14 | 15 | 2. cd ansifilter-x.x 16 | 17 | 3. make help 18 | 19 | 4. make 20 | make gui (build the Qt GUI (requires Qt 4/5)) 21 | 22 | 5. make install (install binary and documentation files) 23 | make install-gui (install GUI binary) 24 | (depending on your installation destination, you need to be root) 25 | 26 | 6. make clean (optional) 27 | 28 | 1.2 Windows 29 | ----------- 30 | 31 | Install the following tools and libraries. 32 | 33 | a) Install Qt Creator IDE (www.qt.io) 34 | 35 | b) Install MingW (gcc toolchain) 36 | 37 | -Download Online-Installer: 38 | https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/ 39 | -Start mingw-w64-install.exe and select default options 40 | -Add bin directory of the downloaded files to the system PATH 41 | -open cmd.exe and type "g++ --version" to check 42 | 43 | c) Compile Qt: 44 | 45 | -Download and extract package from qt.io: 46 | https://www.qt.io/download-open-source/ -> qt-everywhere-opensource-src-5.6.0.tar.gz 47 | -Open cmd.exe and change into the Qt directory 48 | -Configure Qt. Use static if you do not want to ship Qt DLLs: 49 | configure -release -nomake examples -opensource -static -strip -opengl desktop 50 | -Compile Qt: 51 | mingw32-make -j4 52 | 53 | d) Add compiler and Qt paths (location of qmake.exe) in QtCreator 54 | 55 | e) Install upx from http://upx.sourceforge.net/ 56 | 57 | f) Open the pro files in src/w32-projects and src/gui_qt in QtCreator and 58 | adjust the paths of libraries and tools before compiling the projects. 59 | 60 | g) Ship Ansifilter with libgcc_s_dw2-1.dll (32 bit) libgcc_s_seh-1.dll (64 bit) libstdc++-6.dll libwinpthread-1.dll 61 | (all DLLs are located in the mingw32 installation) 62 | 63 | 64 | 2. Known compiler issues 65 | ======================== 66 | 67 | Ansifilter was tested with gcc > 4.8 and clang 3.9.0. It will not compile with gcc 2.x. 68 | For gcc versions < 4.7, unique_ptr needs to be replaced by auto_ptr. 69 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 2 | *** Since Github is now part of Mordor Corp, the ansifilter Git repo *** 3 | *** moved to https://gitlab.com/saalen/ansifilter *** 4 | 5 | ------------------------------------------------------------------------------- 6 | --- ANSIFILTER MANUAL - Version 2.9 ---------------------- NOVEMBER 2017 --- 7 | ------------------------------------------------------------------------------- 8 | 9 | OSI Certified Open Source Software 10 | 11 | ------------------------------------------------------------------------------- 12 | 13 | Ansifilter handles text files containing ANSI terminal escape codes. 14 | The command sequences may be stripped or be interpreted to generate formatted 15 | output (HTML, RTF, TeX, LaTeX, BBCode, Pango). 16 | 17 | 18 | CONTENT: 19 | ------------------------------------------------------------------------------- 20 | 21 | 1. Quick introduction 22 | 2. Platforms 23 | 3. Features 24 | 4. Environment variables 25 | 5. Color mapping 26 | 6. Contact 27 | 28 | 29 | 1. Quick introduction 30 | ------------------------------------------------------------------------------- 31 | 32 | Invocation: ansifilter [OPTION]... [FILE]... 33 | 34 | ansifilter handles text files containing ANSI terminal escape codes. 35 | 36 | File handling: 37 | -i, --input= Name of input file 38 | -o, --output= Name of output file 39 | -O, --outdir= Name of output directory 40 | -t, --tail Continue reading after end-of-file (like tail -f) 41 | 42 | Output text formats: 43 | -T, --text (default) Output text 44 | -H, --html Output HTML 45 | -M, --pango Output Pango Markup 46 | -L, --latex Output LaTeX 47 | -P, --tex Output Plain TeX 48 | -R, --rtf Output RTF 49 | -B, --bbcode Output BBCode 50 | 51 | Format options: 52 | -a, --anchors Add HTML line anchors (assumes -l) 53 | -d, --doc-title Set HTML/LaTeX document title 54 | -e, --encoding Set HTML/RTF encoding (must match input file encoding) 55 | -f, --fragment Omit HTML header and footer 56 | -F, --font= Set HTML/RTF font face 57 | -l, --line-numbers Print line numbers in output file 58 | -m, --map= Read color mapping file (see README) 59 | -r, --style-ref= Set HTML/TeX/LaTeX stylesheet path 60 | -s, --font-size= Set HTML/RTF font size 61 | -p, --plain Ignore ANSI formatting information 62 | -w, --wrap= Wrap long lines 63 | --no-trailing-nl Omit trailing newline 64 | --no-version-info Omit version info comment 65 | --wrap-no-numbers Omit line numbers of wrapped lines (assumes -l) 66 | 67 | ANSI art options: 68 | --art-cp437 Parse codepage 437 ANSI art (HTML, RTF output) 69 | --art-bin Parse BIN/XBIN ANSI art (HTML output, no stdin) 70 | --art-tundra Parse Tundra ANSI art (HTML output, no stdin) 71 | --art-width Set ANSI art width (default 80) 72 | --art-height Set ANSI art height (default 150) 73 | 74 | Other options: 75 | -h, --help Print help 76 | -v, --version Print version and license info 77 | 78 | Examples: 79 | ansifilter -i input.ansi -o output.txt 80 | ansifilter *.txt 81 | tail -f server.log | ansifilter 82 | 83 | Parsing XBIN files overrides --art-width, --art-height and --map options. 84 | The ANSI art file formats BIN, XBIN and TND cannot be read from stdin. 85 | 86 | The GUI version (ansifilter-gui) also accepts the first command line argument 87 | as input file name. 88 | 89 | 90 | 2. Platforms 91 | ------------------------------------------------------------------------------- 92 | 93 | Ansifilter is currently available for Linux and Win32 platforms. 94 | 95 | 96 | 3. Features 97 | ------------------------------------------------------------------------------- 98 | 99 | Ansifilter understands most CSI sequences. Support for ANSI art files (based on 100 | codepage 437 and ANSI.SYS sequences, BIN/XBIN and Tundra files) is enabled with 101 | the --art-cp437 and --art-bin options. 102 | Parsing XBIN files overrides --art-width, --art-height and --map options. 103 | Parsing TND files overrides --art-width and --map options. 104 | 105 | Supported SGR parameters: 106 | 107 | Formatting: Bold, Underline, Italic, Blink 108 | Colors: Black, Red, Green, Yellow, Blue, Magenta, Cyan, White; 109 | xterm 256 color modes; 110 | 16m true color modes 111 | Other: Conceal/Reveal, Image positive/negative 112 | 113 | All commands which issue the listed formatting options are supported. 114 | Some options like Blink are not supported by all output formats (like RTF). 115 | 116 | 117 | 4. ENVIRONMENT VARIABLES 118 | ------------------------------------------------------------------------------- 119 | 120 | The command line version recognizes these variables: 121 | 122 | ANSIFILTER_OPTIONS: may contain command line options, but no input file paths. 123 | 124 | 125 | 5. Color mapping 126 | ------------------------------------------------------------------------------- 127 | 128 | The basic ANSI color set can be adjusted with a color map file (--map option). 129 | This text configuration overrides these color codes: 130 | 131 | Normal: Black (0), Red (1), Green (2), Yellow (3), Blue (4), Magenta (5), 132 | Cyan (6), Gray (7) 133 | Bright: DarkGray (8), Red (9), Green (10), Yellow (11), Blue (12), Magenta (13), 134 | Cyan (14), White (15) 135 | 136 | File format: 137 | 138 | <0..15> = 139 | 140 | Example file content: 141 | 142 | 1= #0000aa 143 | 2= #00aa00 144 | 3= #00aaaa 145 | 4= #aa0000 146 | 5= #aa00aa 147 | 6= #aa5500 148 | 7= #aaaaaa 149 | 8= #555555 150 | 9= #5555ff 151 | 10= #55ff55 152 | 11= #55ffff 153 | 12= #ff5555 154 | 13= #ff55ff 155 | 14= #ffff55 156 | 15= #ffffff 157 | 158 | 159 | 6. Contact 160 | ------------------------------------------------------------------------------- 161 | 162 | Andre Simon 163 | andre.simon1@gmx.de 164 | http://www.andre-simon.de/ 165 | 166 | sf.net project with SVN repository, download mirror, bug tracker, help forum: 167 | http://sourceforge.net/projects/ansifilter/ 168 | 169 | Github project with Git repository, bug tracker: 170 | https://github.com/andre-simon/ansifilter 171 | -------------------------------------------------------------------------------- /ansi_art_samples/2013-16-TCF-16-Colors.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/ansi_art_samples/2013-16-TCF-16-Colors.bin -------------------------------------------------------------------------------- /ansi_art_samples/Luciano-6-FreedomTrainGameCities.ans: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/ansi_art_samples/Luciano-6-FreedomTrainGameCities.ans -------------------------------------------------------------------------------- /ansi_art_samples/README: -------------------------------------------------------------------------------- 1 | 2 | Run these commands to generate HTML files from ANSI art input: 3 | 4 | ansifilter -H misfit_LetsGoCrazy.xb --art-bin > misfit_LetsGoCrazy.xb.html 5 | 6 | ansifilter -H 2013-16-TCF-16-Colors.bin --art-bin --art-width=320 --art-height 190 --map=bin.map > 2013-16-TCF-16-Colors.bin.html 7 | 8 | ansifilter -H Luciano-6-FreedomTrainGameCities.ans --art-cp437 --art-width 80 --art-height 106 > Luciano-6-FreedomTrainGameCities.ans.html 9 | 10 | Content of the color map: 11 | 12 | cat bin.map 13 | 1= #0000aa 14 | 2= #00aa00 15 | 3= #00aaaa 16 | 4= #aa0000 17 | 5= #aa00aa 18 | 6= #aa5500 19 | 7= #aaaaaa 20 | 8= #555555 21 | 9= #5555ff 22 | 10= #55ff55 23 | 11= #55ffff 24 | 12= #ff5555 25 | 13= #ff55ff 26 | 14= #ffff55 27 | 15= #ffffff 28 | 29 | 30 | More resources: 31 | 32 | https://sixteencolors.net/pack/blocktronics_block_n_roll 33 | http://sixteencolors.net/pack/tcf20/2013%20-%2016%20-%20TCF%20-%2016%20-%20Colors.bin 34 | -------------------------------------------------------------------------------- /ansi_art_samples/misfit_LetsGoCrazy.xb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/ansi_art_samples/misfit_LetsGoCrazy.xb -------------------------------------------------------------------------------- /ansifilter.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Terminal=false 3 | TryExec=ansifilter-gui 4 | Exec=ansifilter-gui %f 5 | Icon=ansifilter 6 | Type=Application 7 | Categories=Utility;TextEditor; 8 | StartupNotify=false 9 | Name=Ansifilter 10 | GenericName=ANSI escape code converter 11 | -------------------------------------------------------------------------------- /ansifilter.kdev4: -------------------------------------------------------------------------------- 1 | [Project] 2 | Manager=KDevCustomMakeManager 3 | Name=ansifilter 4 | -------------------------------------------------------------------------------- /ansifilter.spec: -------------------------------------------------------------------------------- 1 | #%define prefix /usr 2 | 3 | # Release number can be specified with rpmbuild --define 'rel SOMETHING' ... 4 | # If no such --define is used, the release number is 1. 5 | # 6 | # Source archive's extension can be specified with --define 'srcext .foo' 7 | # where .foo is the source archive's actual extension. 8 | # To compile an RPM from a .bz2 source archive, give the command 9 | # rpmbuild -tb --define 'srcext bz2' @PACKAGE@-@VERSION@.tar.bz2 10 | # 11 | 12 | 13 | %if %{?srcext:0}%{!?srcext:1} 14 | %define srcext bz2 15 | %endif 16 | 17 | Name: ansifilter 18 | Summary: ANSI terminal escape code converter 19 | Version: 1.19 20 | Release: 1 21 | Group: Development/Tools 22 | License: GPLv3 23 | Vendor: Andre Simon 24 | URL: http://www.andre-simon.de/ 25 | 26 | Source0: http://www.andre-simon.de/zip/%{name}-%{version}.tar.%{srcext} 27 | Buildroot: %{_tmppath}/%{name}-%{version}.%{release}-root 28 | 29 | %description 30 | Ansifilter handles text files containing ANSI terminal escape codes. 31 | The command sequences may be stripped or be interpreted to generate formatted 32 | output (HTML, RTF, TeX, LaTeX, BBCode, Pango). 33 | 34 | %prep 35 | %setup -q -n ansifilter-%{version} 36 | 37 | %build 38 | make 39 | 40 | %install 41 | if [ -d $RPM_BUILD_ROOT ]; then rm -r $RPM_BUILD_ROOT; fi 42 | install -d $RPM_BUILD_ROOT% 43 | install -d $RPM_BUILD_ROOT%{_mandir}/man1 44 | install -d $RPM_BUILD_ROOT%{_defaultdocdir}/ansifilter/ 45 | 46 | install -m644 ./man/ansifilter.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/ansifilter.1.gz 47 | install -m644 ChangeLog COPYING INSTALL README $RPM_BUILD_ROOT%{_defaultdocdir}/ansifilter/ 48 | mkdir -p $RPM_BUILD_ROOT%{_bindir} 49 | install -m755 ./src/ansifilter $RPM_BUILD_ROOT%{_bindir} 50 | 51 | %clean 52 | rm -fr %{buildroot} 53 | 54 | %files 55 | %defattr(-,root,root,-) 56 | 57 | %{_defaultdocdir}/ansifilter 58 | %{_mandir}/man1/ansifilter.1.gz 59 | %{_bindir}/ansifilter 60 | 61 | %changelog 62 | 63 | * Mon Nov 03 2008 Andre Simon 1.2-1 64 | — initial spec file 65 | 66 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | # Installation script for ansifilter. 2 | # See INSTALL for details. 3 | 4 | # Installation directories: 5 | 6 | # Destination directory for installation (intended for packagers) 7 | DESTDIR = 8 | 9 | # Root directory for final installation 10 | PREFIX = /usr 11 | 12 | # Location of the binary: 13 | bin_dir = ${PREFIX}/bin/ 14 | 15 | # Location of the man page: 16 | man_dir = ${PREFIX}/share/man/man1/ 17 | 18 | # Location of the documentation: 19 | doc_dir = ${PREFIX}/share/doc/ansifilter/ 20 | 21 | # Location of additional gui files 22 | desktop_apps = ${PREFIX}/share/applications/ 23 | desktop_pixmaps = ${PREFIX}/share/pixmaps/ 24 | 25 | # Commands: 26 | QMAKE=qmake 27 | 28 | INSTALL_DATA=install -m644 29 | INSTALL_PROGRAM=install -m755 30 | MKDIR=mkdir -p -m 755 31 | RMDIR=rm -r -f 32 | 33 | all: 34 | ${MAKE} -C ./src -f ./makefile 35 | 36 | all-gui gui: 37 | ${QMAKE} -makefile -o src/qt-gui/Makefile src/qt-gui/ansifilter-gui.pro 38 | ${MAKE} -C ./src/qt-gui -f ./Makefile 39 | 40 | all-tcl tcl: 41 | ${MAKE} -C ./src/tcl -f ./makefile 42 | 43 | install: 44 | @echo "This script will install ansifilter in the following directories:" 45 | @echo "Documentation directory: ${DESTDIR}${doc_dir}" 46 | @echo "Manual directory: ${DESTDIR}${man_dir}" 47 | @echo "Binary directory: ${DESTDIR}${bin_dir}" 48 | @echo 49 | 50 | ${MKDIR} ${DESTDIR}${doc_dir} 51 | ${MKDIR} ${DESTDIR}${man_dir} 52 | ${MKDIR} ${DESTDIR}${bin_dir} 53 | 54 | ${INSTALL_DATA} ./man/ansifilter.1.gz ${DESTDIR}${man_dir} 55 | ${INSTALL_DATA} ./README ${DESTDIR}${doc_dir} 56 | ${INSTALL_DATA} ./ChangeLog ${DESTDIR}${doc_dir} 57 | ${INSTALL_DATA} ./COPYING ${DESTDIR}${doc_dir} 58 | ${INSTALL_DATA} ./INSTALL ${DESTDIR}${doc_dir} 59 | ${INSTALL_PROGRAM} ./src/ansifilter ${DESTDIR}${bin_dir} 60 | 61 | @echo 62 | @echo "Done." 63 | @echo "Type ansifilter --help or man ansifilter for instructions." 64 | @echo "Do not hesitate to report problems. Unknown bugs are hard to fix." 65 | 66 | install-gui: 67 | ${INSTALL_PROGRAM} ./src/qt-gui/ansifilter-gui ${DESTDIR}${bin_dir} 68 | ${MKDIR} ${DESTDIR}${desktop_apps} \ 69 | ${DESTDIR}${desktop_pixmaps} 70 | ${INSTALL_DATA} ./ansifilter.desktop ${DESTDIR}${desktop_apps} 71 | ${INSTALL_DATA} ./src/qt-gui/ansifilter.xpm ${DESTDIR}${desktop_pixmaps} 72 | 73 | uninstall: 74 | @echo "Removing ansifilter files from system..." 75 | ${RMDIR} ${DESTDIR}${doc_dir} 76 | rm -f ${DESTDIR}${man_dir}ansifilter.1.gz 77 | rm -f ${DESTDIR}${bin_dir}ansifilter 78 | rm -f ${DESTDIR}${bin_dir}ansifilter-gui 79 | @echo "Done. Have a nice day!" 80 | 81 | clean: 82 | $(MAKE) -C ./src -f ./makefile clean 83 | $(MAKE) -C ./src/tcl -f ./makefile clean 84 | 85 | apidocs: 86 | doxygen Doxyfile 87 | 88 | help: 89 | @echo "This makefile offers the following options:" 90 | @echo 91 | @echo "(all) Compile." 92 | @echo "all-gui Compile Qt GUI (requires Qt 4.x)" 93 | @echo "install* Copy all data files to ${data_dir}." 94 | @echo "clean Remove object files and binary." 95 | @echo "uninstall* Remove ansifilter files from system." 96 | @echo 97 | @echo "* Command needs root privileges." 98 | @echo "See src/makefile for compilation and linking options." 99 | 100 | # Target needed for redhat 9.0 rpmbuild 101 | install-strip: 102 | 103 | .PHONY: clean all install apidocs help uninstall install-strip 104 | -------------------------------------------------------------------------------- /man/ansifilter.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/man/ansifilter.1.gz -------------------------------------------------------------------------------- /src/Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.5.1-KDevelop 2 | 3 | #--------------------------------------------------------------------------- 4 | # Project related configuration options 5 | #--------------------------------------------------------------------------- 6 | PROJECT_NAME = ansifilter 7 | PROJECT_NUMBER = 1 8 | OUTPUT_DIRECTORY = 9 | CREATE_SUBDIRS = NO 10 | OUTPUT_LANGUAGE = English 11 | USE_WINDOWS_ENCODING = NO 12 | BRIEF_MEMBER_DESC = YES 13 | REPEAT_BRIEF = YES 14 | ABBREVIATE_BRIEF = "The $name class" \ 15 | "The $name widget" \ 16 | "The $name file" \ 17 | is \ 18 | provides \ 19 | specifies \ 20 | contains \ 21 | represents \ 22 | a \ 23 | an \ 24 | the 25 | ALWAYS_DETAILED_SEC = NO 26 | INLINE_INHERITED_MEMB = NO 27 | FULL_PATH_NAMES = YES 28 | STRIP_FROM_PATH = /home/andre/ 29 | STRIP_FROM_INC_PATH = 30 | SHORT_NAMES = NO 31 | JAVADOC_AUTOBRIEF = NO 32 | MULTILINE_CPP_IS_BRIEF = NO 33 | DETAILS_AT_TOP = NO 34 | INHERIT_DOCS = YES 35 | SEPARATE_MEMBER_PAGES = NO 36 | TAB_SIZE = 8 37 | ALIASES = 38 | OPTIMIZE_OUTPUT_FOR_C = NO 39 | OPTIMIZE_OUTPUT_JAVA = NO 40 | BUILTIN_STL_SUPPORT = NO 41 | DISTRIBUTE_GROUP_DOC = NO 42 | SUBGROUPING = YES 43 | #--------------------------------------------------------------------------- 44 | # Build related configuration options 45 | #--------------------------------------------------------------------------- 46 | EXTRACT_ALL = NO 47 | EXTRACT_PRIVATE = NO 48 | EXTRACT_STATIC = NO 49 | EXTRACT_LOCAL_CLASSES = YES 50 | EXTRACT_LOCAL_METHODS = NO 51 | HIDE_UNDOC_MEMBERS = NO 52 | HIDE_UNDOC_CLASSES = NO 53 | HIDE_FRIEND_COMPOUNDS = NO 54 | HIDE_IN_BODY_DOCS = NO 55 | INTERNAL_DOCS = NO 56 | CASE_SENSE_NAMES = YES 57 | HIDE_SCOPE_NAMES = NO 58 | SHOW_INCLUDE_FILES = YES 59 | INLINE_INFO = YES 60 | SORT_MEMBER_DOCS = YES 61 | SORT_BRIEF_DOCS = NO 62 | SORT_BY_SCOPE_NAME = NO 63 | GENERATE_TODOLIST = YES 64 | GENERATE_TESTLIST = YES 65 | GENERATE_BUGLIST = YES 66 | GENERATE_DEPRECATEDLIST= YES 67 | ENABLED_SECTIONS = 68 | MAX_INITIALIZER_LINES = 30 69 | SHOW_USED_FILES = YES 70 | SHOW_DIRECTORIES = NO 71 | FILE_VERSION_FILTER = 72 | #--------------------------------------------------------------------------- 73 | # configuration options related to warning and progress messages 74 | #--------------------------------------------------------------------------- 75 | QUIET = NO 76 | WARNINGS = YES 77 | WARN_IF_UNDOCUMENTED = YES 78 | WARN_IF_DOC_ERROR = YES 79 | WARN_NO_PARAMDOC = NO 80 | WARN_FORMAT = "$file:$line: $text" 81 | WARN_LOGFILE = 82 | #--------------------------------------------------------------------------- 83 | # configuration options related to the input files 84 | #--------------------------------------------------------------------------- 85 | INPUT = ./src 86 | FILE_PATTERNS = *.c \ 87 | *.cc \ 88 | *.cxx \ 89 | *.cpp \ 90 | *.c++ \ 91 | *.d \ 92 | *.java \ 93 | *.ii \ 94 | *.ixx \ 95 | *.ipp \ 96 | *.i++ \ 97 | *.inl \ 98 | *.h \ 99 | *.hh \ 100 | *.hxx \ 101 | *.hpp \ 102 | *.h++ \ 103 | *.idl \ 104 | *.odl \ 105 | *.cs \ 106 | *.php \ 107 | *.php3 \ 108 | *.inc \ 109 | *.m \ 110 | *.mm \ 111 | *.dox \ 112 | *.py \ 113 | *.C \ 114 | *.CC \ 115 | *.C++ \ 116 | *.II \ 117 | *.I++ \ 118 | *.H \ 119 | *.HH \ 120 | *.H++ \ 121 | *.CS \ 122 | *.PHP \ 123 | *.PHP3 \ 124 | *.M \ 125 | *.MM \ 126 | *.PY \ 127 | *.C \ 128 | *.H \ 129 | *.tlh \ 130 | *.diff \ 131 | *.patch \ 132 | *.moc \ 133 | *.xpm \ 134 | *.dox 135 | RECURSIVE = yes 136 | EXCLUDE = 137 | EXCLUDE_SYMLINKS = NO 138 | EXCLUDE_PATTERNS = 139 | EXAMPLE_PATH = 140 | EXAMPLE_PATTERNS = * 141 | EXAMPLE_RECURSIVE = NO 142 | IMAGE_PATH = 143 | INPUT_FILTER = 144 | FILTER_PATTERNS = 145 | FILTER_SOURCE_FILES = NO 146 | #--------------------------------------------------------------------------- 147 | # configuration options related to source browsing 148 | #--------------------------------------------------------------------------- 149 | SOURCE_BROWSER = NO 150 | INLINE_SOURCES = NO 151 | STRIP_CODE_COMMENTS = YES 152 | REFERENCED_BY_RELATION = YES 153 | REFERENCES_RELATION = YES 154 | REFERENCES_LINK_SOURCE = YES 155 | USE_HTAGS = NO 156 | VERBATIM_HEADERS = YES 157 | #--------------------------------------------------------------------------- 158 | # configuration options related to the alphabetical class index 159 | #--------------------------------------------------------------------------- 160 | ALPHABETICAL_INDEX = NO 161 | COLS_IN_ALPHA_INDEX = 5 162 | IGNORE_PREFIX = 163 | #--------------------------------------------------------------------------- 164 | # configuration options related to the HTML output 165 | #--------------------------------------------------------------------------- 166 | GENERATE_HTML = YES 167 | HTML_OUTPUT = html 168 | HTML_FILE_EXTENSION = .html 169 | HTML_HEADER = 170 | HTML_FOOTER = 171 | HTML_STYLESHEET = 172 | HTML_ALIGN_MEMBERS = YES 173 | GENERATE_HTMLHELP = NO 174 | CHM_FILE = 175 | HHC_LOCATION = 176 | GENERATE_CHI = NO 177 | BINARY_TOC = NO 178 | TOC_EXPAND = NO 179 | DISABLE_INDEX = NO 180 | ENUM_VALUES_PER_LINE = 4 181 | GENERATE_TREEVIEW = NO 182 | TREEVIEW_WIDTH = 250 183 | #--------------------------------------------------------------------------- 184 | # configuration options related to the LaTeX output 185 | #--------------------------------------------------------------------------- 186 | GENERATE_LATEX = YES 187 | LATEX_OUTPUT = latex 188 | LATEX_CMD_NAME = latex 189 | MAKEINDEX_CMD_NAME = makeindex 190 | COMPACT_LATEX = NO 191 | PAPER_TYPE = a4wide 192 | EXTRA_PACKAGES = 193 | LATEX_HEADER = 194 | PDF_HYPERLINKS = NO 195 | USE_PDFLATEX = NO 196 | LATEX_BATCHMODE = NO 197 | LATEX_HIDE_INDICES = NO 198 | #--------------------------------------------------------------------------- 199 | # configuration options related to the RTF output 200 | #--------------------------------------------------------------------------- 201 | GENERATE_RTF = NO 202 | RTF_OUTPUT = rtf 203 | COMPACT_RTF = NO 204 | RTF_HYPERLINKS = NO 205 | RTF_STYLESHEET_FILE = 206 | RTF_EXTENSIONS_FILE = 207 | #--------------------------------------------------------------------------- 208 | # configuration options related to the man page output 209 | #--------------------------------------------------------------------------- 210 | GENERATE_MAN = NO 211 | MAN_OUTPUT = man 212 | MAN_EXTENSION = .3 213 | MAN_LINKS = NO 214 | #--------------------------------------------------------------------------- 215 | # configuration options related to the XML output 216 | #--------------------------------------------------------------------------- 217 | GENERATE_XML = yes 218 | XML_OUTPUT = xml 219 | XML_SCHEMA = 220 | XML_DTD = 221 | XML_PROGRAMLISTING = YES 222 | #--------------------------------------------------------------------------- 223 | # configuration options for the AutoGen Definitions output 224 | #--------------------------------------------------------------------------- 225 | GENERATE_AUTOGEN_DEF = NO 226 | #--------------------------------------------------------------------------- 227 | # configuration options related to the Perl module output 228 | #--------------------------------------------------------------------------- 229 | GENERATE_PERLMOD = NO 230 | PERLMOD_LATEX = NO 231 | PERLMOD_PRETTY = YES 232 | PERLMOD_MAKEVAR_PREFIX = 233 | #--------------------------------------------------------------------------- 234 | # Configuration options related to the preprocessor 235 | #--------------------------------------------------------------------------- 236 | ENABLE_PREPROCESSING = YES 237 | MACRO_EXPANSION = NO 238 | EXPAND_ONLY_PREDEF = NO 239 | SEARCH_INCLUDES = YES 240 | INCLUDE_PATH = 241 | INCLUDE_FILE_PATTERNS = 242 | PREDEFINED = 243 | EXPAND_AS_DEFINED = 244 | SKIP_FUNCTION_MACROS = YES 245 | #--------------------------------------------------------------------------- 246 | # Configuration::additions related to external references 247 | #--------------------------------------------------------------------------- 248 | TAGFILES = 249 | GENERATE_TAGFILE = ansifilter.tag 250 | ALLEXTERNALS = NO 251 | EXTERNAL_GROUPS = YES 252 | PERL_PATH = /usr/bin/perl 253 | #--------------------------------------------------------------------------- 254 | # Configuration options related to the dot tool 255 | #--------------------------------------------------------------------------- 256 | CLASS_DIAGRAMS = YES 257 | HIDE_UNDOC_RELATIONS = YES 258 | HAVE_DOT = NO 259 | CLASS_GRAPH = YES 260 | COLLABORATION_GRAPH = YES 261 | GROUP_GRAPHS = YES 262 | UML_LOOK = NO 263 | TEMPLATE_RELATIONS = NO 264 | INCLUDE_GRAPH = YES 265 | INCLUDED_BY_GRAPH = YES 266 | CALL_GRAPH = NO 267 | CALLER_GRAPH = NO 268 | GRAPHICAL_HIERARCHY = YES 269 | DIRECTORY_GRAPH = YES 270 | DOT_IMAGE_FORMAT = png 271 | DOT_PATH = 272 | DOTFILE_DIRS = 273 | MAX_DOT_GRAPH_WIDTH = 1024 274 | MAX_DOT_GRAPH_HEIGHT = 1024 275 | MAX_DOT_GRAPH_DEPTH = 1000 276 | DOT_TRANSPARENT = NO 277 | DOT_MULTI_TARGETS = NO 278 | GENERATE_LEGEND = YES 279 | DOT_CLEANUP = YES 280 | #--------------------------------------------------------------------------- 281 | # Configuration::additions related to the search engine 282 | #--------------------------------------------------------------------------- 283 | SEARCHENGINE = NO 284 | -------------------------------------------------------------------------------- /src/arg_parser.cpp: -------------------------------------------------------------------------------- 1 | /* Arg_parser - A POSIX/GNU command line argument parser. 2 | Copyright (C) 2006, 2007, 2008 Antonio Diaz Diaz. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "arg_parser.h" 23 | 24 | 25 | bool Arg_parser::parse_long_option( const char * const opt, const char * const arg, 26 | const Option options[], int & argind ) throw() 27 | { 28 | unsigned int len; 29 | int index = -1; 30 | bool exact = false, ambig = false; 31 | 32 | for( len = 0; opt[len+2] && opt[len+2] != '='; ++len ) ; 33 | 34 | // Test all long options for either exact match or abbreviated matches. 35 | for( int i = 0; options[i].code != 0; ++i ) 36 | if( options[i].name && !std::strncmp( options[i].name, &opt[2], len ) ) { 37 | if( std::strlen( options[i].name ) == len ) { // Exact match found 38 | index = i; 39 | exact = true; 40 | break; 41 | } else if( index < 0 ) index = i; // First nonexact match found 42 | else if( options[index].code != options[i].code || 43 | options[index].has_arg != options[i].has_arg ) 44 | ambig = true; // Second or later nonexact match found 45 | } 46 | 47 | if( ambig && !exact ) { 48 | _error = "option `"; 49 | _error += opt; 50 | _error += "' is ambiguous"; 51 | return false; 52 | } 53 | 54 | if( index < 0 ) { // nothing found 55 | _error = "unrecognized option `"; 56 | _error += opt; 57 | _error += '\''; 58 | return false; 59 | } 60 | 61 | ++argind; 62 | data.push_back( Record( options[index].code ) ); 63 | 64 | if( opt[len+2] ) { // `--=' syntax 65 | if( options[index].has_arg == no ) { 66 | _error = "option `--"; 67 | _error += options[index].name; 68 | _error += "' doesn't allow an argument"; 69 | return false; 70 | } 71 | if( options[index].has_arg == yes && !opt[len+3] ) { 72 | _error = "option `--"; 73 | _error += options[index].name; 74 | _error += "' requires an argument"; 75 | return false; 76 | } 77 | data.back().argument = &opt[len+3]; 78 | return true; 79 | } 80 | 81 | if( options[index].has_arg == yes ) { 82 | if( !arg ) { 83 | _error = "option `--"; 84 | _error += options[index].name; 85 | _error += "' requires an argument"; 86 | return false; 87 | } 88 | ++argind; 89 | data.back().argument = arg; 90 | return true; 91 | } 92 | 93 | return true; 94 | } 95 | 96 | 97 | bool Arg_parser::parse_short_option( const char * const opt, const char * const arg, 98 | const Option options[], int & argind ) throw() 99 | { 100 | int cind = 1; // character index in opt 101 | 102 | while( cind > 0 ) { 103 | int index = -1; 104 | const unsigned char code = opt[cind]; 105 | 106 | if( code != 0 ) 107 | for( int i = 0; options[i].code; ++i ) 108 | if( code == options[i].code ) { 109 | index = i; 110 | break; 111 | } 112 | 113 | if( index < 0 ) { 114 | _error = "invalid option -- "; 115 | _error += code; 116 | return false; 117 | } 118 | 119 | data.push_back( Record( code ) ); 120 | if( opt[++cind] == 0 ) { 121 | ++argind; // opt finished 122 | cind = 0; 123 | } 124 | 125 | if( options[index].has_arg != no && cind > 0 && opt[cind] ) { 126 | data.back().argument = &opt[cind]; 127 | ++argind; 128 | cind = 0; 129 | } else if( options[index].has_arg == yes ) { 130 | if( !arg || !arg[0] ) { 131 | _error = "option requires an argument -- "; 132 | _error += code; 133 | return false; 134 | } 135 | data.back().argument = arg; 136 | ++argind; 137 | cind = 0; 138 | } 139 | } 140 | return true; 141 | } 142 | 143 | 144 | Arg_parser::Arg_parser( const int argc, const char * const argv[], 145 | const Option options[], const bool in_order ) throw() 146 | { 147 | if( argc < 2 || !argv || !options ) return; 148 | 149 | std::vector< std::string > non_options; // skipped non-options 150 | int argind = 1; // index in argv 151 | 152 | while( argind < argc ) { 153 | const unsigned char ch1 = argv[argind][0]; 154 | const unsigned char ch2 = ( ch1 ? argv[argind][1] : 0 ); 155 | 156 | if( ch1 == '-' && ch2 ) { // we found an option 157 | const char * const opt = argv[argind]; 158 | const char * const arg = (argind + 1 < argc) ? argv[argind+1] : 0; 159 | if( ch2 == '-' ) { 160 | if( !argv[argind][2] ) { 161 | ++argind; // we found "--" 162 | break; 163 | } else if( !parse_long_option( opt, arg, options, argind ) ) break; 164 | } else if( !parse_short_option( opt, arg, options, argind ) ) break; 165 | } else { 166 | if( !in_order ) non_options.push_back( argv[argind++] ); 167 | else { 168 | data.push_back( Record() ); 169 | data.back().argument = argv[argind++]; 170 | } 171 | } 172 | } 173 | if( _error.size() ) data.clear(); 174 | else { 175 | for( unsigned int i = 0; i < non_options.size(); ++i ) { 176 | data.push_back( Record() ); 177 | data.back().argument.swap( non_options[i] ); 178 | } 179 | while( argind < argc ) { 180 | data.push_back( Record() ); 181 | data.back().argument = argv[argind++]; 182 | } 183 | } 184 | } 185 | 186 | 187 | Arg_parser::Arg_parser( const char * const opt, const char * const arg, 188 | const Option options[] ) throw() 189 | { 190 | if( !opt || !opt[0] || !options ) return; 191 | 192 | if( opt[0] == '-' && opt[1] ) { // we found an option 193 | int argind = 1; // dummy 194 | if( opt[1] == '-' ) { 195 | if( opt[2] ) parse_long_option( opt, arg, options, argind ); 196 | } else 197 | parse_short_option( opt, arg, options, argind ); 198 | if( _error.size() ) data.clear(); 199 | } else { 200 | data.push_back( Record() ); 201 | data.back().argument = opt; 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /src/arg_parser.h: -------------------------------------------------------------------------------- 1 | /* Arg_parser - A POSIX/GNU command line argument parser. 2 | Copyright (C) 2006, 2007, 2008 Antonio Diaz Diaz. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | /* Arg_parser reads the arguments in `argv' and creates a number of 19 | option codes, option arguments and non-option arguments. 20 | 21 | In case of error, `error' returns a non-empty error message. 22 | 23 | `options' is an array of `struct Option' terminated by an element 24 | containing a code which is zero. A null name means a short-only 25 | option. A code value outside the unsigned char range means a 26 | long-only option. 27 | 28 | Arg_parser normally makes it appear as if all the option arguments 29 | were specified before all the non-option arguments for the purposes 30 | of parsing, even if the user of your program intermixed option and 31 | non-option arguments. If you want the arguments in the exact order 32 | the user typed them, call `Arg_parser' with `in_order' = true. 33 | 34 | The argument `--' terminates all options; any following arguments are 35 | treated as non-option arguments, even if they begin with a hyphen. 36 | 37 | The syntax for optional option arguments is `-' 38 | (without whitespace), or `--='. 39 | */ 40 | 41 | class Arg_parser 42 | { 43 | public: 44 | enum Has_arg { no, yes, maybe }; 45 | 46 | struct Option { 47 | int code; // Short option letter or code ( code != 0 ) 48 | const char * name; // Long option name (maybe null) 49 | Has_arg has_arg; 50 | }; 51 | 52 | private: 53 | struct Record { 54 | int code; 55 | std::string argument; 56 | Record( const int c = 0 ) : code( c ) {} 57 | }; 58 | 59 | std::string _error; 60 | std::vector< Record > data; 61 | 62 | bool parse_long_option( const char * const opt, const char * const arg, 63 | const Option options[], int & argind ) throw(); 64 | bool parse_short_option( const char * const opt, const char * const arg, 65 | const Option options[], int & argind ) throw(); 66 | 67 | public: 68 | Arg_parser( const int argc, const char * const argv[], 69 | const Option options[], const bool in_order = false ) throw(); 70 | 71 | // Restricted constructor. Parses a single token and argument (if any) 72 | Arg_parser( const char * const opt, const char * const arg, 73 | const Option options[] ) throw(); 74 | 75 | const std::string & error() const throw() 76 | { 77 | return _error; 78 | } 79 | 80 | // The number of arguments parsed (may be different from argc) 81 | int arguments() const throw() 82 | { 83 | return data.size(); 84 | } 85 | 86 | // If code( i ) is 0, argument( i ) is a non-option. 87 | // Else argument( i ) is the option's argument (or empty). 88 | int code( const int i ) const throw() 89 | { 90 | if( i >= 0 && i < arguments() ) return data[i].code; 91 | else return 0; 92 | } 93 | 94 | const std::string & argument( const int i ) const throw() 95 | { 96 | if( i >= 0 && i < arguments() ) return data[i].argument; 97 | else return _error; 98 | } 99 | }; 100 | -------------------------------------------------------------------------------- /src/bbcodegenerator.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | bbcodegenerator.cpp - description 3 | ------------------- 4 | 5 | copyright : (C) 2011 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "bbcodegenerator.h" 31 | #include "version.h" 32 | 33 | namespace ansifilter 34 | { 35 | 36 | BBCodeGenerator::BBCodeGenerator (): 37 | CodeGenerator(BBCODE), 38 | fileSuffix(".bbcode") 39 | { 40 | newLineTag="\n"; 41 | spacer=" "; 42 | } 43 | 44 | string BBCodeGenerator::getOpenTag() 45 | { 46 | ostringstream fmtStream; 47 | 48 | if (elementStyle.isFgColorSet()) { 49 | fmtStream << "[color=#" 50 | << elementStyle.getFgColour().getRed(HTML) 51 | << elementStyle.getFgColour().getGreen(HTML) 52 | << elementStyle.getFgColour().getBlue(HTML) 53 | << "]"; 54 | } 55 | 56 | if ( elementStyle.isBold() ) fmtStream << "[b]"; 57 | if ( elementStyle.isItalic() ) fmtStream << "[i]"; 58 | if ( elementStyle.isUnderline() ) fmtStream << "[u]"; 59 | 60 | 61 | string fmt = fmtStream.str(); 62 | tagIsOpen = fmt.size()>0; 63 | if (tagIsOpen) { 64 | ostringstream spanTag; 65 | spanTag<0x1f ) { // printable? 113 | return string( 1, c ); 114 | } else { 115 | return ""; 116 | } 117 | } 118 | 119 | return ""; 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/bbcodegenerator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | bbcdegenerator.h - description 3 | ------------------- 4 | 5 | copyright : (C) 2011 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | 27 | #ifndef BBCodeGenerator_H 28 | #define BBCodeGenerator_H 29 | 30 | #include 31 | 32 | #include "codegenerator.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates HTML. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Andre Simon 45 | */ 46 | 47 | class BBCodeGenerator : public ansifilter::CodeGenerator 48 | { 49 | public: 50 | 51 | BBCodeGenerator(); 52 | 53 | virtual ~BBCodeGenerator() {}; 54 | 55 | protected: 56 | 57 | string fileSuffix; ///< filename extension 58 | 59 | private: 60 | 61 | string getOpenTag(); 62 | string getCloseTag(); 63 | 64 | /** Print document header 65 | */ 66 | string getHeader(); 67 | 68 | /** Print document body*/ 69 | void printBody(); 70 | 71 | /** Print document footer*/ 72 | string getFooter(); 73 | 74 | /** \return escaped character*/ 75 | virtual string maskCharacter(unsigned char ); 76 | }; 77 | 78 | } 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/charcodes.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | charcodes.cpp - description 3 | ------------------- 4 | begin : Wed Nov 24 2003 5 | copyright : (C) 2003 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #ifndef CHAR_CODES 27 | #define CHAR_CODES 28 | 29 | #ifdef _WIN32 30 | 31 | #define AUML_LC 228 32 | #define OUML_LC 246 33 | #define UUML_LC 252 34 | 35 | #define AUML_UC 196 36 | #define OUML_UC 214 37 | #define UUML_UC 220 38 | 39 | 40 | #define AACUTE_LC 225 41 | #define EACUTE_LC 233 42 | #define OACUTE_LC 243 43 | #define UACUTE_LC 250 44 | 45 | #define AACUTE_UC 193 46 | #define EACUTE_UC 201 47 | #define OACUTE_UC 211 48 | #define UACUTE_UC 218 49 | 50 | #define AGRAVE_LC 224 51 | #define EGRAVE_LC 232 52 | #define OGRAVE_LC 242 53 | #define UGRAVE_LC 249 54 | 55 | #define AGRAVE_UC 192 56 | #define EGRAVE_UC 200 57 | #define OGRAVE_UC 210 58 | #define UGRAVE_UC 217 59 | 60 | #define SZLIG 223 61 | 62 | #else 63 | 64 | #define AUML_LC 164 65 | #define OUML_LC 182 66 | #define UUML_LC 188 67 | 68 | #define AUML_UC 132 69 | #define OUML_UC 150 70 | #define UUML_UC 156 71 | 72 | 73 | #define AACUTE_LC 161 74 | #define EACUTE_LC 169 75 | #define OACUTE_LC 179 76 | #define UACUTE_LC 186 77 | 78 | #define AACUTE_UC 129 79 | #define EACUTE_UC 137 80 | #define OACUTE_UC 147 81 | #define UACUTE_UC 154 82 | 83 | #define AGRAVE_LC 160 84 | #define EGRAVE_LC 168 85 | #define OGRAVE_LC 178 86 | #define UGRAVE_LC 185 87 | 88 | #define AGRAVE_UC 128 89 | #define EGRAVE_UC 136 90 | #define OGRAVE_UC 146 91 | #define UGRAVE_UC 153 92 | 93 | #define SZLIG 159 94 | 95 | #endif 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/cmdlineoptions.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | cmdlineoptions.cpp - description 3 | ------------------- 4 | begin : Sun Oct 13 2007 5 | copyright : (C) 2007-2017 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "arg_parser.h" 32 | #include "cmdlineoptions.h" 33 | #include "platform_fs.h" 34 | #include "stringtools.h" 35 | 36 | using namespace std; 37 | 38 | const Arg_parser::Option options[] = { 39 | { 'a', "anchors", Arg_parser::no }, 40 | { 'd', "doc-title", Arg_parser::yes }, 41 | { 'e', "encoding", Arg_parser::yes }, 42 | { 'f', "fragment", Arg_parser::no }, 43 | { 'F', "font", Arg_parser::yes }, 44 | { 'h', "help", Arg_parser::no }, 45 | { 'H', "html", Arg_parser::no }, 46 | { 'M', "pango", Arg_parser::no }, 47 | { 'i', "input", Arg_parser::yes }, 48 | { 'l', "line-numbers", Arg_parser::no }, 49 | { 'L', "latex", Arg_parser::no }, 50 | { 'P', "tex", Arg_parser::no }, 51 | { 'B', "bbcode", Arg_parser::no }, 52 | { 'o', "output", Arg_parser::yes }, 53 | { 'O', "outdir", Arg_parser::yes }, 54 | { 'p', "plain", Arg_parser::no }, 55 | { 'r', "style-ref", Arg_parser::yes }, 56 | { 'R', "rtf", Arg_parser::no }, 57 | { 's', "font-size", Arg_parser::yes }, 58 | { 't', "tail", Arg_parser::no }, 59 | { 'T', "text", Arg_parser::no }, 60 | { 'w', "wrap", Arg_parser::yes }, 61 | { 'v', "version", Arg_parser::no }, 62 | { 'V', "version", Arg_parser::no }, 63 | { 'W', "wrap-no-numbers", Arg_parser::no }, 64 | { 'X', "art-cp437", Arg_parser::no }, 65 | { 'U', "art-bin", Arg_parser::no }, 66 | { 'D', "art-tundra", Arg_parser::no }, 67 | { 'Y', "art-width", Arg_parser::yes }, 68 | { 'Z', "art-height", Arg_parser::yes }, 69 | { 'm', "map", Arg_parser::yes }, 70 | { 'N', "no-trailing-nl", Arg_parser::no }, 71 | { 'C', "no-version-info", Arg_parser::no }, 72 | 73 | { 0, 0, Arg_parser::no } 74 | }; 75 | 76 | CmdLineOptions::CmdLineOptions( const int argc, const char *argv[] ): 77 | outputType (ansifilter::TEXT), 78 | opt_help(false), 79 | opt_version(false), 80 | opt_fragment(false), 81 | opt_plain(false), 82 | opt_ignoreEOF(false), 83 | opt_linenum(false), 84 | opt_wrapNoNum(false), 85 | opt_anchors(false), 86 | opt_cp437(false), 87 | opt_asciiBin(false), 88 | opt_asciiTundra(false), 89 | opt_omit_trailing_cr(false), 90 | opt_omit_version_info(false), 91 | encodingName("ISO-8859-1"), 92 | font("Courier New"), 93 | fontSize("10pt"), 94 | wrapLineLen(0), 95 | asciiArtWidth(80), 96 | asciiArtHeight(100) 97 | { 98 | char* hlEnvOptions=getenv("ANSIFILTER_OPTIONS"); 99 | if (hlEnvOptions!=NULL) { 100 | std::ostringstream envos; 101 | envos< ls; 105 | std::vector options; 106 | while (ss >> arg) 107 | { 108 | ls.push_back(arg); 109 | options.push_back(const_cast(ls.back().c_str())); 110 | } 111 | options.push_back(0); 112 | parseRuntimeOptions(options.size()-1, (const char**) &options[0], false); 113 | } 114 | 115 | parseRuntimeOptions(argc, argv); 116 | } 117 | 118 | CmdLineOptions::~CmdLineOptions() {} 119 | 120 | void CmdLineOptions::parseRuntimeOptions( const int argc, const char *argv[], bool readInputFilenames) { 121 | Arg_parser parser( argc, argv, options ); 122 | if( parser.error().size() ) { // bad option 123 | cerr << "ansifilter: "<< parser.error()<<"\n"; 124 | cerr << "Try 'ansifilter --help' for more information.\n"; 125 | exit( 1 ); 126 | } 127 | 128 | int argind = 0; 129 | for( ; argind < parser.arguments(); ++argind ) { 130 | const int code = parser.code( argind ); 131 | const std::string & arg = parser.argument( argind ); 132 | if( !code ) break; 133 | switch( code ) { 134 | /* tbd 135 | case 'O': 136 | { 137 | const string tmp = StringTools::change_case ( arg ); 138 | if ( tmp == "xhtml" ) 139 | outputType = highlight::XHTML; 140 | else if ( tmp == "tex" ) 141 | outputType = highlight::TEX; 142 | else if ( tmp == "latex" ) 143 | outputType = highlight::LATEX; 144 | else if ( tmp == "rtf" ) 145 | outputType = highlight::RTF; 146 | else if ( tmp == "svg" ) 147 | outputType = highlight::SVG; 148 | else if ( tmp == "bbcode" ) 149 | outputType = highlight::BBCODE; 150 | else if ( tmp == "odt" ) 151 | outputType = highlight::ODTFLAT; 152 | else 153 | outputType = highlight::HTML; 154 | } 155 | break; 156 | */ 157 | case 'a': 158 | opt_anchors = true; 159 | break; 160 | case 'B': 161 | outputType = ansifilter::BBCODE; 162 | break; 163 | case 'd': 164 | docTitle = arg; 165 | break; 166 | case 'e': 167 | encodingName = arg; 168 | break; 169 | case 'f': 170 | opt_fragment = true; 171 | break; 172 | case 'F': 173 | font = arg; 174 | break; 175 | case 'h': 176 | opt_help = true; 177 | break; 178 | case 'H': 179 | outputType = ansifilter::HTML; 180 | break; 181 | case 'i': 182 | inputFileNames.push_back( arg ); 183 | break; 184 | case 'l': 185 | opt_linenum=true; 186 | break; 187 | case 'L': 188 | outputType = ansifilter::LATEX; 189 | break; 190 | case 'm': 191 | colorMapPath = arg; 192 | break; 193 | case 'M': 194 | outputType = ansifilter::PANGO; 195 | break; 196 | case 'P': 197 | outputType = ansifilter::TEX; 198 | break; 199 | case 'o': 200 | outFilename = arg; 201 | break; 202 | case 'p': 203 | opt_plain = true; 204 | break; 205 | case 'r': 206 | styleSheetPath = arg; 207 | break; 208 | case 'R': 209 | outputType = ansifilter::RTF; 210 | break; 211 | case 's': 212 | fontSize = arg; 213 | break; 214 | case 't': 215 | opt_ignoreEOF = true; 216 | break; 217 | case 'T': 218 | outputType = ansifilter::TEXT; 219 | break; 220 | case 'v': 221 | case 'V': 222 | opt_version = true; 223 | break; 224 | case 'O': 225 | outDirectory = validateDirPath( arg ); 226 | break; 227 | case 'w': 228 | wrapLineLen=atoi(arg.c_str())-1; 229 | break; 230 | case 'W': 231 | opt_wrapNoNum=true; 232 | break; 233 | case 'X': 234 | opt_cp437=true; 235 | break; 236 | case 'U': 237 | opt_asciiBin=true; 238 | break; 239 | case 'D': 240 | opt_asciiTundra=true; 241 | break; 242 | case 'Y': 243 | asciiArtWidth=atoi(arg.c_str()); 244 | break; 245 | case 'Z': 246 | asciiArtHeight=atoi(arg.c_str()); 247 | break; 248 | case 'N': 249 | opt_omit_trailing_cr=true; 250 | break; 251 | case 'C': 252 | opt_omit_version_info=true; 253 | break; 254 | default: 255 | cerr << "ansifilter: option parsing failed" << endl; 256 | } 257 | } 258 | 259 | if (readInputFilenames) { 260 | if (argind < parser.arguments()) { //still args left 261 | if (inputFileNames.empty()) { 262 | while (argind < parser.arguments()) { 263 | inputFileNames.push_back( parser.argument( argind++ ) ); 264 | } 265 | } 266 | } else if (inputFileNames.empty()) { 267 | inputFileNames.push_back(""); 268 | } 269 | } 270 | } 271 | 272 | string CmdLineOptions::validateDirPath(const string & path) 273 | { 274 | return (path[path.length()-1] !=Platform::pathSeparator)? 275 | path+Platform::pathSeparator : path; 276 | } 277 | 278 | string CmdLineOptions::getSingleOutFilename() 279 | { 280 | if (!inputFileNames.empty() && !outDirectory.empty()) { 281 | if (outFilename.empty()) { 282 | outFilename = outDirectory; 283 | int delim = getSingleInFilename().find_last_of(Platform::pathSeparator)+1; 284 | outFilename += getSingleInFilename().substr((delim>-1)?delim:0) 285 | + getOutFileSuffix(); 286 | } 287 | } 288 | return outFilename; 289 | } 290 | 291 | string CmdLineOptions::getSingleInFilename() const 292 | { 293 | return inputFileNames[0]; 294 | } 295 | 296 | string CmdLineOptions::getOutDirectory() 297 | { 298 | if (!outFilename.empty() && !inputFileNames.size()) { 299 | outDirectory=getDirName(outFilename); 300 | } 301 | return outDirectory; 302 | } 303 | 304 | string CmdLineOptions::getDirName(const string & path) 305 | { 306 | size_t dirNameLength=path.rfind(Platform::pathSeparator); 307 | return (dirNameLength==string::npos)?string():path.substr(0, dirNameLength+1); 308 | } 309 | 310 | bool CmdLineOptions::printVersion()const 311 | { 312 | return opt_version; 313 | } 314 | 315 | bool CmdLineOptions::printHelp()const 316 | { 317 | return opt_help; 318 | } 319 | 320 | bool CmdLineOptions::fragmentOutput()const 321 | { 322 | return opt_fragment; 323 | } 324 | 325 | bool CmdLineOptions::showLineNumbers()const 326 | { 327 | return opt_linenum; 328 | } 329 | 330 | bool CmdLineOptions::parseCP437() const 331 | { 332 | return opt_cp437; 333 | } 334 | 335 | bool CmdLineOptions::parseAsciiBin() const{ 336 | return opt_asciiBin; 337 | } 338 | 339 | bool CmdLineOptions::parseAsciiTundra() const{ 340 | return opt_asciiTundra; 341 | } 342 | int CmdLineOptions::getAsciiArtWidth() const { 343 | return asciiArtWidth; 344 | } 345 | int CmdLineOptions::getAsciiArtHeight() const{ 346 | return asciiArtHeight; 347 | } 348 | 349 | string CmdLineOptions::getOutFileSuffix()const 350 | { 351 | switch (outputType) { 352 | case ansifilter::HTML: 353 | return ".html"; 354 | case ansifilter::PANGO: 355 | return ".pango"; 356 | case ansifilter::XHTML: 357 | return ".xhtml"; 358 | case ansifilter::RTF: 359 | return ".rtf"; 360 | case ansifilter::TEX: 361 | case ansifilter::LATEX: 362 | return ".tex"; 363 | case ansifilter::BBCODE: 364 | return ".bbcode"; 365 | default: 366 | return ".txt"; 367 | } 368 | } 369 | 370 | string CmdLineOptions::getEncoding() const 371 | { 372 | return encodingName; 373 | } 374 | 375 | string CmdLineOptions::getFont() const 376 | { 377 | return font; 378 | } 379 | 380 | string CmdLineOptions::getFontSize() const 381 | { 382 | return fontSize; 383 | } 384 | 385 | string CmdLineOptions::getMapPath() const 386 | { 387 | return colorMapPath; 388 | } 389 | 390 | bool CmdLineOptions::plainOutput() const 391 | { 392 | return opt_plain; 393 | } 394 | 395 | bool CmdLineOptions::ignoreInputEOF() const 396 | { 397 | return opt_ignoreEOF; 398 | } 399 | 400 | bool CmdLineOptions::wrapNoNumbers() const 401 | { 402 | return opt_wrapNoNum; 403 | } 404 | 405 | bool CmdLineOptions::addAnchors() const 406 | { 407 | return opt_anchors; 408 | } 409 | bool CmdLineOptions::omitEncoding() const 410 | { 411 | return StringTools::lowerCase(encodingName)=="none"; 412 | } 413 | 414 | bool CmdLineOptions::omitTrailingCR() const 415 | { 416 | return opt_omit_trailing_cr; 417 | } 418 | bool CmdLineOptions::omitVersionInfo() const 419 | { 420 | return opt_omit_version_info; 421 | } 422 | string CmdLineOptions::getDocumentTitle() const 423 | { 424 | return docTitle; 425 | } 426 | 427 | string CmdLineOptions::getStyleSheetPath() const 428 | { 429 | return styleSheetPath; 430 | } 431 | 432 | const vector & CmdLineOptions::getInputFileNames() const 433 | { 434 | return inputFileNames; 435 | } 436 | 437 | ansifilter::OutputType CmdLineOptions::getOutputType() const 438 | { 439 | return outputType; 440 | } 441 | 442 | int CmdLineOptions::getWrapLineLength() const 443 | { 444 | return wrapLineLen; 445 | } 446 | 447 | -------------------------------------------------------------------------------- /src/cmdlineoptions.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | cmdlineoptions.h - description 3 | ------------------- 4 | begin : Sun Oct 13 2007 5 | copyright : (C) 2007-2017 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #ifndef CMDLINEOPTIONS_H 27 | #define CMDLINEOPTIONS_H 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include "enums.h" 36 | 37 | 38 | using namespace std; 39 | 40 | /// handle command line options 41 | 42 | class CmdLineOptions 43 | { 44 | public: 45 | 46 | /**Constructor 47 | \param argc Argument count 48 | \param argv Argument strings 49 | */ 50 | CmdLineOptions( const int argc, const char *argv[] ); 51 | ~CmdLineOptions(); 52 | 53 | /** \return Single output file name*/ 54 | string getSingleOutFilename(); 55 | 56 | /** \return Single input file name*/ 57 | string getSingleInFilename() const; 58 | 59 | /** \return Output directory*/ 60 | string getOutDirectory() ; 61 | 62 | /** \return Character encoding*/ 63 | string getEncoding() const; 64 | 65 | /** \return font name*/ 66 | string getFont() const; 67 | 68 | /** \return font size*/ 69 | string getFontSize() const; 70 | 71 | /** \return path to color map*/ 72 | string getMapPath() const; 73 | 74 | /** \return True if version information should be printed*/ 75 | bool printVersion() const; 76 | 77 | /** \return True if help information should be printed*/ 78 | bool printHelp() const; 79 | 80 | /** \return True if output should be fragmented*/ 81 | bool fragmentOutput() const; 82 | 83 | /** \return output file suffix */ 84 | string getOutFileSuffix() const; 85 | 86 | /** \return Output file format */ 87 | ansifilter::OutputType getOutputType() const; 88 | 89 | /** \return True if encoding specification should be omitted in output*/ 90 | bool omitEncoding() const; 91 | 92 | /** \return True if formatting infotmation should not be outputted */ 93 | bool plainOutput() const; 94 | 95 | /** \return True if input files should be raed after EOF occoured */ 96 | bool ignoreInputEOF() const; 97 | 98 | /** \return True if line numbers should be printed */ 99 | bool showLineNumbers() const; 100 | 101 | /** \return True if anchors should be added to line numbers */ 102 | bool addAnchors() const; 103 | 104 | /** \return True if line numbers should be printed */ 105 | bool wrapNoNumbers() const; 106 | 107 | /** \return True if input should be treated as codepage 437 ASCII art */ 108 | bool parseCP437() const; 109 | 110 | /** \return True if input should be treated as BIN ASCII art */ 111 | bool parseAsciiBin() const; 112 | 113 | bool parseAsciiTundra() const; 114 | 115 | /** \return True if output should not be terminated with carriage return */ 116 | bool omitTrailingCR() const; 117 | 118 | /** \return True if output should not contain a version info comment */ 119 | bool omitVersionInfo() const; 120 | 121 | /** \return Document title */ 122 | string getDocumentTitle() const ; 123 | 124 | /** \return Document title */ 125 | string getStyleSheetPath() const ; 126 | 127 | /** \return List of input file names*/ 128 | const vector & getInputFileNames() const; 129 | 130 | int getWrapLineLength() const; 131 | 132 | int getAsciiArtWidth() const; 133 | int getAsciiArtHeight() const; 134 | 135 | private: 136 | ansifilter::OutputType outputType; 137 | 138 | bool opt_help; 139 | bool opt_version ; 140 | bool opt_fragment; 141 | bool opt_plain; 142 | bool opt_ignoreEOF; 143 | bool opt_linenum; 144 | bool opt_wrapNoNum; 145 | bool opt_anchors; 146 | bool opt_cp437; 147 | bool opt_asciiBin; 148 | bool opt_asciiTundra; 149 | 150 | bool opt_omit_trailing_cr; 151 | bool opt_omit_version_info; 152 | 153 | // name of single output file 154 | string outFilename; 155 | string docTitle; 156 | string encodingName; 157 | string outDirectory; 158 | string font; 159 | string fontSize; 160 | string styleSheetPath; 161 | string colorMapPath; 162 | 163 | int wrapLineLen; 164 | int asciiArtWidth; 165 | int asciiArtHeight; 166 | 167 | /** list of all input file names */ 168 | vector inputFileNames; 169 | 170 | /** \return Valid path name */ 171 | string validateDirPath(const string & path); 172 | 173 | /** \return directory name of path */ 174 | string getDirName( const string & path); 175 | 176 | void parseRuntimeOptions( const int argc, const char *argv[], bool readInputFilenames=true); 177 | 178 | }; 179 | 180 | #endif 181 | -------------------------------------------------------------------------------- /src/codegenerator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | codegenerator.h - description 3 | ------------------- 4 | copyright : (C) 2007-2017 by Andre Simon 5 | email : andre.simon1@gmx.de 6 | ***************************************************************************/ 7 | 8 | /* 9 | This file is part of ANSIFilter. 10 | 11 | ANSIFilter is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | ANSIFilter is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with ANSIFilter. If not, see . 23 | */ 24 | 25 | #ifndef CODEPARSER_H 26 | #define CODEPARSER_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | // Avoid problems with isspace and UTF-8 characters, use iswspace instead 34 | //#include 35 | #include 36 | 37 | #include "elementstyle.h" 38 | #include "preformatter.h" 39 | 40 | #include "enums.h" 41 | #include "stringtools.h" 42 | 43 | /// The ansifilter namespace contains all classes and data structures needed for parsing input data. 44 | 45 | namespace ansifilter 46 | { 47 | 48 | /** TheDraw output information of individual characters*/ 49 | struct TDChar { 50 | unsigned char c; 51 | ElementStyle style; 52 | }; 53 | 54 | 55 | /** \brief Base class for escape sequence parsing. 56 | 57 | The virtual class provides escape sequence parsing functionality.
58 | The derived classes have to define the output format.
59 | Codegenerator is a singleton class. 60 | 61 | * @author Andre Simon 62 | */ 63 | 64 | class CodeGenerator 65 | { 66 | 67 | public: 68 | 69 | virtual ~CodeGenerator(); 70 | 71 | /** 72 | Get appropriate Codegenerator instance 73 | \param type Output file type (TEXT, PANGO, HTML, RTF, LATEX, TEX) 74 | */ 75 | static CodeGenerator* getInstance(OutputType type); 76 | 77 | /** 78 | Delete Codegenerator instance (this is intended for SWIG integration, 79 | in normal C++ code the result should be saved in an auto_ptr) 80 | \param CodeGenerator* CodeGenerator instance 81 | */ 82 | static void deleteInstance(CodeGenerator* inst) 83 | { 84 | if (inst) delete inst; 85 | } 86 | 87 | /** 88 | Generates output file 89 | \param inFileName Path of input file (if empty use stdin) 90 | \param outFileName Path of output file (if empty use stdout) 91 | \return ParseError 92 | */ 93 | ParseError generateFile(const string &inFileName, const string &outFileName); 94 | 95 | /** 96 | Generates output string from input string 97 | \param input input code string 98 | \return formatted output code 99 | */ 100 | string generateString(const string &input); 101 | 102 | /** 103 | Generates output string from input file 104 | \param inFileName file path 105 | \return formatted output code 106 | */ 107 | string generateStringFromFile(const string &inFileName); 108 | 109 | /** 110 | Generates output file from input string 111 | \param sourceStr input string 112 | \param outFileName output file path 113 | \param title document title 114 | \return formatted output code 115 | */ 116 | ParseError generateFileFromString (const string &sourceStr, 117 | const string &outFileName, 118 | const string &title); 119 | 120 | /** 121 | Overrides default colours by user defined values; resets palette to default if mapPath is empty 122 | \param mapPath path of map file 123 | \return true if parsing was successfull 124 | */ 125 | bool setColorMap(const string& mapPath); 126 | 127 | /** tell parser to omit document header and footer 128 | \param flag true if output should be fragmented 129 | */ 130 | void setFragmentCode(bool flag); 131 | 132 | /** \return fragment flag */ 133 | bool getFragmentCode(); 134 | 135 | /** tell parser to use this font as base font 136 | \param s the font name, e.g. "Courier New" 137 | */ 138 | void setFont(const string& s); 139 | 140 | /** \return base font */ 141 | const string getFont() const ; 142 | 143 | /** tell parser to use this size as base font size 144 | \param s the font size, e.g. "12" 145 | */ 146 | void setFontSize(const string& s); 147 | 148 | /** \return base font size*/ 149 | const string getFontSize(); 150 | 151 | /** Set encloding 152 | \param encodingName encoding name 153 | */ 154 | void setEncoding(const string& encodingName); 155 | 156 | /** \param title Document title */ 157 | void setTitle(const string & title); 158 | 159 | /** \return Document title */ 160 | string getTitle(); 161 | 162 | /** \param path style sheet path*/ 163 | void setStyleSheet(const string & path); 164 | 165 | /** \param b set to true if text formatting should be stripped */ 166 | void setPlainOutput(bool b) 167 | { 168 | ignoreFormatting=b; 169 | } 170 | 171 | /** \param b set to true if HTML anchors should be added to line numbers */ 172 | void setAddAnchors(bool b) 173 | { 174 | addAnchors=b; 175 | } 176 | 177 | /** \param b set to true if the input stream is not closed after reaching EOF */ 178 | void setContinueReading(bool b) 179 | { 180 | readAfterEOF=b; 181 | } 182 | 183 | /** \param b set to true if the output should not be terminated with EOL*/ 184 | void setOmitTrailingCR(bool b) 185 | { 186 | omitTrailingCR=b; 187 | } 188 | 189 | /** \param b set to true if the output should not contain a version info comment*/ 190 | void setOmitVersionInfo(bool b) 191 | { 192 | omitVersionInfo=b; 193 | } 194 | 195 | /** \return plain outputting flag */ 196 | bool getPlainOutput() 197 | { 198 | return ignoreFormatting; 199 | } 200 | 201 | /** \return continue reading from input stream flag */ 202 | bool getContinueReading() 203 | { 204 | return readAfterEOF; 205 | } 206 | 207 | /** \param lineWrappingStyle wrapping style 208 | \param lineLength maximum length per wrapped text line */ 209 | void setPreformatting ( WrapMode lineWrappingStyle,unsigned int lineLength); 210 | 211 | /** \param b set to true if line numbers should be added */ 212 | void setShowLineNumbers(bool flag); 213 | 214 | /** \param b set to true if line numbers of wrapped lines should be omitted */ 215 | void setWrapNoNumbers(bool flag); 216 | 217 | /** \param b set to true if input is ASCII art codepage 437 file */ 218 | void setParseCodePage437(bool flag); 219 | 220 | /** \param b set to true if input is an ASCII art BIN file*/ 221 | void setParseAsciiBin(bool flag); 222 | 223 | 224 | /** \param b set to true if input is an Tundra art BIN file*/ 225 | void setParseAsciiTundra(bool flag); 226 | 227 | /** \param b set dimensions of ASCII art virtual console */ 228 | void setAsciiArtSize(int width, int height); 229 | 230 | protected: 231 | 232 | /** \param type Output type */ 233 | CodeGenerator(ansifilter::OutputType type); 234 | 235 | CodeGenerator() {} 236 | 237 | /** \param c Character to be masked 238 | \return Escape sequence of output format */ 239 | virtual string maskCharacter(unsigned char c) = 0; 240 | 241 | /** \param c Character to be masked 242 | \return Codepage 437 escape sequence of output format */ 243 | virtual string maskCP437Character(unsigned char c) { return maskCharacter(c); } 244 | 245 | /** Tag for inserting line feeds*/ 246 | string newLineTag; 247 | 248 | /** file input*/ 249 | istream *in; 250 | 251 | /** file output*/ 252 | ostream *out; 253 | 254 | bool tagIsOpen; ///< a reminder to close an open tag 255 | 256 | string styleCommentOpen, ///< open comment delimiter 257 | styleCommentClose; ///< close comment delimiter 258 | 259 | /** Encoding name */ 260 | string encoding; 261 | 262 | /** Encoding name */ 263 | string docTitle; 264 | 265 | string spacer; 266 | 267 | /** Test if header and footer should be omitted */ 268 | bool fragmentOutput; 269 | 270 | /** The base font to use */ 271 | string font ; 272 | 273 | /** The base font size to use */ 274 | string fontSize ; 275 | 276 | /** Style sheet path */ 277 | string styleSheetPath; 278 | 279 | /** Width of line numbers */ 280 | unsigned int lineNumberWidth; 281 | 282 | /** Current line number */ 283 | unsigned int lineNumber; 284 | bool showLineNumbers, ///< show line numbers 285 | numberWrappedLines, ///< also show number of wrapped lines 286 | numberCurrentLine, ///< output number of current line 287 | addAnchors; ///< add HTML anchor to line number 288 | 289 | bool omitVersionInfo; ///< do not print version info comment 290 | bool parseCP437; ///< treat input as CP437 file 291 | bool parseAsciiBin; ///< treat input as BIN or XBIN file 292 | bool parseAsciiTundra; ///< treat input as Tundra file 293 | 294 | /** Processes input data */ 295 | void processInput(); 296 | 297 | virtual void insertLineNumber (); 298 | 299 | /** \return true id encoding is defined */ 300 | bool encodingDefined() 301 | { 302 | return StringTools::lowerCase(encoding)!="none"; 303 | } 304 | 305 | /** convert a rgb triple to HTML color notation 306 | @param rgb RGB input values 307 | @return HTML color string 308 | */ 309 | string rgb2html(unsigned char* rgb); 310 | 311 | string rgb2html(int r, int g, int b); 312 | 313 | /// 16 basic colors 314 | static unsigned char workingPalette[16][3]; 315 | static unsigned char defaultPalette[16][3]; 316 | 317 | ElementStyle elementStyle; 318 | 319 | /** Class for line wrapping and tab replacement*/ 320 | PreFormatter preFormatter; 321 | 322 | private: 323 | 324 | CodeGenerator(const CodeGenerator&) {} 325 | 326 | CodeGenerator& operator=(CodeGenerator&) 327 | { 328 | return *this; 329 | } 330 | 331 | /** parses string to extract ANSI sequence information 332 | @param line text line 333 | @param begin starting position within line 334 | @param end ending position within line 335 | @return true if sequence was recognized */ 336 | bool parseSGRParameters(const string& line, size_t begin, size_t end); 337 | 338 | /** parses Codepage 437 sequence information 339 | @param line text line 340 | @param begin starting position within line 341 | @param end ending position within line 342 | 343 | */ 344 | void parseCodePage437Seq(string line, size_t begin, size_t end); 345 | 346 | /** Prints document footer 347 | @return footer */ 348 | virtual string getFooter() = 0; 349 | 350 | /** Prints document body*/ 351 | virtual void printBody() = 0; 352 | 353 | /** Prints document header 354 | @return header 355 | */ 356 | virtual string getHeader() = 0; 357 | 358 | /** Resets parser to origin state, call this after every file conversion */ 359 | void reset(); 360 | 361 | /** Output format type*/ 362 | OutputType outputType; 363 | 364 | virtual string getOpenTag() = 0; ///< returns opening formatting sequence 365 | virtual string getCloseTag() = 0; ///< returns closing formatting sequence 366 | 367 | bool ignoreFormatting; ///< ignore color and font face information 368 | bool readAfterEOF; ///< continue reading after EOF occoured 369 | bool omitTrailingCR; ///< do not print EOL at the end of output 370 | 371 | 372 | TDChar* termBuffer; 373 | int curX, curY, memX, memY, maxY; ///< cursor position for Codepage 437 sequences 374 | int asciiArtWidth; ///< virtual console column count 375 | int asciiArtHeight; ///< virtual console line count 376 | 377 | ElementStyle memStyle; 378 | 379 | /** convert an xterm color value (0-253) to 3 unsigned chars rgb 380 | @param color xterm color 381 | @param rgb RGB output values */ 382 | void xterm2rgb(unsigned char color, unsigned char* rgb); 383 | 384 | /**Print content of virtual terminal buffer. Deletes buffer. */ 385 | void printTermBuffer(); 386 | 387 | /**Parses BIN ASCII art file */ 388 | void parseBinFile(); 389 | 390 | /**Parses XBIN ASCII art file */ 391 | void parseXBinFile(); 392 | 393 | /**Parses Tundra ASCII art file */ 394 | void parseTundraFile(); 395 | 396 | /**allocate virtual terminal buffer */ 397 | void allocateTermBuffer(); 398 | 399 | /** @return true if stream begins with XBIN id */ 400 | bool streamIsXBIN(); 401 | 402 | /** @return true if stream begins with Tundra id */ 403 | bool streamIsTundra(); 404 | 405 | 406 | /// the 6 value iterations in the xterm color cube 407 | static const unsigned char valuerange[] ; 408 | }; 409 | 410 | 411 | } 412 | 413 | #endif 414 | -------------------------------------------------------------------------------- /src/elementstyle.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | elementstyle.cpp - description 3 | ------------------- 4 | copyright : (C) 2007-2011 by Andre Simon 5 | email : andre.simon1@gmx.de 6 | ***************************************************************************/ 7 | 8 | /* 9 | This file is part of ANSIFilter. 10 | 11 | ANSIFilter is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | ANSIFilter is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with ANSIFilter. If not, see . 23 | */ 24 | 25 | #include "elementstyle.h" 26 | #include 27 | namespace ansifilter 28 | { 29 | 30 | 31 | ElementStyle::ElementStyle() 32 | : bold(false), italic(false), underline(false), blink(false), 33 | reset(true), isNegativeMode(false), conceal(false), bgColorSet(false), fgColorSet(false), 34 | fgColID(0), 35 | bgColID(-1) 36 | {} 37 | 38 | ElementStyle::~ElementStyle() 39 | {} 40 | 41 | bool ElementStyle::isItalic() const 42 | { 43 | return italic; 44 | } 45 | bool ElementStyle::isBlink() const 46 | { 47 | return blink; 48 | } 49 | bool ElementStyle::isBold() const 50 | { 51 | return bold; 52 | } 53 | bool ElementStyle::isUnderline() const 54 | { 55 | return underline; 56 | } 57 | bool ElementStyle::isConceal() const 58 | { 59 | return conceal; 60 | } 61 | bool ElementStyle::isBgColorSet() const 62 | { 63 | return bgColorSet; 64 | } 65 | bool ElementStyle::isFgColorSet() const 66 | { 67 | return fgColorSet; 68 | } 69 | const StyleColour ElementStyle::getFgColour() const 70 | { 71 | return fgColour; 72 | } 73 | const StyleColour ElementStyle::getBgColour() const 74 | { 75 | return bgColour; 76 | } 77 | 78 | void ElementStyle::imageMode(bool negative) 79 | { 80 | if (negative !=isNegativeMode) { 81 | StyleColour swapCol=getFgColour(); 82 | setFgColour(getBgColour()); 83 | setBgColour(swapCol); 84 | isNegativeMode=!isNegativeMode; 85 | } 86 | } 87 | 88 | void ElementStyle::setReset(bool b) 89 | { 90 | 91 | 92 | reset=b; 93 | if (reset) { 94 | setFgColour("#000000"); 95 | setFgColourID(0); 96 | setBgColourID(-1); 97 | bold= italic= underline= conceal = blink = bgColorSet = fgColorSet = false; 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/elementstyle.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | elementstyle.h - description 3 | ------------------- 4 | 5 | copyright : (C) 2007-2011 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #ifndef ELEMENTSTYLE_H 27 | #define ELEMENTSTYLE_H 28 | 29 | #include "stylecolour.h" 30 | 31 | using namespace std; 32 | 33 | namespace ansifilter 34 | { 35 | 36 | /** \brief The class stores the basic text formatting properties. 37 | 38 | * @author Andre Simon 39 | */ 40 | 41 | class ElementStyle 42 | { 43 | public: 44 | 45 | ElementStyle(); 46 | 47 | ~ElementStyle(); 48 | 49 | /** \return True if italic */ 50 | bool isItalic() const; 51 | 52 | /** \return True if italic */ 53 | bool isBlink() const; 54 | 55 | /** \return True if bold */ 56 | bool isBold() const; 57 | 58 | /** \return True if underline */ 59 | bool isUnderline() const; 60 | 61 | /** \return True if concealed */ 62 | bool isConceal() const; 63 | 64 | /** \return True if background color should change */ 65 | bool isBgColorSet() const; 66 | 67 | /** \return True if foreground color should change */ 68 | bool isFgColorSet() const; 69 | 70 | /** \param b set blink flag */ 71 | void setBlink(bool b) 72 | { 73 | blink = b; 74 | } 75 | 76 | /** \param b set italic flag */ 77 | void setItalic(bool b) 78 | { 79 | italic = b; 80 | } 81 | 82 | /** \param b set conceal flag */ 83 | void setConceal(bool b) 84 | { 85 | conceal = b; 86 | } 87 | 88 | /** \param b set bold flag */ 89 | void setBold(bool b) 90 | { 91 | bold = b; 92 | } 93 | 94 | /** \param b set underline flag */ 95 | void setUnderline(bool b) 96 | { 97 | underline = b; 98 | } 99 | 100 | /** \return True if reset flag was set */ 101 | bool isReset() const 102 | { 103 | return reset; 104 | } 105 | 106 | /** \param b reset formatting parameters to defaults */ 107 | void setReset(bool b); 108 | 109 | /** \return Foreground colour */ 110 | const StyleColour getFgColour() const; 111 | 112 | /** \return Background colour */ 113 | const StyleColour getBgColour() const; 114 | 115 | /** Set Foreground colour 116 | \param col colour of this element */ 117 | void setFgColour(const StyleColour& col) 118 | { 119 | fgColour = col; 120 | fgColorSet=true; 121 | } 122 | 123 | /** Set Background colour 124 | \param col colour of this element */ 125 | void setBgColour(const StyleColour& col) 126 | { 127 | bgColour = col; 128 | bgColorSet=true; 129 | } 130 | 131 | /** Set Foreground colour 132 | \param col colour of this element */ 133 | void setFgColour(const string& rgbVal) 134 | { 135 | fgColour.setRGB(rgbVal); 136 | fgColorSet=true; 137 | } 138 | 139 | /** Set Background colour 140 | \param col colour of this element */ 141 | void setBgColour(const string& rgbVal) 142 | { 143 | bgColour.setRGB(rgbVal); 144 | bgColorSet=true; 145 | } 146 | 147 | 148 | /** Set Foreground colour IF (RTF) 149 | \param col colour ID of this element */ 150 | void setFgColourID(int id) 151 | { 152 | fgColID=id; 153 | } 154 | 155 | /** Set Background colour ID (RTF) 156 | \param col colour ID of this element */ 157 | void setBgColourID(int id) 158 | { 159 | bgColID=id; 160 | } 161 | 162 | 163 | /** Set Foreground colour IF (RTF) 164 | \param col colour ID of this element */ 165 | int getFgColourID() 166 | { 167 | return fgColID; 168 | } 169 | 170 | /** Set Background colour ID (RTF) 171 | \param col colour ID of this element */ 172 | int getBgColourID() 173 | { 174 | return bgColID; 175 | } 176 | 177 | /** Swap background and foreground colors 178 | \param negative Set to true, to invert default colors, set to false, to invert them back to default*/ 179 | void imageMode(bool negative=true); 180 | 181 | private: 182 | StyleColour fgColour; 183 | StyleColour bgColour; 184 | bool bold, italic, underline, blink; 185 | bool reset; 186 | bool isNegativeMode, conceal; 187 | bool bgColorSet, fgColorSet; 188 | int fgColID; 189 | int bgColID; 190 | }; 191 | 192 | } 193 | 194 | #endif 195 | -------------------------------------------------------------------------------- /src/enums.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ANSIFilter. 3 | 4 | ANSIFilter is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ANSIFilter is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with ANSIFilter. If not, see . 16 | */ 17 | 18 | #ifndef ENUMS_H 19 | #define ENUMS_H 20 | 21 | namespace ansifilter 22 | { 23 | 24 | /** Parser return values*/ 25 | enum ParseError { 26 | PARSE_OK, 27 | BAD_INPUT=1, 28 | BAD_OUTPUT=2 29 | }; 30 | 31 | /** output formats */ 32 | enum OutputType { 33 | TEXT, 34 | HTML, 35 | PANGO, 36 | XHTML, 37 | TEX, 38 | LATEX, 39 | RTF, 40 | BBCODE 41 | }; 42 | 43 | /** line wrapping modes*/ 44 | enum WrapMode { 45 | WRAP_DISABLED, 46 | WRAP_SIMPLE, 47 | WRAP_DEFAULT 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/htmlgenerator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | htmlgenerator.h - description 3 | ------------------- 4 | 5 | copyright : (C) 2007 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | 27 | #ifndef HTMLGENERATOR_H 28 | #define HTMLGENERATOR_H 29 | 30 | #include 31 | 32 | #include "codegenerator.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates HTML. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Andre Simon 45 | */ 46 | 47 | class HtmlGenerator : public ansifilter::CodeGenerator 48 | { 49 | public: 50 | 51 | HtmlGenerator(); 52 | 53 | /** Destructor, virtual as it is base for xhtmlgenerator*/ 54 | virtual ~HtmlGenerator() {}; 55 | 56 | protected: 57 | 58 | string fileSuffix; ///< filename extension 59 | 60 | /** \return Comment with program information */ 61 | string getGeneratorComment(); 62 | 63 | void insertLineNumber (); 64 | 65 | private: 66 | 67 | string getOpenTag(); 68 | string getCloseTag(); 69 | 70 | /** Print document header 71 | */ 72 | string getHeader(); 73 | 74 | /** Print document body*/ 75 | void printBody(); 76 | 77 | /** Print document footer*/ 78 | string getFooter(); 79 | 80 | /** \return escaped character*/ 81 | virtual string maskCharacter(unsigned char ); 82 | virtual string maskCP437Character(unsigned char); 83 | }; 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/input.col: -------------------------------------------------------------------------------- 1 | All attributes off 2 | 3 | Bold 4 | 5 | Underline 6 | 7 | Italic 8 | 9 | Blink 10 | 11 | Hide 12 | 13 | Black 14 | 15 | Red 16 | 17 | Green 18 | 19 | Yellow 20 | 21 | Blue 22 | 23 | Magenta 24 | 25 | Cyan 26 | 27 | White 28 | 29 | Red Bright 30 | 31 | Green Bright 32 | 33 | Yellow Bright 34 | 35 | Blue Bright 36 | 37 | Magenta Bright 38 | 39 | Cyan Bright 40 | 41 | White Bright 42 | 43 | TEST 44 | 45 | TEST 46 | 47 | Black Background 48 | 49 | Red Background 50 | 51 | Red Background Bright 52 | 53 | Green Background 54 | 55 | Yellow Background 56 | 57 | Blue Background 58 | 59 | Magenta Background 60 | 61 | Cyan Background 62 | 63 | White Background 64 | 65 | TEST 66 | 67 | TEST 68 | 69 | TEST 256 Farben 70 | 71 | TEST 256 Farben 72 | 73 | TEST 256 Farben 74 | 75 | TEST 256 Farben 76 | 77 | TEST 256 Farben 78 | 79 | TEST 256 Farben 80 | 81 | ]0;~ 82 | ]0;New Window title 83 | -------------------------------------------------------------------------------- /src/latexgenerator.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | texgenerator.cpp - description 3 | ------------------- 4 | 5 | copyright : (C) 2008 by Hans Meine 6 | email : hans_meine@gmx.net 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "latexgenerator.h" 31 | #include "version.h" 32 | 33 | namespace ansifilter 34 | { 35 | 36 | LaTeXGenerator::LaTeXGenerator (): 37 | CodeGenerator(LATEX), 38 | fileSuffix(".tex") 39 | { 40 | newLineTag="\\hspace*{\\fill}\\\\\n"; //avoid errors with empty input lines 41 | styleCommentOpen="/*"; 42 | styleCommentClose="*/"; 43 | spacer="\\ws{\\ }"; 44 | } 45 | 46 | string LaTeXGenerator::getOpenTag() 47 | { 48 | 49 | ostringstream fmtStream; 50 | 51 | 52 | if (elementStyle.isBold()) { 53 | fmtStream<< "\\bfseries{}"; 54 | } 55 | if (elementStyle.isItalic()) { 56 | fmtStream<< "\\itshape{}"; 57 | } 58 | 59 | if (elementStyle.isFgColorSet()) { 60 | fmtStream << "\\color[rgb]{" 61 | << elementStyle.getFgColour().getRed(LATEX) << "," 62 | << elementStyle.getFgColour().getGreen(LATEX) << "," 63 | << elementStyle.getFgColour().getBlue(LATEX) 64 | << "}"; 65 | } 66 | 67 | return "{" + fmtStream.str(); 68 | } 69 | 70 | string LaTeXGenerator::getCloseTag() 71 | { 72 | return "}"; 73 | } 74 | 75 | string LaTeXGenerator::getGeneratorComment() 76 | { 77 | ostringstream s; 78 | s <<"% LaTeX generated by ansifilter " 79 | << ANSIFILTER_VERSION << ", " << ANSIFILTER_URL <<"\n"; 80 | 81 | return s.str(); 82 | } 83 | 84 | string LaTeXGenerator::getHeader() 85 | { 86 | ostringstream os; 87 | os << "\\documentclass{article}\n"; 88 | os << "\\usepackage{color}\n"; 89 | os << "\\newcommand{\\ws}[1]{\\textcolor[rgb]{0,0,0}{#1}}\n"; 90 | if (encodingDefined()) { 91 | os << "%\\usepackage[" << encoding << "]{inputenc}\n"; 92 | } 93 | if (!styleSheetPath.empty()) { 94 | os << "\\input {"<' : 130 | return "$>$"; 131 | break; 132 | case '{': 133 | case '}': 134 | case '&': 135 | case '$': 136 | case '#': 137 | case '%': { 138 | string m( "\\" ); 139 | m += c; 140 | return m; 141 | } 142 | break; 143 | // case '\"': 144 | // return (fragmentOutput && replaceQuotes)?"\\dq{}":"\""; 145 | // break; 146 | case '_': 147 | return "\\textunderscore "; 148 | break; 149 | case '^': 150 | return "\\textasciicircum "; 151 | break; 152 | case '\\': 153 | return "$\\backslash$"; 154 | break; 155 | case '~': 156 | return "$\\sim$"; 157 | break; 158 | case '|': 159 | return "\\textbar "; 160 | break; 161 | // avoid latex compilation failure if [ or * follows a line break (\\) 162 | case '*': 163 | case '[': 164 | case ']': 165 | // avoid "merging" of consecutive '-' chars when included in bold font ( \bf ) 166 | case '-': { 167 | string m( 1, '{' ); 168 | m += c; 169 | m += '}'; 170 | return m; 171 | } 172 | break; 173 | 174 | case '\t' : // see deletion of nonprintable chars below 175 | return "\t"; 176 | break; 177 | 178 | default : 179 | if (c>0x1f ) { // printable? 180 | return string( 1, c ); 181 | } else { 182 | return ""; 183 | } 184 | } 185 | 186 | } 187 | 188 | void LaTeXGenerator::insertLineNumber () 189 | { 190 | if ( showLineNumbers ) { 191 | 192 | ostringstream lnum; 193 | lnum << setw ( 5 ) << right; 194 | if( numberCurrentLine ) { 195 | if (lineNumber>1) 196 | *out << getCloseTag(); 197 | lnum << lineNumber; 198 | *out <<"{\\color[rgb]{0,0,0} "<. 24 | */ 25 | 26 | 27 | #ifndef LATEXGENERATOR_H 28 | #define LATEXGENERATOR_H 29 | 30 | #include 31 | 32 | #include "codegenerator.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates LATEX. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Hans Meine 45 | */ 46 | 47 | class LaTeXGenerator : public ansifilter::CodeGenerator 48 | { 49 | public: 50 | 51 | LaTeXGenerator(); 52 | 53 | virtual ~LaTeXGenerator() {}; 54 | 55 | protected: 56 | 57 | string fileSuffix; ///< filename extension 58 | 59 | /** \return Comment with program information */ 60 | string getGeneratorComment(); 61 | 62 | private: 63 | 64 | string getOpenTag(); 65 | string getCloseTag(); 66 | 67 | /** Print document header 68 | */ 69 | string getHeader(); 70 | 71 | /** Print document body*/ 72 | void printBody(); 73 | 74 | /** Print document footer*/ 75 | string getFooter(); 76 | 77 | /** \return escaped character*/ 78 | virtual string maskCharacter(unsigned char ); 79 | 80 | void insertLineNumber(); 81 | }; 82 | 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | main.cpp - description 3 | ------------------- 4 | 5 | copyright : (C) 2007-2017 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | 8 | Highlight is a universal source code to HTML converter. Syntax highlighting 9 | is formatted by Cascading Style Sheets. It's possible to easily enhance 10 | highlight's parsing database. 11 | 12 | ***************************************************************************/ 13 | 14 | /* 15 | This file is part of ANSIFilter. 16 | 17 | ANSIFilter is free software: you can redistribute it and/or modify 18 | it under the terms of the GNU General Public License as published by 19 | the Free Software Foundation, either version 3 of the License, or 20 | (at your option) any later version. 21 | 22 | ANSIFilter is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | GNU General Public License for more details. 26 | 27 | You should have received a copy of the GNU General Public License 28 | along with ANSIFilter. If not, see . 29 | */ 30 | 31 | #include 32 | #include "main.h" 33 | #include "codegenerator.h" 34 | #include "platform_fs.h" 35 | 36 | using namespace std; 37 | 38 | void ANSIFilterApp::printVersionInfo() 39 | { 40 | cout << "\n ansifilter version " 41 | << ANSIFILTER_VERSION 42 | << "\n Copyright (C) 2007-2018 Andre Simon " 43 | << "\n\n Argparser class" 44 | << "\n Copyright (C) 2006-2008 Antonio Diaz Diaz " 45 | << "\n\n This software is released under the terms of the GNU General " 46 | << "Public License." 47 | << "\n For more information about these matters, see the file named " 48 | << "COPYING.\n"; 49 | } 50 | 51 | void ANSIFilterApp::printHelp() 52 | { 53 | cout << "Invocation: ansifilter [OPTION]... [FILE]...\n\n"; 54 | cout << "ansifilter handles text files containing ANSI terminal escape codes.\n"; 55 | cout << "\nFile handling:\n"; 56 | cout << " -i, --input= Name of input file\n"; 57 | cout << " -o, --output= Name of output file\n"; 58 | cout << " -O, --outdir= Name of output directory\n"; 59 | cout << " -t, --tail Continue reading after end-of-file (like tail -f)\n"; 60 | cout << "\nOutput text formats:\n"; 61 | cout << " -T, --text (default) Output text\n"; 62 | cout << " -H, --html Output HTML\n"; 63 | cout << " -M, --pango Output Pango Markup\n"; 64 | cout << " -L, --latex Output LaTeX\n"; 65 | cout << " -P, --tex Output Plain TeX\n"; 66 | cout << " -R, --rtf Output RTF\n"; 67 | cout << " -B, --bbcode Output BBCode\n"; 68 | cout << "\nFormat options:\n"; 69 | cout << " -a, --anchors Add HTML line anchors (assumes -l)\n"; 70 | cout << " -d, --doc-title Set HTML/LaTeX document title\n"; 71 | cout << " -e, --encoding Set HTML/RTF encoding (must match input file encoding)\n"; 72 | cout << " -f, --fragment Omit HTML header and footer\n"; 73 | cout << " -F, --font= Set HTML/RTF font face\n"; 74 | cout << " -l, --line-numbers Print line numbers in output file\n"; 75 | cout << " -m, --map= Read color mapping file (see README)\n"; 76 | cout << " -r, --style-ref= Set HTML/TeX/LaTeX stylesheet path\n"; 77 | cout << " -s, --font-size= Set HTML/RTF font size\n"; 78 | cout << " -p, --plain Ignore ANSI formatting information\n"; 79 | cout << " -w, --wrap= Wrap long lines\n"; 80 | cout << " --no-trailing-nl Omit trailing newline\n"; 81 | cout << " --no-version-info Omit version info comment\n"; 82 | cout << " --wrap-no-numbers Omit line numbers of wrapped lines (assumes -l)\n"; 83 | 84 | cout << "\nANSI art options:\n"; 85 | cout << " --art-cp437 Parse codepage 437 ANSI art (HTML and RTF output)\n"; 86 | cout << " --art-bin Parse BIN/XBIN ANSI art (HTML output, no stdin)\n"; 87 | cout << " --art-tundra Parse Tundra ANSI art (HTML output, no stdin)\n"; 88 | cout << " --art-width Set ANSI art width (default 80)\n"; 89 | cout << " --art-height Set ANSI art height (default 150)\n"; 90 | 91 | cout << "\nOther options:\n"; 92 | cout << " -h, --help Print help\n"; 93 | cout << " -v, --version Print version and license info\n"; 94 | cout << "\nExamples:\n"; 95 | cout << "ansifilter -i input.ansi -o output.txt\n"; 96 | cout << "ansifilter *.txt\n"; 97 | cout << "tail -f server.log | ansifilter\n\n"; 98 | cout << "Parsing XBIN files overrides --art-width, --art-height and --map options.\n"; 99 | cout << "The ANSI art file formats BIN, XBIN and TND cannot be read from stdin.\n"; 100 | cout << "\nPlease report bugs to " ANSIFILTER_EMAIL "\n"; 101 | cout << "For updates see " ANSIFILTER_URL "\n"; 102 | } 103 | 104 | int ANSIFilterApp::run( const int argc, const char *argv[] ) 105 | { 106 | 107 | CmdLineOptions options(argc, argv); 108 | 109 | if (options.printVersion()) { 110 | printVersionInfo(); 111 | return EXIT_SUCCESS; 112 | } 113 | 114 | if (options.printHelp()) { 115 | printHelp(); 116 | return EXIT_SUCCESS; 117 | } 118 | 119 | const vector inFileList=options.getInputFileNames(); 120 | unique_ptr generator(ansifilter::CodeGenerator::getInstance(options.getOutputType())); 121 | 122 | string outDirectory = options.getOutDirectory(); 123 | 124 | unsigned int fileCount=inFileList.size(), i=0; 125 | string::size_type pos=0; 126 | string inFileName, outFilePath; 127 | string mapPath = options.getMapPath(); 128 | bool failure=false; 129 | 130 | if (!generator->setColorMap(mapPath)){ 131 | std::cerr <<"could not read map file: " << mapPath << "\n"; 132 | return EXIT_FAILURE; 133 | } 134 | 135 | 136 | while (i < fileCount && !failure) { 137 | 138 | if (fileCount>1) { 139 | pos=(inFileList[i]).find_last_of(Platform::pathSeparator); 140 | inFileName = inFileList[i].substr(pos+1); 141 | outFilePath = outDirectory; 142 | outFilePath += inFileName; 143 | outFilePath += options.getOutFileSuffix(); 144 | } else { 145 | outFilePath = options.getSingleOutFilename(); 146 | } 147 | 148 | generator->setTitle(options.getDocumentTitle().empty()? 149 | inFileList[i]:options.getDocumentTitle()); 150 | 151 | generator->setEncoding(options.getEncoding()); 152 | generator->setFragmentCode(options.fragmentOutput()); 153 | generator->setPlainOutput(options.plainOutput()); 154 | generator->setContinueReading(options.ignoreInputEOF()); 155 | generator->setFont(options.getFont()); 156 | generator->setFontSize(options.getFontSize()); 157 | generator->setStyleSheet(options.getStyleSheetPath()); 158 | generator->setPreformatting(ansifilter::WRAP_SIMPLE, options.getWrapLineLength()); 159 | generator->setShowLineNumbers(options.showLineNumbers()); 160 | generator->setWrapNoNumbers(!options.wrapNoNumbers()); 161 | generator->setAddAnchors(options.addAnchors()); 162 | generator->setParseCodePage437(options.parseCP437()); 163 | generator->setParseAsciiBin(options.parseAsciiBin()); 164 | generator->setParseAsciiTundra(options.parseAsciiTundra()); 165 | 166 | generator->setAsciiArtSize(options.getAsciiArtWidth(), options.getAsciiArtHeight()); 167 | generator->setOmitTrailingCR(options.omitTrailingCR()); 168 | generator->setOmitVersionInfo(options.omitVersionInfo()); 169 | 170 | ansifilter::ParseError error = generator->generateFile(inFileList[i], outFilePath); 171 | 172 | if (error==ansifilter::BAD_INPUT) { 173 | std::cerr << "could not read input: " << inFileList[i] << "\n"; 174 | failure=true; 175 | } else if (error==ansifilter::BAD_OUTPUT) { 176 | std::cerr << "could not write output: " << outFilePath << "\n"; 177 | failure=true; 178 | } 179 | ++i; 180 | } 181 | return (failure) ? EXIT_FAILURE : EXIT_SUCCESS; 182 | } 183 | 184 | int main( const int argc, const char *argv[] ) 185 | { 186 | ANSIFilterApp app; 187 | return app.run(argc, argv); 188 | } 189 | -------------------------------------------------------------------------------- /src/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ANSIFilter. 3 | 4 | ANSIFilter is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ANSIFilter is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with ANSIFilter. If not, see . 16 | */ 17 | 18 | #ifndef ANSIFILTER_APP 19 | #define ANSIFILTER_APP 20 | 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "cmdlineoptions.h" 31 | //#include "codegenerator.h" 32 | #include "version.h" 33 | //#include "platform_fs.h" 34 | 35 | /// Main application class of the command line interface 36 | 37 | class ANSIFilterApp 38 | { 39 | 40 | public: 41 | 42 | ANSIFilterApp() {}; 43 | ~ANSIFilterApp() {}; 44 | 45 | /** Start application 46 | \param argc Number of command line arguments 47 | \param argv values of command line arguments 48 | \return EXIT_SUCCESS or EXIT_FAILURE 49 | */ 50 | int run( const int argc, const char *argv[] ); 51 | 52 | private: 53 | 54 | /** print version info*/ 55 | void printVersionInfo(); 56 | void printHelp(); 57 | 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/makefile: -------------------------------------------------------------------------------- 1 | # Simple Makefile for ANSIFilter 2 | # This file will compile the ansifilter binary. 3 | # See INSTALL for instructions. 4 | 5 | # afl-g++ for preparing fuzzing tests 6 | CC=g++ 7 | 8 | # Added -std=c++11 because of auto_ptr to unique_ptr transition 9 | CXXFLAGS= -Wall -O2 -DNDEBUG -std=c++11 -fPIC 10 | 11 | LDFLAGS= 12 | 13 | SOURCES=arg_parser.o stringtools.o cmdlineoptions.o main.o platform_fs.o\ 14 | codegenerator.o htmlgenerator.o pangogenerator.o texgenerator.o latexgenerator.o rtfgenerator.o\ 15 | plaintextgenerator.o bbcodegenerator.o elementstyle.o stylecolour.o preformatter.o 16 | 17 | OBJECTS=$(SOURCES:.cpp=.o) 18 | EXECUTABLE=ansifilter 19 | 20 | all: $(SOURCES) $(EXECUTABLE) 21 | 22 | $(EXECUTABLE): $(OBJECTS) 23 | $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJECTS) -o $@ 24 | 25 | .cpp.o: 26 | $(CC) -c $(CXXFLAGS) $(EXTRA_CXXFLAGS) $< -o $@ 27 | 28 | clean: 29 | @rm -f *.o 30 | @rm -f ./ansifilter 31 | @rm -f ./qt-gui/*.o 32 | @rm -f ./qt-gui/.qmake.stash 33 | @rm -f ./qt-gui/ansifilter-gui 34 | @rm -f ./.deps/* 35 | -------------------------------------------------------------------------------- /src/pangogenerator.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | pangogenerator.cpp - description 3 | ------------------- 4 | 5 | copyright : (C) 2014 by Dominik Schmidt 6 | 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "pangogenerator.h" 31 | #include "version.h" 32 | 33 | namespace ansifilter 34 | { 35 | 36 | PangoGenerator::PangoGenerator (): 37 | CodeGenerator(PANGO), 38 | fileSuffix(".pango") 39 | { 40 | newLineTag="\n"; 41 | styleCommentOpen=""; 42 | styleCommentClose=""; 43 | spacer=" "; 44 | } 45 | 46 | string PangoGenerator::getOpenTag() 47 | { 48 | ostringstream fmtStream; 49 | 50 | 51 | if (elementStyle.isBold()) { 52 | fmtStream<< " font-weight=\"bold\""; 53 | } 54 | if (elementStyle.isItalic()) { 55 | fmtStream<< " font-style=\"italic\""; 56 | } 57 | if (elementStyle.isUnderline()) { 58 | fmtStream<< " underline=\"single\""; 59 | } 60 | 61 | if (elementStyle.isFgColorSet()) { 62 | fmtStream << " fgcolor=\"#" 63 | << elementStyle.getFgColour().getRed(HTML) 64 | << elementStyle.getFgColour().getGreen(HTML) 65 | << elementStyle.getFgColour().getBlue(HTML) 66 | << "\""; 67 | } 68 | if (elementStyle.isBgColorSet()) { 69 | fmtStream <<" bgcolor=\"#" 70 | << elementStyle.getBgColour().getRed(HTML) 71 | << elementStyle.getBgColour().getGreen(HTML) 72 | << elementStyle.getBgColour().getBlue(HTML) 73 | << "\""; 74 | } 75 | string fmt = fmtStream.str(); 76 | tagIsOpen = fmt.size()>0; 77 | if (tagIsOpen) { 78 | ostringstream spanTag; 79 | spanTag<< ""; 80 | return spanTag.str(); 81 | } 82 | return ""; 83 | } 84 | 85 | string PangoGenerator::getCloseTag() 86 | { 87 | string retVal = tagIsOpen ? "" : ""; 88 | tagIsOpen = false; 89 | return retVal; 90 | } 91 | string PangoGenerator::getHeader() 92 | { 93 | 94 | int fontSizePango=0; 95 | StringTools::str2num(fontSizePango, fontSize, std::dec); 96 | 97 | ostringstream os; 98 | os << ""; 102 | return os.str(); 103 | } 104 | 105 | string PangoGenerator::getFooter() 106 | { 107 | return ""; 108 | } 109 | 110 | void PangoGenerator::printBody() 111 | { 112 | processInput(); 113 | } 114 | 115 | string PangoGenerator::maskCharacter(unsigned char c) 116 | { 117 | switch (c) { 118 | case '<' : 119 | return "<"; 120 | break; 121 | case '>' : 122 | return ">"; 123 | break; 124 | case '&' : 125 | return "&"; 126 | break; 127 | case '\t': 128 | return "\t"; 129 | break; 130 | 131 | default : 132 | if (c>0x1f ) { // printable? 133 | return string( 1, c ); 134 | } else { 135 | return ""; 136 | } 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/pangogenerator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | pangogenerator.h - description 3 | ------------------- 4 | 5 | copyright : (C) 2014 by Dominik Schmidt 6 | 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | 27 | #ifndef PANGOGENERATOR_H 28 | #define PANGOGENERATOR_H 29 | 30 | #include 31 | 32 | #include "codegenerator.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates Pango Markup. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Dominik Schmidt 45 | */ 46 | 47 | class PangoGenerator : public ansifilter::CodeGenerator 48 | { 49 | public: 50 | 51 | PangoGenerator(); 52 | 53 | virtual ~PangoGenerator() {}; 54 | 55 | protected: 56 | 57 | string fileSuffix; ///< filename extension 58 | 59 | private: 60 | 61 | string getOpenTag(); 62 | string getCloseTag(); 63 | 64 | /** Print document header 65 | */ 66 | string getHeader(); 67 | 68 | /** Print document body*/ 69 | void printBody(); 70 | 71 | /** Print document footer*/ 72 | string getFooter(); 73 | 74 | /** \return escaped character*/ 75 | virtual string maskCharacter(unsigned char ); 76 | }; 77 | 78 | } 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/plaintextgenerator.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | htmlgenerator.cpp - description 3 | ------------------- 4 | 5 | copyright : (C) 2007 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include "plaintextgenerator.h" 27 | #include "version.h" 28 | 29 | namespace ansifilter 30 | { 31 | 32 | PlaintextGenerator::PlaintextGenerator (): 33 | CodeGenerator(TEXT), 34 | fileSuffix(".txt") 35 | { 36 | newLineTag="\n"; 37 | styleCommentOpen=""; 38 | styleCommentClose=""; 39 | spacer=" "; 40 | } 41 | 42 | 43 | string PlaintextGenerator::getHeader() 44 | { 45 | return ""; 46 | } 47 | 48 | string PlaintextGenerator::getFooter() 49 | { 50 | return ""; 51 | } 52 | 53 | void PlaintextGenerator::printBody() 54 | { 55 | processInput(); 56 | } 57 | 58 | string PlaintextGenerator::maskCharacter(unsigned char c) 59 | { 60 | if (c>0x1f || c=='\t') { 61 | return string( 1, c ); 62 | } else { 63 | return ""; 64 | } 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/plaintextgenerator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | htmlgenerator.h - description 3 | ------------------- 4 | 5 | copyright : (C) 2007 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | 27 | #ifndef TEXTGENERATOR_H 28 | #define TEXTGENERATOR_H 29 | 30 | #include 31 | 32 | #include "codegenerator.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates plain text. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Andre Simon 45 | */ 46 | 47 | class PlaintextGenerator : public ansifilter::CodeGenerator 48 | { 49 | public: 50 | 51 | PlaintextGenerator(); 52 | 53 | /** Destructor, virtual as it is base for xhtmlgenerator*/ 54 | virtual ~PlaintextGenerator() {}; 55 | 56 | protected: 57 | 58 | string fileSuffix; ///< filename extension 59 | 60 | private: 61 | 62 | string getOpenTag() 63 | { 64 | return ""; 65 | } 66 | string getCloseTag() 67 | { 68 | return ""; 69 | } 70 | 71 | /** Print document header 72 | */ 73 | string getHeader(); 74 | 75 | /** Print document body*/ 76 | void printBody(); 77 | 78 | /** Print document footer*/ 79 | string getFooter(); 80 | 81 | /** \return escaped character*/ 82 | virtual string maskCharacter(unsigned char ); 83 | }; 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/platform_fs.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ANSIFilter. 3 | 4 | ANSIFilter is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ANSIFilter is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with ANSIFilter. If not, see . 16 | */ 17 | 18 | #include "platform_fs.h" 19 | 20 | using namespace std; 21 | 22 | namespace Platform { 23 | 24 | #ifdef _WIN32 25 | const char pathSeparator = '\\'; 26 | #else 27 | const char pathSeparator = '/'; 28 | #endif 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/platform_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ANSIFilter. 3 | 4 | ANSIFilter is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ANSIFilter is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with ANSIFilter. If not, see . 16 | */ 17 | #ifndef PLATFORM_FS__H__INCLUDED 18 | #define PLATFORM_FS__H__INCLUDED 19 | 20 | #include 21 | 22 | 23 | namespace Platform 24 | { 25 | extern const char pathSeparator; 26 | //extern const std::string pathSeparatorStr; 27 | 28 | std::string getAppPath(); 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /src/preformatter.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | PreFormatter.cpp - description 3 | ------------------- 4 | begin : Mo Jan 03 2005 5 | copyright : (C) 2005-2007 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | 10 | /* 11 | This file is part of Highlight. 12 | 13 | Highlight is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Highlight is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Highlight. If not, see . 25 | */ 26 | 27 | 28 | #include "preformatter.h" 29 | 30 | #include 31 | #include "stringtools.h" 32 | 33 | namespace ansifilter 34 | { 35 | 36 | const std::string PreFormatter::LB_CHARS = " \t[](){}-+<>.:,;"; 37 | const std::string PreFormatter::WS_CHARS = " \n\r\t"; 38 | const std::string PreFormatter::INDENT_MARKERS = "{(="; 39 | 40 | PreFormatter::PreFormatter() : 41 | maxLineLength ( 80 ), 42 | index ( 0 ), 43 | numberSpaces ( 0 ), 44 | lineNumber ( 0 ), 45 | wsPrefixLength ( string::npos ), 46 | hasMore ( false ), 47 | indentAfterOpenBraces ( true ), 48 | redefineWsPrefix ( false ), 49 | wrapLines ( false ), 50 | replaceTabs ( false ) 51 | { 52 | } 53 | 54 | PreFormatter::~PreFormatter() 55 | { 56 | } 57 | 58 | bool PreFormatter::hasMoreLines() 59 | { 60 | return hasMore; 61 | } 62 | 63 | bool PreFormatter::indentCode() 64 | { 65 | return indentAfterOpenBraces; 66 | } 67 | 68 | void PreFormatter::setLine ( const std::string& newLine ) 69 | { 70 | 71 | line=newLine; 72 | 73 | if ( replaceTabs && numberSpaces ) { 74 | size_t tabPos=line.find ( '\t' ); 75 | while ( tabPos!=string::npos ) { 76 | line.replace ( tabPos , 1, numberSpaces - ( tabPos % numberSpaces ) , ' ' ); 77 | tabPos = line.find ( '\t', tabPos+1 ); 78 | } 79 | } 80 | 81 | if ( wrapLines ) { 82 | wsPrefix.clear(); 83 | index=0; 84 | wsPrefixLength=string::npos; 85 | hasMore=true; 86 | redefineWsPrefix=false; 87 | } 88 | } 89 | 90 | std::string PreFormatter::getNextLine() 91 | { 92 | 93 | if ( !wrapLines ) { 94 | hasMore = false; 95 | return line; 96 | } 97 | 98 | ++lineNumber; 99 | 100 | if ( !index && line.length() > maxLineLength ) { // erster Durchlauf... 101 | // wenn moeglich an oeffnender Klammer oder Geichheitszeichen ausrichten 102 | if ( indentAfterOpenBraces ) { 103 | wsPrefixLength=line.find_first_of ( INDENT_MARKERS ); 104 | } 105 | // sonst die Einrckung der Originalzeile beibehalten 106 | if ( wsPrefixLength==string::npos || wsPrefixLength-index>maxLineLength ) { 107 | wsPrefixLength=line.find_first_not_of ( WS_CHARS ); 108 | } else { 109 | // wsPrefix in allen neu umgebrochenen Zeilen durch Spaces ersetzen 110 | redefineWsPrefix=true; 111 | // Position hinter oeffnende Klammer springen 112 | wsPrefixLength=line.find_first_not_of ( WS_CHARS,wsPrefixLength+1 ); 113 | } 114 | 115 | if ( wsPrefixLength!=string::npos ) { 116 | index = wsPrefixLength; 117 | // Falls Anzahl der Whitespaces am beginn der ersten zeile groesser 118 | // als Max. Zeilenlaenge, Whitespaces verwerfen 119 | if ( wsPrefixLength>maxLineLength ) { 120 | wsPrefixLength=0; 121 | return string(); 122 | } else { 123 | wsPrefix=line.substr ( 0, wsPrefixLength ); 124 | } 125 | } 126 | // Zeile enthaelt nur Whitespace; verwerfen 127 | else { 128 | hasMore= false; 129 | return string(); 130 | } 131 | } else { 132 | if ( redefineWsPrefix ) { 133 | wsPrefix.clear(); 134 | wsPrefix.append ( wsPrefixLength, ' ' ); 135 | } 136 | redefineWsPrefix=false; 137 | } 138 | 139 | string resultString; 140 | 141 | // Position, ab der rueckwaerts nach Umbruchmglichkeit gesucht wird 142 | unsigned int searchEndPos = maxLineLength - wsPrefixLength; 143 | 144 | // letztes Teilstueck der Zeile ausgeben; Parsen beenden 145 | if ( line.length()-index < searchEndPos ) { 146 | hasMore=false; 147 | resultString= ( index>0 ) ? wsPrefix + line.substr ( index ) : line.substr ( index ); 148 | return resultString; 149 | } 150 | 151 | // Umbrechposition suchen 152 | size_t lbPos = line.find_last_of ( LB_CHARS, index+searchEndPos ); 153 | if ( lbPos <= index || lbPos == string::npos ) { 154 | // nichts gefunden, hart umbrechen 155 | lbPos = index + searchEndPos; 156 | } 157 | // Einrckung der Originalzeile erhalten 158 | resultString+=wsPrefix; 159 | // Neue Zeile erzeugen 160 | resultString += line.substr ( index, lbPos-index+1 ); 161 | 162 | // Whitespace am neuen Zeilenbeginn ignorieren, ausser beim ersten Durchlauf 163 | size_t newIndex=line.find_first_not_of ( WS_CHARS, lbPos+1 ); 164 | index= ( newIndex!=string::npos ) ?newIndex:line.length(); 165 | 166 | hasMore=index!=line.length(); // unnoetigen Leerstring vermeiden 167 | 168 | if ( hasMore ) wrappedLines.insert ( lineNumber ); // diese Zeile wurde umgebrochen 169 | 170 | return resultString; 171 | } 172 | 173 | void PreFormatter::setWrapLineLength ( unsigned int maxLineLength ) 174 | { 175 | this->maxLineLength = maxLineLength; 176 | } 177 | void PreFormatter::setWrapIndentBraces ( bool indentAfterOpenBraces ) 178 | { 179 | this->indentAfterOpenBraces = indentAfterOpenBraces; 180 | } 181 | 182 | void PreFormatter::setNumberSpaces ( unsigned int num ) 183 | { 184 | numberSpaces = num; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /src/preformatter.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | PreFormatter.cpp - description 3 | ------------------- 4 | begin : Mo Jan 03 2005 5 | copyright : (C) 2005-2008 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | 10 | /* 11 | This file is part of Highlight. 12 | 13 | Highlight is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Highlight is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Highlight. If not, see . 25 | */ 26 | 27 | 28 | #ifndef PreFormatter_H 29 | #define PreFormatter_H 30 | 31 | #include 32 | #include 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** \brief Class which provides intelligent line wrapping. 38 | * @author Andre Simon 39 | */ 40 | 41 | class PreFormatter 42 | { 43 | public: 44 | 45 | PreFormatter(); 46 | 47 | ~PreFormatter(); 48 | 49 | /** 50 | Set wrapping mode 51 | \param wrap set to true if long lines should be wrapped 52 | */ 53 | void setWrap ( bool wrap ) 54 | { 55 | wrapLines = wrap; 56 | } 57 | 58 | /** 59 | Replace tabs by spaces 60 | \param replTabs set to true if tabs should be replaced by spaces 61 | */ 62 | void setReplaceTabs ( bool replTabs ) 63 | { 64 | replaceTabs = replTabs; 65 | } 66 | 67 | /** 68 | \return True if current line can be wrapped again 69 | */ 70 | bool hasMoreLines(); 71 | 72 | /** 73 | Sets new line to be wrapped 74 | \param newline New line 75 | */ 76 | void setLine ( const std::string & newline ); 77 | 78 | /** 79 | The method will indent function calls and statements 80 | \return Next line 81 | */ 82 | std::string getNextLine(); 83 | 84 | /** 85 | \return True if lines following open braces should be indented 86 | */ 87 | bool indentCode(); 88 | 89 | /** 90 | Maximum line length 91 | \param maxlength max. length of output lines 92 | */ 93 | void setWrapLineLength ( unsigned int maxlength ); 94 | 95 | /** 96 | Indentation mode 97 | \param indentAfterOpenBraces set true if lines should be indented after braces 98 | */ 99 | void setWrapIndentBraces ( bool indentAfterOpenBraces=true ); 100 | 101 | /** 102 | Number of spaces 103 | \param num number of spaces which replace a tab 104 | */ 105 | void setNumberSpaces ( unsigned int num ); 106 | 107 | /** 108 | \return true if preformatting is enabled 109 | */ 110 | bool isEnabled() 111 | { 112 | return wrapLines || replaceTabs; 113 | } 114 | 115 | /** 116 | reset preformatting state to use the object with new input data 117 | */ 118 | void reset () 119 | { 120 | lineNumber=0; 121 | wrappedLines.clear(); 122 | } 123 | 124 | /** 125 | \param lineNumber line number 126 | \return true if input line linenumber was wrapped 127 | */ 128 | bool isWrappedLine ( int lineNumber ) 129 | { 130 | return wrappedLines.count ( lineNumber ); 131 | } 132 | 133 | private: 134 | 135 | unsigned int maxLineLength; 136 | 137 | std::string line, wsPrefix; 138 | unsigned int index; 139 | unsigned int numberSpaces; 140 | unsigned int lineNumber; 141 | size_t wsPrefixLength; 142 | bool hasMore, indentAfterOpenBraces; 143 | bool redefineWsPrefix; 144 | bool wrapLines, replaceTabs; 145 | 146 | std::set wrappedLines; 147 | 148 | static const std::string LB_CHARS; 149 | static const std::string WS_CHARS; 150 | static const std::string INDENT_MARKERS; 151 | 152 | }; 153 | 154 | } 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /src/qt-gui/Actions-drop-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/src/qt-gui/Actions-drop-icon.png -------------------------------------------------------------------------------- /src/qt-gui/Makefile.Debug: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile for building: ansifilter-gui 3 | # Generated by qmake (2.01a) (Qt 4.3.1) on: Do 18. Okt 23:40:53 2007 4 | # Project: ansifilter-gui.pro 5 | # Template: app 6 | ############################################################################# 7 | 8 | ####### Compiler, tools and options 9 | 10 | CC = gcc 11 | CXX = g++ 12 | DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DO2 -D_WIN32 -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN 13 | CFLAGS = -g -Wall $(DEFINES) 14 | CXXFLAGS = -g -frtti -fexceptions -mthreads -Wall $(DEFINES) 15 | INCPATH = -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtCore' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtCore' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtGui' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtGui' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include' -I'.' -I'..' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/ActiveQt' -I'debug' -I'.' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/default' 16 | LINK = g++ 17 | LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows 18 | LIBS = -L'f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/lib' -lmingw32 -lqtmaind debug/icon_res.o -lQtGuid4 -lQtCored4 19 | QMAKE = f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/qmake.exe 20 | IDC = f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/idc.exe 21 | IDL = midl 22 | ZIP = zip -r -9 23 | DEF_FILE = 24 | RES_FILE = debug/icon_res.o 25 | COPY = cp 26 | COPY_FILE = $(COPY) 27 | COPY_DIR = xcopy /s /q /y /i 28 | DEL_FILE = rm 29 | DEL_DIR = rmdir 30 | MOVE = mv 31 | CHK_DIR_EXISTS= test -d 32 | MKDIR = mkdir 33 | INSTALL_FILE = $(COPY_FILE) 34 | INSTALL_PROGRAM = $(COPY_FILE) 35 | INSTALL_DIR = $(COPY_DIR) 36 | 37 | ####### Output directory 38 | 39 | OBJECTS_DIR = debug/ 40 | 41 | ####### Files 42 | 43 | SOURCES = main.cpp \ 44 | mydialog.cpp \ 45 | ../elementstyle.cpp \ 46 | ../plaintextgenerator.cpp \ 47 | ../codegenerator.cpp \ 48 | ../platform_fs.cpp \ 49 | ../rtfgenerator.cpp \ 50 | ../htmlgenerator.cpp \ 51 | ../pangogenerator.cpp \ 52 | ../stringtools.cpp \ 53 | ../documentstyle.cpp \ 54 | ../stylecolour.cpp debug/moc_mydialog.cpp 55 | OBJECTS = debug/main.o \ 56 | debug/mydialog.o \ 57 | debug/elementstyle.o \ 58 | debug/plaintextgenerator.o \ 59 | debug/codegenerator.o \ 60 | debug/platform_fs.o \ 61 | debug/rtfgenerator.o \ 62 | debug/htmlgenerator.o \ 63 | debug/pangogenerator.o \ 64 | debug/stringtools.o \ 65 | debug/documentstyle.o \ 66 | debug/stylecolour.o \ 67 | debug/moc_mydialog.o 68 | DIST = 69 | QMAKE_TARGET = ansifilter-gui 70 | DESTDIR = debug/ #avoid trailing-slash linebreak 71 | TARGET = ansifilter-gui.exe 72 | DESTDIR_TARGET = debug/ansifilter-gui.exe 73 | 74 | ####### Implicit rules 75 | 76 | .SUFFIXES: .cpp .cc .cxx .c 77 | 78 | .cpp.o: 79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 80 | 81 | .cc.o: 82 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 83 | 84 | .cxx.o: 85 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 86 | 87 | .c.o: 88 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< 89 | 90 | ####### Build rules 91 | 92 | first: all 93 | all: Makefile.Debug $(DESTDIR_TARGET) 94 | 95 | $(DESTDIR_TARGET): ui_ansifilter.h $(OBJECTS) debug/icon_res.o 96 | $(LINK) $(LFLAGS) -o "$(DESTDIR_TARGET)" object_script.ansifilter-gui.Debug $(LIBS) 97 | 98 | 99 | debug/icon_res.o: icon.rc 100 | windres -i icon.rc -o debug/icon_res.o --include-dir=. 101 | 102 | qmake: FORCE 103 | @$(QMAKE) -win32 -o Makefile.Debug ansifilter-gui.pro 104 | 105 | dist: 106 | $(ZIP) ansifilter-gui.zip $(SOURCES) $(DIST) ansifilter-gui.pro ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/qconfig.pri ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/qt_functions.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/qt_config.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/exclusive_builds.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/default_pre.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/default_pre.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/debug.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/debug_and_release.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/default_post.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/build_pass.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/rtti.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/exceptions.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/stl.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/shared.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/warn_on.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/qt.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/thread.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/moc.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/windows.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/resources.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/uic.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/yacc.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/lex.prf f:\qt-win-opensource-src-4.3.1\qt-win-opensource-src-4.3.1\lib\qtmaind.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES 107 | 108 | clean: compiler_clean 109 | -$(DEL_FILE) debug/main.o debug/mydialog.o debug/elementstyle.o debug/plaintextgenerator.o debug/codegenerator.o debug/platform_fs.o debug/rtfgenerator.o debug/htmlgenerator.o debug/pangogenerator.o debug/stringtools.o debug/documentstyle.o debug/stylecolour.o debug/moc_mydialog.o 110 | -$(DEL_FILE) debug/icon_res.o 111 | 112 | distclean: clean 113 | -$(DEL_FILE) $(DESTDIR_TARGET) 114 | -$(DEL_FILE) Makefile.Debug 115 | 116 | mocclean: compiler_moc_header_clean compiler_moc_source_clean 117 | 118 | mocables: compiler_moc_header_make_all compiler_moc_source_make_all 119 | 120 | compiler_moc_header_make_all: debug/moc_mydialog.cpp 121 | compiler_moc_header_clean: 122 | -$(DEL_FILE) debug/moc_mydialog.cpp 123 | debug/moc_mydialog.cpp: ui_ansifilter.h \ 124 | mydialog.h 125 | F:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 mydialog.h -o debug/moc_mydialog.cpp 126 | 127 | compiler_rcc_make_all: 128 | compiler_rcc_clean: 129 | compiler_image_collection_make_all: qmake_image_collection.cpp 130 | compiler_image_collection_clean: 131 | -$(DEL_FILE) qmake_image_collection.cpp 132 | compiler_moc_source_make_all: 133 | compiler_moc_source_clean: 134 | compiler_uic_make_all: ui_ansifilter.h 135 | compiler_uic_clean: 136 | -$(DEL_FILE) ui_ansifilter.h 137 | ui_ansifilter.h: ansifilter.ui 138 | f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/uic.exe ansifilter.ui -o ui_ansifilter.h 139 | 140 | compiler_yacc_decl_make_all: 141 | compiler_yacc_decl_clean: 142 | compiler_yacc_impl_make_all: 143 | compiler_yacc_impl_clean: 144 | compiler_lex_make_all: 145 | compiler_lex_clean: 146 | compiler_clean: compiler_moc_header_clean compiler_uic_clean 147 | 148 | 149 | 150 | ####### Compile 151 | 152 | debug/main.o: main.cpp mydialog.h \ 153 | ui_ansifilter.h 154 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/main.o main.cpp 155 | 156 | debug/mydialog.o: mydialog.cpp mydialog.h \ 157 | ui_ansifilter.h 158 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/mydialog.o mydialog.cpp 159 | 160 | debug/elementstyle.o: ../elementstyle.cpp ../elementstyle.h \ 161 | ../stylecolour.h \ 162 | ../enums.h 163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/elementstyle.o ../elementstyle.cpp 164 | 165 | debug/plaintextgenerator.o: ../plaintextgenerator.cpp ../plaintextgenerator.h \ 166 | ../codegenerator.h \ 167 | ../elementstyle.h \ 168 | ../stylecolour.h \ 169 | ../enums.h \ 170 | ../documentstyle.h \ 171 | ../configurationreader.h \ 172 | ../stringtools.h \ 173 | ../version.h 174 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/plaintextgenerator.o ../plaintextgenerator.cpp 175 | 176 | debug/codegenerator.o: ../codegenerator.cpp ../codegenerator.h \ 177 | ../elementstyle.h \ 178 | ../stylecolour.h \ 179 | ../enums.h \ 180 | ../documentstyle.h \ 181 | ../configurationreader.h \ 182 | ../stringtools.h \ 183 | ../version.h \ 184 | ../htmlgenerator.h \ 185 | ../pangogenerator.h \ 186 | ../rtfgenerator.h \ 187 | ../plaintextgenerator.h 188 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/codegenerator.o ../codegenerator.cpp 189 | 190 | debug/platform_fs.o: ../platform_fs.cpp ../platform_fs.h 191 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/platform_fs.o ../platform_fs.cpp 192 | 193 | debug/rtfgenerator.o: ../rtfgenerator.cpp ../charcodes.h \ 194 | ../version.h \ 195 | ../rtfgenerator.h \ 196 | ../codegenerator.h \ 197 | ../elementstyle.h \ 198 | ../stylecolour.h \ 199 | ../enums.h \ 200 | ../documentstyle.h \ 201 | ../configurationreader.h \ 202 | ../stringtools.h 203 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/rtfgenerator.o ../rtfgenerator.cpp 204 | 205 | debug/htmlgenerator.o: ../htmlgenerator.cpp ../htmlgenerator.h \ 206 | ../codegenerator.h \ 207 | ../elementstyle.h \ 208 | ../stylecolour.h \ 209 | ../enums.h \ 210 | ../documentstyle.h \ 211 | ../configurationreader.h \ 212 | ../stringtools.h \ 213 | ../version.h 214 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/htmlgenerator.o ../htmlgenerator.cpp 215 | 216 | debug/pangogenerator.o: ../pangogenerator.cpp ../pangogenerator.h \ 217 | ../codegenerator.h \ 218 | ../elementstyle.h \ 219 | ../stylecolour.h \ 220 | ../enums.h \ 221 | ../documentstyle.h \ 222 | ../configurationreader.h \ 223 | ../stringtools.h \ 224 | ../version.h 225 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/pangogenerator.o ../pangogenerator.cpp 226 | 227 | debug/stringtools.o: ../stringtools.cpp ../stringtools.h 228 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/stringtools.o ../stringtools.cpp 229 | 230 | debug/documentstyle.o: ../documentstyle.cpp ../documentstyle.h \ 231 | ../configurationreader.h \ 232 | ../elementstyle.h \ 233 | ../stylecolour.h \ 234 | ../enums.h \ 235 | ../stringtools.h 236 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/documentstyle.o ../documentstyle.cpp 237 | 238 | debug/stylecolour.o: ../stylecolour.cpp ../stylecolour.h \ 239 | ../enums.h \ 240 | ../stringtools.h 241 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/stylecolour.o ../stylecolour.cpp 242 | 243 | debug/moc_mydialog.o: debug/moc_mydialog.cpp 244 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/moc_mydialog.o debug/moc_mydialog.cpp 245 | 246 | ####### Install 247 | 248 | install: FORCE 249 | 250 | uninstall: FORCE 251 | 252 | FORCE: 253 | 254 | -------------------------------------------------------------------------------- /src/qt-gui/Makefile.Release: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile for building: ansifilter-gui 3 | # Generated by qmake (2.01a) (Qt 4.3.1) on: Do 18. Okt 23:40:53 2007 4 | # Project: ansifilter-gui.pro 5 | # Template: app 6 | ############################################################################# 7 | 8 | ####### Compiler, tools and options 9 | 10 | CC = gcc 11 | CXX = g++ 12 | DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DO2 -D_WIN32 -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN 13 | CFLAGS = -O2 -Wall $(DEFINES) 14 | CXXFLAGS = -O2 -frtti -fexceptions -mthreads -Wall $(DEFINES) 15 | INCPATH = -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtCore' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtCore' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtGui' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/QtGui' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include' -I'.' -I'..' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/include/ActiveQt' -I'release' -I'.' -I'../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/default' 16 | LINK = g++ 17 | LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows 18 | LIBS = -L'f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/lib' -lmingw32 -lqtmain release/icon_res.o -lQtGui4 -lQtCore4 19 | QMAKE = f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/qmake.exe 20 | IDC = f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/idc.exe 21 | IDL = midl 22 | ZIP = zip -r -9 23 | DEF_FILE = 24 | RES_FILE = release/icon_res.o 25 | COPY = cp 26 | COPY_FILE = $(COPY) 27 | COPY_DIR = xcopy /s /q /y /i 28 | DEL_FILE = rm 29 | DEL_DIR = rmdir 30 | MOVE = mv 31 | CHK_DIR_EXISTS= test -d 32 | MKDIR = mkdir 33 | INSTALL_FILE = $(COPY_FILE) 34 | INSTALL_PROGRAM = $(COPY_FILE) 35 | INSTALL_DIR = $(COPY_DIR) 36 | 37 | ####### Output directory 38 | 39 | OBJECTS_DIR = release/ 40 | 41 | ####### Files 42 | 43 | SOURCES = main.cpp \ 44 | mydialog.cpp \ 45 | ../elementstyle.cpp \ 46 | ../plaintextgenerator.cpp \ 47 | ../codegenerator.cpp \ 48 | ../platform_fs.cpp \ 49 | ../rtfgenerator.cpp \ 50 | ../htmlgenerator.cpp \ 51 | ../pangogenerator.cpp \ 52 | ../stringtools.cpp \ 53 | ../documentstyle.cpp \ 54 | ../stylecolour.cpp release/moc_mydialog.cpp 55 | OBJECTS = release/main.o \ 56 | release/mydialog.o \ 57 | release/elementstyle.o \ 58 | release/plaintextgenerator.o \ 59 | release/codegenerator.o \ 60 | release/platform_fs.o \ 61 | release/rtfgenerator.o \ 62 | release/htmlgenerator.o \ 63 | release/pangogenerator.o \ 64 | release/stringtools.o \ 65 | release/documentstyle.o \ 66 | release/stylecolour.o \ 67 | release/moc_mydialog.o 68 | DIST = 69 | QMAKE_TARGET = ansifilter-gui 70 | DESTDIR = release/ #avoid trailing-slash linebreak 71 | TARGET = ansifilter-gui.exe 72 | DESTDIR_TARGET = release/ansifilter-gui.exe 73 | 74 | ####### Implicit rules 75 | 76 | .SUFFIXES: .cpp .cc .cxx .c 77 | 78 | .cpp.o: 79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 80 | 81 | .cc.o: 82 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 83 | 84 | .cxx.o: 85 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 86 | 87 | .c.o: 88 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< 89 | 90 | ####### Build rules 91 | 92 | first: all 93 | all: Makefile.Release $(DESTDIR_TARGET) 94 | 95 | $(DESTDIR_TARGET): ui_ansifilter.h $(OBJECTS) release/icon_res.o 96 | $(LINK) $(LFLAGS) -o "$(DESTDIR_TARGET)" object_script.ansifilter-gui.Release $(LIBS) 97 | 98 | 99 | release/icon_res.o: icon.rc 100 | windres -i icon.rc -o release/icon_res.o --include-dir=. 101 | 102 | qmake: FORCE 103 | @$(QMAKE) -win32 -o Makefile.Release ansifilter-gui.pro 104 | 105 | dist: 106 | $(ZIP) ansifilter-gui.zip $(SOURCES) $(DIST) ansifilter-gui.pro ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/qconfig.pri ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/qt_functions.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/qt_config.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/exclusive_builds.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/default_pre.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/default_pre.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/release.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/debug_and_release.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/default_post.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/build_pass.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/rtti.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/exceptions.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/stl.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/shared.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/warn_on.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/qt.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/thread.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/moc.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/win32/windows.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/resources.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/uic.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/yacc.prf ../../../../qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/mkspecs/features/lex.prf f:\qt-win-opensource-src-4.3.1\qt-win-opensource-src-4.3.1\lib\qtmain.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES 107 | 108 | clean: compiler_clean 109 | -$(DEL_FILE) release/main.o release/mydialog.o release/elementstyle.o release/plaintextgenerator.o release/codegenerator.o release/platform_fs.o release/rtfgenerator.o release/htmlgenerator.o release/pangogenerator.o release/stringtools.o release/documentstyle.o release/stylecolour.o release/moc_mydialog.o 110 | -$(DEL_FILE) release/icon_res.o 111 | 112 | distclean: clean 113 | -$(DEL_FILE) $(DESTDIR_TARGET) 114 | -$(DEL_FILE) Makefile.Release 115 | 116 | mocclean: compiler_moc_header_clean compiler_moc_source_clean 117 | 118 | mocables: compiler_moc_header_make_all compiler_moc_source_make_all 119 | 120 | compiler_moc_header_make_all: release/moc_mydialog.cpp 121 | compiler_moc_header_clean: 122 | -$(DEL_FILE) release/moc_mydialog.cpp 123 | release/moc_mydialog.cpp: ui_ansifilter.h \ 124 | mydialog.h 125 | F:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 mydialog.h -o release/moc_mydialog.cpp 126 | 127 | compiler_rcc_make_all: 128 | compiler_rcc_clean: 129 | compiler_image_collection_make_all: qmake_image_collection.cpp 130 | compiler_image_collection_clean: 131 | -$(DEL_FILE) qmake_image_collection.cpp 132 | compiler_moc_source_make_all: 133 | compiler_moc_source_clean: 134 | compiler_uic_make_all: ui_ansifilter.h 135 | compiler_uic_clean: 136 | -$(DEL_FILE) ui_ansifilter.h 137 | ui_ansifilter.h: ansifilter.ui 138 | f:/qt-win-opensource-src-4.3.1/qt-win-opensource-src-4.3.1/bin/uic.exe ansifilter.ui -o ui_ansifilter.h 139 | 140 | compiler_yacc_decl_make_all: 141 | compiler_yacc_decl_clean: 142 | compiler_yacc_impl_make_all: 143 | compiler_yacc_impl_clean: 144 | compiler_lex_make_all: 145 | compiler_lex_clean: 146 | compiler_clean: compiler_moc_header_clean compiler_uic_clean 147 | 148 | 149 | 150 | ####### Compile 151 | 152 | release/main.o: main.cpp mydialog.h \ 153 | ui_ansifilter.h 154 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/main.o main.cpp 155 | 156 | release/mydialog.o: mydialog.cpp mydialog.h \ 157 | ui_ansifilter.h 158 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/mydialog.o mydialog.cpp 159 | 160 | release/elementstyle.o: ../elementstyle.cpp ../elementstyle.h \ 161 | ../stylecolour.h \ 162 | ../enums.h 163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/elementstyle.o ../elementstyle.cpp 164 | 165 | release/plaintextgenerator.o: ../plaintextgenerator.cpp ../plaintextgenerator.h \ 166 | ../codegenerator.h \ 167 | ../elementstyle.h \ 168 | ../stylecolour.h \ 169 | ../enums.h \ 170 | ../documentstyle.h \ 171 | ../configurationreader.h \ 172 | ../stringtools.h \ 173 | ../version.h 174 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/plaintextgenerator.o ../plaintextgenerator.cpp 175 | 176 | release/codegenerator.o: ../codegenerator.cpp ../codegenerator.h \ 177 | ../elementstyle.h \ 178 | ../stylecolour.h \ 179 | ../enums.h \ 180 | ../documentstyle.h \ 181 | ../configurationreader.h \ 182 | ../stringtools.h \ 183 | ../version.h \ 184 | ../htmlgenerator.h \ 185 | ../pangogenerator.h \ 186 | ../rtfgenerator.h \ 187 | ../plaintextgenerator.h 188 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/codegenerator.o ../codegenerator.cpp 189 | 190 | release/platform_fs.o: ../platform_fs.cpp ../platform_fs.h 191 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/platform_fs.o ../platform_fs.cpp 192 | 193 | release/rtfgenerator.o: ../rtfgenerator.cpp ../charcodes.h \ 194 | ../version.h \ 195 | ../rtfgenerator.h \ 196 | ../codegenerator.h \ 197 | ../elementstyle.h \ 198 | ../stylecolour.h \ 199 | ../enums.h \ 200 | ../documentstyle.h \ 201 | ../configurationreader.h \ 202 | ../stringtools.h 203 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/rtfgenerator.o ../rtfgenerator.cpp 204 | 205 | release/htmlgenerator.o: ../htmlgenerator.cpp ../htmlgenerator.h \ 206 | ../codegenerator.h \ 207 | ../elementstyle.h \ 208 | ../stylecolour.h \ 209 | ../enums.h \ 210 | ../documentstyle.h \ 211 | ../configurationreader.h \ 212 | ../stringtools.h \ 213 | ../version.h 214 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/htmlgenerator.o ../htmlgenerator.cpp 215 | 216 | release/pangogenerator.o: ../pangogenerator.cpp ../pangogenerator.h \ 217 | ../codegenerator.h \ 218 | ../elementstyle.h \ 219 | ../stylecolour.h \ 220 | ../enums.h \ 221 | ../documentstyle.h \ 222 | ../configurationreader.h \ 223 | ../stringtools.h \ 224 | ../version.h 225 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/pangogenerator.o ../pangogenerator.cpp 226 | 227 | release/stringtools.o: ../stringtools.cpp ../stringtools.h 228 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/stringtools.o ../stringtools.cpp 229 | 230 | release/documentstyle.o: ../documentstyle.cpp ../documentstyle.h \ 231 | ../configurationreader.h \ 232 | ../elementstyle.h \ 233 | ../stylecolour.h \ 234 | ../enums.h \ 235 | ../stringtools.h 236 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/documentstyle.o ../documentstyle.cpp 237 | 238 | release/stylecolour.o: ../stylecolour.cpp ../stylecolour.h \ 239 | ../enums.h \ 240 | ../stringtools.h 241 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/stylecolour.o ../stylecolour.cpp 242 | 243 | release/moc_mydialog.o: release/moc_mydialog.cpp 244 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/moc_mydialog.o release/moc_mydialog.cpp 245 | 246 | ####### Install 247 | 248 | install: FORCE 249 | 250 | uninstall: FORCE 251 | 252 | FORCE: 253 | 254 | -------------------------------------------------------------------------------- /src/qt-gui/ansifilter-gui.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | 3 | QT += core gui 4 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 5 | 6 | TARGET = ansifilter-gui 7 | DEPENDPATH += . 8 | INCLUDEPATH += . .. 9 | DEFINES += O2 10 | QMAKE_CXXFLAGS += -std=c++11 11 | 12 | # Input 13 | HEADERS += mydialog.h 14 | FORMS += ansifilter.ui 15 | SOURCES += main.cpp mydialog.cpp 16 | SOURCES += ../elementstyle.cpp ../plaintextgenerator.cpp ../codegenerator.cpp 17 | SOURCES += ../platform_fs.cpp ../rtfgenerator.cpp ../htmlgenerator.cpp ../pangogenerator.cpp ../texgenerator.cpp ../latexgenerator.cpp ../bbcodegenerator.cpp 18 | SOURCES += ../stringtools.cpp ../stylecolour.cpp ../preformatter.cpp 19 | 20 | RESOURCES += ansifilter.qrc 21 | win32 { 22 | CONFIG += static 23 | DEFINES += _WIN32 24 | RC_FILE = icon.rc 25 | DESTDIR = ../../ 26 | QMAKE_POST_LINK = E:\Devel\upx393w\upx.exe --best ../../ansifilter-gui.exe 27 | } 28 | 29 | macx-clang:ICON = $${PWD}/ansifilter.icns 30 | macx:ICON = $${PWD}/ansifilter.icns 31 | -------------------------------------------------------------------------------- /src/qt-gui/ansifilter.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/src/qt-gui/ansifilter.icns -------------------------------------------------------------------------------- /src/qt-gui/ansifilter.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andre-simon/ansifilter/d6f424edc8a8b4f7c0938a2d0f0e1d861fff39aa/src/qt-gui/ansifilter.ico -------------------------------------------------------------------------------- /src/qt-gui/ansifilter.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Actions-drop-icon.png 4 | ansifilter.xpm 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/qt-gui/ansifilter.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * ansifilter_logo_xpm[] = { 3 | "48 48 236 2", 4 | " c #FFFFFF", 5 | ". c #FEFEFE", 6 | "+ c #FCFCFC", 7 | "@ c #FBFBFB", 8 | "# c #F9F9F9", 9 | "$ c #F8F8F8", 10 | "% c #FDFDFD", 11 | "& c #FAFAFA", 12 | "* c #CBCBCB", 13 | "= c #B5B5B5", 14 | "- c #B2B2B2", 15 | "; c #B0B0B0", 16 | "> c #AFAFAF", 17 | ", c #E5E5E5", 18 | "' c #F0F0F0", 19 | ") c #F7F7F7", 20 | "! c #F8F2F2", 21 | "~ c #F8A2A2", 22 | "{ c #F4A0A0", 23 | "] c #F19D9D", 24 | "^ c #F09C9C", 25 | "/ c #F09B9B", 26 | "( c #EFB1B1", 27 | "_ c #F2F2F2", 28 | ": c #F3F3F3", 29 | "< c #A5F9A5", 30 | "[ c #A1F5A1", 31 | "} c #9EF29E", 32 | "| c #9CF09C", 33 | "1 c #9BF09B", 34 | "2 c #99F199", 35 | "3 c #F1F1F1", 36 | "4 c #CACACA", 37 | "5 c #3D3D3D", 38 | "6 c #6D6D6D", 39 | "7 c #E1E1E1", 40 | "8 c #ECECEC", 41 | "9 c #FA5858", 42 | "0 c #FF0000", 43 | "a c #DF9D9D", 44 | "b c #E2E2E2", 45 | "c c #EFEFEF", 46 | "d c #B9F5B9", 47 | "e c #00FE00", 48 | "f c #00FF00", 49 | "g c #25F725", 50 | "h c #DFDFDF", 51 | "i c #EDEDED", 52 | "j c #ADADAD", 53 | "k c #5A5A5A", 54 | "l c #C9C9C9", 55 | "m c #DDDDDD", 56 | "n c #F4F4F4", 57 | "o c #F84141", 58 | "p c #FE0000", 59 | "q c #D36D6D", 60 | "r c #CCCCCC", 61 | "s c #E3E3E3", 62 | "t c #A9EDA9", 63 | "u c #0CFA0C", 64 | "v c #C6C6C6", 65 | "w c #AAAAAA", 66 | "x c #535353", 67 | "y c #B3B3B3", 68 | "z c #D1D1D1", 69 | "A c #F43F3F", 70 | "B c #C45F5F", 71 | "C c #BBBBBB", 72 | "D c #D9D9D9", 73 | "E c #A3E7A3", 74 | "F c #00FD00", 75 | "G c #0BF80B", 76 | "H c #B1B1B1", 77 | "I c #D4D4D4", 78 | "J c #EEEEEE", 79 | "K c #A8A8A8", 80 | "L c #515151", 81 | "M c #E9E9E9", 82 | "N c #F43E3E", 83 | "O c #BC5757", 84 | "P c #A0E3A0", 85 | "Q c #0AF70A", 86 | "R c #A7A7A7", 87 | "S c #CECECE", 88 | "T c #505050", 89 | "U c #A5A5A5", 90 | "V c #C8C8C8", 91 | "W c #E8E8E8", 92 | "X c #F33E3E", 93 | "Y c #BB5555", 94 | "Z c #D2D2D2", 95 | "` c #9EE19E", 96 | " . c #00FC00", 97 | ".. c #09F709", 98 | "+. c #A4A4A4", 99 | "@. c #EBEBEB", 100 | "#. c #4F4F4F", 101 | "$. c #E7E7E7", 102 | "%. c #F33D3D", 103 | "&. c #BA5454", 104 | "*. c #A3A3A3", 105 | "=. c #BA5555", 106 | "-. c #F43C3C", 107 | ";. c #BE5555", 108 | ">. c #D3D3D3", 109 | ",. c #9EE39E", 110 | "'. c #08F908", 111 | "). c #A6A6A6", 112 | "!. c #3E3E3E", 113 | "~. c #424242", 114 | "{. c #414141", 115 | "]. c #666666", 116 | "^. c #D0D0D0", 117 | "/. c #EE7171", 118 | "(. c #FB0808", 119 | "_. c #FB0707", 120 | ":. c #FA0606", 121 | "<. c #F90606", 122 | "[. c #FD0202", 123 | "}. c #A78484", 124 | "|. c #BABABA", 125 | "1. c #B9E4B9", 126 | "2. c #08FB08", 127 | "3. c #07FA07", 128 | "4. c #06FA06", 129 | "5. c #06F906", 130 | "6. c #04FB04", 131 | "7. c #3AD53A", 132 | "8. c #9E9E9E", 133 | "9. c #959595", 134 | "0. c #939393", 135 | "a. c #929292", 136 | "b. c #969696", 137 | "c. c #C1C1C1", 138 | "d. c #DCDCDC", 139 | "e. c #E4E3E3", 140 | "f. c #CEBEBE", 141 | "g. c #B5A6A6", 142 | "h. c #A49595", 143 | "i. c #9E8F8F", 144 | "j. c #9D8D8D", 145 | "k. c #A29797", 146 | "l. c #C7D7C7", 147 | "m. c #AEBEAE", 148 | "n. c #99A999", 149 | "o. c #91A191", 150 | "p. c #8E9E8E", 151 | "q. c #8D9D8D", 152 | "r. c #8F9E8F", 153 | "s. c #92A292", 154 | "t. c #DEDEDE", 155 | "u. c #F5F5F5", 156 | "v. c #D5D5D5", 157 | "w. c #BFBFBF", 158 | "x. c #C2C2C2", 159 | "y. c #DADADA", 160 | "z. c #EAEAEA", 161 | "A. c #C3C3C3", 162 | "B. c #BEBEBE", 163 | "C. c #BCBCBC", 164 | "D. c #E4E4E4", 165 | "E. c #BDBDBD", 166 | "F. c #F6F6F6", 167 | "G. c #E6E6E6", 168 | "H. c #DBDBDB", 169 | "I. c #4E4E4E", 170 | "J. c #4D4D4D", 171 | "K. c #4C4C4C", 172 | "L. c #585858", 173 | "M. c #5050F8", 174 | "N. c #1717F9", 175 | "O. c #1818F7", 176 | "P. c #1717F6", 177 | "Q. c #1717F4", 178 | "R. c #1515F6", 179 | "S. c #5858EE", 180 | "T. c #6B6B6B", 181 | "U. c #3C3C3C", 182 | "V. c #8B8B8B", 183 | "W. c #D2D2F2", 184 | "X. c #0000FD", 185 | "Y. c #0000FE", 186 | "Z. c #0202FC", 187 | "`. c #BEBECF", 188 | " + c #7F7F7F", 189 | ".+ c #C5C5C5", 190 | "++ c #E0E0E0", 191 | "@+ c #CDCDEB", 192 | "#+ c #0000FF", 193 | "$+ c #0505FC", 194 | "%+ c #A7A7B7", 195 | "&+ c #6C6C6C", 196 | "*+ c #737373", 197 | "=+ c #B7B7B7", 198 | "-+ c #C8C8E6", 199 | ";+ c #9696A6", 200 | ">+ c #6F6F6F", 201 | ",+ c #D6D6D6", 202 | "'+ c #C6C6E4", 203 | ")+ c #0000FC", 204 | "!+ c #0404FB", 205 | "~+ c #8F8F9F", 206 | "{+ c #6E6E6E", 207 | "]+ c #C5C5E3", 208 | "^+ c #8D8D9D", 209 | "/+ c #C0C0C0", 210 | "(+ c #8E8E9E", 211 | "_+ c #B4B4B4", 212 | ":+ c #D8D8D8", 213 | "<+ c #C5C5E5", 214 | "[+ c #0101FE", 215 | "}+ c #9292A4", 216 | "|+ c #C4C4C4", 217 | "1+ c #5F5F5F", 218 | "2+ c #595959", 219 | "3+ c #525252", 220 | "4+ c #A9A9A9", 221 | "5+ c #6262ED", 222 | "6+ c #2E2EEE", 223 | "7+ c #2929E7", 224 | "8+ c #2525E3", 225 | "9+ c #2424E2", 226 | "0+ c #2323E2", 227 | "a+ c #2323E3", 228 | "b+ c #4C4CCA", 229 | "c+ c #CDCDCD", 230 | "d+ c #CFCFCF", 231 | "e+ c #404040", 232 | "f+ c #D7D7D7", 233 | "g+ c #3F3F3F", 234 | "h+ c #949494", 235 | "i+ c #919191", 236 | "j+ c #545454", 237 | "k+ c #A1A1A1", 238 | "l+ c #A2A2A2", 239 | "m+ c #ACACAC", 240 | " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 241 | " . + @ # $ $ $ $ $ $ $ # @ % % % + & $ $ $ $ $ $ $ $ & + % % + & $ $ $ $ $ $ $ $ # @ + . ", 242 | " . * = - ; > > > > > > , ' ) & ! ~ { ] ^ / / / / ^ ( _ : $ < [ } | 1 1 1 1 1 2 # 3 $ + . ", 243 | " % 4 5 5 5 5 5 5 5 5 5 5 6 7 8 & 9 0 0 0 0 0 0 0 0 0 0 a b c d e f f f f f f f f f g h i $ . ", 244 | ". @ j 5 5 5 5 5 5 5 5 5 5 k l m n o p 0 0 0 0 0 0 0 0 0 q r s t e f f f f f f f f f u v h : + ", 245 | ". # w 5 5 5 5 5 5 5 5 5 5 x y z i A p 0 0 0 0 0 0 0 0 0 B C D E F f f f f f f f f f G H I J @ . ", 246 | ". $ K 5 5 5 5 5 5 5 5 5 5 L K * M N p 0 0 0 0 0 0 0 0 0 O y I P F f f f f f f f f f Q R S 8 & . ", 247 | ". $ R 5 5 5 5 5 5 5 5 5 5 T U V W X p 0 0 0 0 0 0 0 0 0 Y ; Z ` .f f f f f f f f f ..+.* @.& . ", 248 | ". $ R 5 5 5 5 5 5 5 5 5 5 #.U V $.%.p 0 0 0 0 0 0 0 0 0 &.> z ` .f f f f f f f f f ..*.* @.& . ", 249 | ". $ R 5 5 5 5 5 5 5 5 5 5 #.U V $.%.p 0 0 0 0 0 0 0 0 0 &.> z ` .f f f f f f f f f ..*.* @.& . ", 250 | ". $ R 5 5 5 5 5 5 5 5 5 5 #.U V $.%.p 0 0 0 0 0 0 0 0 0 &.> z ` .f f f f f f f f f ..*.* @.& . ", 251 | ". $ R 5 5 5 5 5 5 5 5 5 5 T U V W X p 0 0 0 0 0 0 0 0 0 =.; Z ` .f f f f f f f f f ..+.* @.& . ", 252 | ". $ U 5 5 5 5 5 5 5 5 5 5 T K 4 M -.p 0 0 0 0 0 0 0 0 0 ;.- >.,.F f f f f f f f f f '.).S 8 & . ", 253 | ". # >.!.~.{.{.{.{.{.{.{.{.].> ^.$./.(._.:.:.<.<.<.<.:.[.}.|.D 1.2.2.3.4.4.5.5.5.4.6.7.> I J @ . ", 254 | ". @ c ^.y 8.9.0.a.a.a.0.b.R c.d.@.e.f.g.h.i.j.j.j.j.i.k.; 4 b $.l.m.n.o.p.q.q.q.r.s.w c.t.: + ", 255 | ". + u.W v.V c.w.w.w.w.w.x.4 y.z.: J h S A.B.C.C.C.C.B.A.S h i ' D.>.v w.B.C.C.C.E.c.l D @.) . ", 256 | " . @ u.i W D.s s s s s , M c F.# F.' G.t.H.y.y.y.y.H.t.s 8 n ) : M 7 d.y.y.y.y.y.m 7 W : & % ", 257 | " . + & $ ) ) ) ) ) ) ) # @ + & S I.J.J.K.K.K.K.K.K.L.8 z.: . M.N.O.P.Q.Q.Q.Q.Q.R.S.G.c $ % ", 258 | " . . . % % % % % % % . . % T.U.U.U.U.U.U.U.U.U.U.V.D @.W.X.Y.Y.X.X.X.X.X.X.X.Z.`.b : @ . ", 259 | " % . 6 5 5 5 5 5 5 5 5 5 !. +.+++@+Y.#+#+#+#+#+#+#+#+#+$+%+z 8 # . ", 260 | " + + &+5 5 5 5 5 5 5 5 5 !.*+=+D -+X.#+#+#+#+#+#+#+#+#+$+;+v $.$ . ", 261 | " + & T.5 5 5 5 5 5 5 5 5 !.>+H ,+'+)+#+#+#+#+#+#+#+#+#+!+~+c.D.$ . ", 262 | " + @ T.5 5 5 5 5 5 5 5 5 !.{+; I ]+)+#+#+#+#+#+#+#+#+#+!+^+/+D.$ . ", 263 | " + @ T.5 5 5 5 5 5 5 5 5 !.6 > I ]+)+#+#+#+#+#+#+#+#+#+!+^+w.D.$ . ", 264 | " + @ T.5 5 5 5 5 5 5 5 5 !.6 > I ]+)+#+#+#+#+#+#+#+#+#+!+^+w.D.$ . ", 265 | " + @ T.5 5 5 5 5 5 5 5 5 !.6 > I ]+)+#+#+#+#+#+#+#+#+#+!+^+w.D.$ . ", 266 | " + @ T.5 5 5 5 5 5 5 5 5 !.{+; v.]+)+#+#+#+#+#+#+#+#+#+!+(+/+D.$ . ", 267 | " + + ].5 5 5 5 5 5 5 5 5 !.{+_+:+<+Y.#+#+#+#+#+#+#+#+#+[+}+|+G.$ % ", 268 | " % n V 1+2+x 3+L L L L 3+2+4+/+t.i 5+6+7+8+9+0+0+0+9+a+b+j c+z.# . ", 269 | " % # @.>.C.j R U U U U R j C.>.W J 7 l _+4+).+.+.+.U R ; A.d.' @ . ", 270 | " . @ u.M H.>.d+S S S S d+>.H.M : F.i ++Z * V V V V V 4 ^.d.z.F.% ", 271 | " . @ ) _ c i i i i i i c _ ) & + * _+j w K K K K K K C D.J $ % ", 272 | " . . % + @ & & & & & & @ + % + ++U.U.U.U.U.U.U.U.U.U.{.4 , u.+ . ", 273 | " . . . . . . . . . . . + m 5 5 5 5 5 5 5 5 5 5 e+- ,+J & . ", 274 | " . @ y.5 5 5 5 5 5 5 5 5 5 e+8.l W $ . ", 275 | " . & f+5 5 5 5 5 5 5 5 5 5 g+h+x., $ . ", 276 | " . & f+5 5 5 5 5 5 5 5 5 5 g+a./+D.$ . ", 277 | " . & f+5 5 5 5 5 5 5 5 5 5 g+i+w.D.$ . ", 278 | " . & f+5 5 5 5 5 5 5 5 5 5 g+i+w.D.$ . ", 279 | " . & f+5 5 5 5 5 5 5 5 5 5 g+i+w.D.$ . ", 280 | " . & f+5 5 5 5 5 5 5 5 5 5 g+a./+D.$ . ", 281 | " . & f+5 5 5 5 5 5 5 5 5 5 g+9.x., $ . ", 282 | " . @ J j+!.!.g+g+g+g+g+g+g+I.U 4 M $ . ", 283 | " . + : M S = R *.k+k+k+l+U m+C f+c & . ", 284 | " % $ i d.S v x.x.x.x.x..+* f+M F.+ . ", 285 | " . + ) ' z.$., , , , , G.M J F.@ . ", 286 | " . % @ # $ ) ) ) ) ) $ # @ % . . ", 287 | " . . . % % % % % % % . . . "}; 288 | -------------------------------------------------------------------------------- /src/qt-gui/icon.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "ansifilter.ico" -------------------------------------------------------------------------------- /src/qt-gui/main.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | main.cpp - description 3 | ------------------- 4 | copyright : (C) 2007 by Andre Simon 5 | email : andre.simon1@gmx.de 6 | ***************************************************************************/ 7 | 8 | /* 9 | This file is part of ANSIFilter. 10 | 11 | ANSIFilter is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | ANSIFilter is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with ANSIFilter. If not, see . 23 | */ 24 | 25 | #include 26 | 27 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 28 | #include 29 | #include 30 | #else 31 | #include 32 | #include 33 | #endif 34 | 35 | #include "mydialog.h" 36 | 37 | int main(int argc, char *argv[]) 38 | { 39 | QApplication app(argc, argv); 40 | MyDialog d(0, Qt::Window); 41 | 42 | if (argc>1) d.setInputFileName(argv[1]); 43 | d.show(); 44 | return app.exec(); 45 | } 46 | -------------------------------------------------------------------------------- /src/qt-gui/moc_mydialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'mydialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.3) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "mydialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'mydialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.3. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_MyDialog_t { 24 | QByteArrayData data[20]; 25 | char stringdata0[406]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_MyDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_MyDialog_t qt_meta_stringdata_MyDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 8), // "MyDialog" 35 | QT_MOC_LITERAL(1, 9, 19), // "on_pbSaveAs_clicked" 36 | QT_MOC_LITERAL(2, 29, 0), // "" 37 | QT_MOC_LITERAL(3, 30, 21), // "on_pbFileOpen_clicked" 38 | QT_MOC_LITERAL(4, 52, 18), // "on_pbAbout_clicked" 39 | QT_MOC_LITERAL(5, 71, 22), // "on_pbClipboard_clicked" 40 | QT_MOC_LITERAL(6, 94, 26), // "on_pbSelectMapFile_clicked" 41 | QT_MOC_LITERAL(7, 121, 26), // "on_cbParseAsciiArt_clicked" 42 | QT_MOC_LITERAL(8, 148, 33), // "on_cbIgnoreSequences_stateCha..." 43 | QT_MOC_LITERAL(9, 182, 27), // "on_cbWatchFile_stateChanged" 44 | QT_MOC_LITERAL(10, 210, 23), // "on_sbWidth_valueChanged" 45 | QT_MOC_LITERAL(11, 234, 1), // "i" 46 | QT_MOC_LITERAL(12, 236, 24), // "on_sbHeight_valueChanged" 47 | QT_MOC_LITERAL(13, 261, 32), // "on_comboFont_currentIndexChanged" 48 | QT_MOC_LITERAL(14, 294, 3), // "idx" 49 | QT_MOC_LITERAL(15, 298, 38), // "on_comboAnsiFormat_currentInd..." 50 | QT_MOC_LITERAL(16, 337, 36), // "on_comboEncoding_currentIndex..." 51 | QT_MOC_LITERAL(17, 374, 13), // "onFileChanged" 52 | QT_MOC_LITERAL(18, 388, 4), // "path" 53 | QT_MOC_LITERAL(19, 393, 12) // "plausibility" 54 | 55 | }, 56 | "MyDialog\0on_pbSaveAs_clicked\0\0" 57 | "on_pbFileOpen_clicked\0on_pbAbout_clicked\0" 58 | "on_pbClipboard_clicked\0" 59 | "on_pbSelectMapFile_clicked\0" 60 | "on_cbParseAsciiArt_clicked\0" 61 | "on_cbIgnoreSequences_stateChanged\0" 62 | "on_cbWatchFile_stateChanged\0" 63 | "on_sbWidth_valueChanged\0i\0" 64 | "on_sbHeight_valueChanged\0" 65 | "on_comboFont_currentIndexChanged\0idx\0" 66 | "on_comboAnsiFormat_currentIndexChanged\0" 67 | "on_comboEncoding_currentIndexChanged\0" 68 | "onFileChanged\0path\0plausibility" 69 | }; 70 | #undef QT_MOC_LITERAL 71 | 72 | static const uint qt_meta_data_MyDialog[] = { 73 | 74 | // content: 75 | 7, // revision 76 | 0, // classname 77 | 0, 0, // classinfo 78 | 15, 14, // methods 79 | 0, 0, // properties 80 | 0, 0, // enums/sets 81 | 0, 0, // constructors 82 | 0, // flags 83 | 0, // signalCount 84 | 85 | // slots: name, argc, parameters, tag, flags 86 | 1, 0, 89, 2, 0x0a /* Public */, 87 | 3, 0, 90, 2, 0x0a /* Public */, 88 | 4, 0, 91, 2, 0x0a /* Public */, 89 | 5, 0, 92, 2, 0x0a /* Public */, 90 | 6, 0, 93, 2, 0x0a /* Public */, 91 | 7, 0, 94, 2, 0x0a /* Public */, 92 | 8, 0, 95, 2, 0x0a /* Public */, 93 | 9, 0, 96, 2, 0x0a /* Public */, 94 | 10, 1, 97, 2, 0x0a /* Public */, 95 | 12, 1, 100, 2, 0x0a /* Public */, 96 | 13, 1, 103, 2, 0x0a /* Public */, 97 | 15, 1, 106, 2, 0x0a /* Public */, 98 | 16, 1, 109, 2, 0x0a /* Public */, 99 | 17, 1, 112, 2, 0x0a /* Public */, 100 | 19, 0, 115, 2, 0x0a /* Public */, 101 | 102 | // slots: parameters 103 | QMetaType::Void, 104 | QMetaType::Void, 105 | QMetaType::Void, 106 | QMetaType::Void, 107 | QMetaType::Void, 108 | QMetaType::Void, 109 | QMetaType::Void, 110 | QMetaType::Void, 111 | QMetaType::Void, QMetaType::Int, 11, 112 | QMetaType::Void, QMetaType::Int, 11, 113 | QMetaType::Void, QMetaType::Int, 14, 114 | QMetaType::Void, QMetaType::Int, 14, 115 | QMetaType::Void, QMetaType::Int, 14, 116 | QMetaType::Void, QMetaType::QString, 18, 117 | QMetaType::Void, 118 | 119 | 0 // eod 120 | }; 121 | 122 | void MyDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 123 | { 124 | if (_c == QMetaObject::InvokeMetaMethod) { 125 | MyDialog *_t = static_cast(_o); 126 | Q_UNUSED(_t) 127 | switch (_id) { 128 | case 0: _t->on_pbSaveAs_clicked(); break; 129 | case 1: _t->on_pbFileOpen_clicked(); break; 130 | case 2: _t->on_pbAbout_clicked(); break; 131 | case 3: _t->on_pbClipboard_clicked(); break; 132 | case 4: _t->on_pbSelectMapFile_clicked(); break; 133 | case 5: _t->on_cbParseAsciiArt_clicked(); break; 134 | case 6: _t->on_cbIgnoreSequences_stateChanged(); break; 135 | case 7: _t->on_cbWatchFile_stateChanged(); break; 136 | case 8: _t->on_sbWidth_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; 137 | case 9: _t->on_sbHeight_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; 138 | case 10: _t->on_comboFont_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; 139 | case 11: _t->on_comboAnsiFormat_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; 140 | case 12: _t->on_comboEncoding_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; 141 | case 13: _t->onFileChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; 142 | case 14: _t->plausibility(); break; 143 | default: ; 144 | } 145 | } 146 | } 147 | 148 | const QMetaObject MyDialog::staticMetaObject = { 149 | { &QDialog::staticMetaObject, qt_meta_stringdata_MyDialog.data, 150 | qt_meta_data_MyDialog, qt_static_metacall, nullptr, nullptr} 151 | }; 152 | 153 | 154 | const QMetaObject *MyDialog::metaObject() const 155 | { 156 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 157 | } 158 | 159 | void *MyDialog::qt_metacast(const char *_clname) 160 | { 161 | if (!_clname) return nullptr; 162 | if (!strcmp(_clname, qt_meta_stringdata_MyDialog.stringdata0)) 163 | return static_cast(this); 164 | return QDialog::qt_metacast(_clname); 165 | } 166 | 167 | int MyDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 168 | { 169 | _id = QDialog::qt_metacall(_c, _id, _a); 170 | if (_id < 0) 171 | return _id; 172 | if (_c == QMetaObject::InvokeMetaMethod) { 173 | if (_id < 15) 174 | qt_static_metacall(this, _c, _id, _a); 175 | _id -= 15; 176 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 177 | if (_id < 15) 178 | *reinterpret_cast(_a[0]) = -1; 179 | _id -= 15; 180 | } 181 | return _id; 182 | } 183 | QT_WARNING_POP 184 | QT_END_MOC_NAMESPACE 185 | -------------------------------------------------------------------------------- /src/qt-gui/mydialog.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | mydialog.h - description 3 | ------------------- 4 | copyright : (C) 2007 by Andre Simon 5 | email : andre.simon1@gmx.de 6 | ***************************************************************************/ 7 | 8 | /* 9 | This file is part of ANSIFilter. 10 | 11 | ANSIFilter is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | ANSIFilter is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with ANSIFilter. If not, see . 23 | */ 24 | 25 | #ifndef MYDIALOG 26 | #define MYDIALOG 27 | 28 | #include 29 | #include 30 | #include "ui_ansifilter.h" 31 | #include "codegenerator.h" 32 | 33 | 34 | class MyDialog : public QDialog 35 | { 36 | Q_OBJECT 37 | public: 38 | Ui::Dialog dlg; 39 | //The same constructor that we used last time with QDialog default parameters 40 | MyDialog(QWidget * parent = 0, Qt::WindowFlags f = 0); 41 | 42 | 43 | void setInputFileName(const char* fName) { 44 | inputFileName=QString(fName); 45 | showFile(); 46 | } 47 | 48 | virtual ~MyDialog() {} 49 | 50 | protected: 51 | void closeEvent(QCloseEvent *event); 52 | 53 | private: 54 | QString inputFileName; 55 | QString outputFileName; 56 | 57 | QFileSystemWatcher fileWatcher; 58 | 59 | QString getOutFileSuffix(); 60 | ansifilter::OutputType getOutputType(); 61 | void openFile(const QString & path); 62 | void showFile(); 63 | 64 | void dropEvent(QDropEvent* event); 65 | void dragEnterEvent(QDragEnterEvent *event); 66 | void dragLeaveEvent(QDragLeaveEvent* event); 67 | 68 | public slots: 69 | //This is a slot like the ones we used in our last tutorial 70 | // The difference here that it gets automatically connect 71 | // If you use on_objectname_signalname it's like connect(pushButton,SIGNAL(clicked()),this,SLOT(on_pushButton_clicked())) 72 | void on_pbSaveAs_clicked(); 73 | void on_pbFileOpen_clicked(); 74 | void on_pbAbout_clicked(); 75 | void on_pbClipboard_clicked(); 76 | void on_pbSelectMapFile_clicked(); 77 | void on_cbParseAsciiArt_clicked(); 78 | 79 | void on_cbIgnoreSequences_stateChanged(); 80 | void on_cbWatchFile_stateChanged(); 81 | void on_sbWidth_valueChanged(int i); 82 | void on_sbHeight_valueChanged(int i); 83 | void on_comboFont_currentIndexChanged(int idx); 84 | void on_comboAnsiFormat_currentIndexChanged(int idx); 85 | 86 | void on_comboEncoding_currentIndexChanged(int idx); 87 | void onFileChanged(const QString & path); 88 | void plausibility(); 89 | }; 90 | 91 | #endif 92 | 93 | -------------------------------------------------------------------------------- /src/rtfgenerator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | rtfcode.h - description 3 | ------------------- 4 | 5 | copyright : (C) 2007 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #ifndef RTFGENERATOR_H 27 | #define RTFGENERATOR_H 28 | 29 | #include 30 | #include 31 | #include "codegenerator.h" 32 | 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates RTF. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Andre Simon 45 | */ 46 | 47 | 48 | struct PageSize { 49 | /// RTF page width 50 | int width; 51 | /// RTF page height 52 | int height; 53 | PageSize() 54 | { 55 | } 56 | /** Constructor to define page dimensions 57 | @param w width 58 | @param h height*/ 59 | PageSize(int w, int h) 60 | { 61 | width=w; 62 | height = h; 63 | } 64 | }; 65 | 66 | /** mapping of page size names and dimensions */ 67 | typedef map PagesizeMap; 68 | 69 | class RtfGenerator : public ansifilter::CodeGenerator 70 | { 71 | public: 72 | 73 | RtfGenerator(); 74 | ~RtfGenerator(); 75 | 76 | /** \param page size*/ 77 | void setPageSize(const string & ps); 78 | 79 | private: 80 | 81 | /** prints document header 82 | */ 83 | string getHeader(); 84 | 85 | /** Prints document footer*/ 86 | string getFooter(); 87 | 88 | /** Prints document body*/ 89 | void printBody(); 90 | 91 | /** Map of several pagesizes */ 92 | PagesizeMap psMap; 93 | 94 | /** name of page size which is mapped to page dimensions*/ 95 | string pageSize; 96 | 97 | 98 | /** flag to enable Unicode conversion */ 99 | bool isUtf8; 100 | 101 | /** utf-8 to utf-16 conversion variables */ 102 | unsigned long utf16Char; 103 | size_t utf8SeqLen; 104 | 105 | 106 | /** \return escaped character*/ 107 | virtual string maskCharacter(unsigned char ); 108 | 109 | /** \return escaped character*/ 110 | virtual string maskCP437Character(unsigned char ); 111 | 112 | /**\return text formatting attributes in RTF format */ 113 | string getAttributes( const StyleColour & col); 114 | 115 | /** @param styleNumber number of current style 116 | @param elem associated element style 117 | @return RTF formatting seqence (colour index + bold + italic)*/ 118 | string getOpenTag(); 119 | 120 | /** @param elem associated element style 121 | @return RTF formatting sequnce to close element formatting */ 122 | string getCloseTag(); 123 | 124 | 125 | void insertLineNumber (); 126 | string unicodeFromHTML(const string &); 127 | 128 | }; 129 | 130 | } 131 | #endif 132 | -------------------------------------------------------------------------------- /src/stringtools.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | stringtools.cpp - description 3 | ------------------- 4 | begin : Mon Dec 10 2001 5 | copyright : (C) 2001 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include "stringtools.h" 27 | 28 | // Avoid problems with isspace and UTF-8 characters, use iswspace 29 | #include 30 | 31 | 32 | using namespace std; 33 | 34 | namespace StringTools 35 | { 36 | 37 | string lowerCase(const string& s) 38 | { 39 | char* buf = new char[s.length()]; 40 | s.copy(buf, s.length()); 41 | for(unsigned int i = 0; i < s.length(); i++) 42 | buf[i] = tolower(buf[i]); 43 | string r(buf, s.length()); 44 | delete[] buf; 45 | return r; 46 | } 47 | 48 | // TODO only one function to change case 49 | string upperCase(const string& s) 50 | { 51 | char* buf = new char[s.length()]; 52 | s.copy(buf, s.length()); 53 | for(unsigned int i = 0; i < s.length(); i++) 54 | buf[i] = toupper(buf[i]); 55 | string r(buf, s.length()); 56 | delete[] buf; 57 | return r; 58 | } 59 | 60 | string trimRight(const string &value) 61 | { 62 | string::size_type where = value.find_last_not_of(" \t\r"); 63 | 64 | if (where == string::npos) 65 | // string has nothing but space 66 | return string(); 67 | 68 | if (where == (value.length() - 1)) 69 | // string has no trailing space, don't copy its contents 70 | return value; 71 | 72 | return value.substr(0, where + 1); 73 | } 74 | 75 | string getParantheseVal(const string &s) 76 | { 77 | string::size_type openPos=s.find('('); 78 | string::size_type closePos=s.rfind(')'); 79 | if (openPos ==string::npos || closePos==string::npos) { 80 | return string(); 81 | } 82 | return s.substr(openPos+1, closePos-openPos-1); 83 | } 84 | 85 | vector splitString(const string& s, unsigned char delim) 86 | { 87 | string::size_type pos=s.find(delim), oldPos=0; 88 | vector results; 89 | 90 | if (pos ==string::npos) { 91 | if (!s.empty())results.push_back(s); 92 | return results; 93 | } 94 | 95 | do { 96 | if (oldPos-pos) results.push_back (s.substr(oldPos, pos-oldPos)); 97 | oldPos=pos+1; 98 | pos=s.find(delim, pos+1); 99 | } while (pos!=string::npos); 100 | results.push_back (s.substr(oldPos)); 101 | 102 | return results; 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/stringtools.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | stringtools.h - description 3 | ------------------- 4 | begin : Mon Dec 10 2001 5 | copyright : (C) 2001 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #ifndef STRINGTOOLS_H 27 | #define STRINGTOOLS_H 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | using namespace std; 34 | 35 | /// Contains methods for string manipulation 36 | 37 | namespace StringTools 38 | { 39 | 40 | /** convert string to lowercase 41 | \param s String 42 | \returns lowercase string */ 43 | string lowerCase(const string &s); 44 | 45 | /** convert string to uppercase 46 | \param s String 47 | \returns uppercase string */ 48 | string upperCase(const string &s); 49 | 50 | 51 | /** \param value String 52 | \return string trimmed on the left side 53 | */ 54 | string trimRight(const string &value); 55 | 56 | /** \param s String, containing a opening and a closing paranthesis 57 | \return value between "(", ")" */ 58 | string getParantheseVal(const string &s); 59 | 60 | /** \param s string containing tokens 61 | \param delim Token delimiter 62 | \return vector containing found tokens */ 63 | vector splitString(const string& s, unsigned char delim); 64 | 65 | /** \param val variable of specified type which will contain the numeric value 66 | \param s string containing a number 67 | \param f format specifier function (IO manipulator) 68 | \return true if successfull */ 69 | template 70 | bool str2num(T &val, const std::string& s, std::ios_base& (*f)(std::ios_base&)) 71 | { 72 | std::istringstream iss(s); 73 | return !(iss >> f >> val).fail(); 74 | } 75 | 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/stylecolour.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | stylecolour.cpp - description 3 | ------------------- 4 | begin : Die Nov 5 2002 5 | copyright : (C) 2002 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include "stylecolour.h" 27 | #include "stringtools.h" 28 | 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | using std::string; 35 | 36 | namespace ansifilter 37 | { 38 | 39 | StyleColour::StyleColour(const string & red, const string & green, const string & blue) 40 | { 41 | ostringstream rgbStream; 42 | rgbStream << red << " " << green << " " << blue; 43 | setRGB(rgbStream.str()); 44 | } 45 | 46 | StyleColour::StyleColour() 47 | { 48 | rgb.iRed = rgb.iGreen = rgb.iBlue = 0; 49 | } 50 | 51 | StyleColour::StyleColour(const string & styleColourString) 52 | { 53 | setRGB(styleColourString); 54 | } 55 | 56 | void StyleColour::setRGB(const string & styleColourString) 57 | { 58 | 59 | if (styleColourString.empty()) return; 60 | 61 | istringstream valueStream(styleColourString.c_str()); 62 | string r, g, b; 63 | char c='\0'; 64 | valueStream >> c; 65 | 66 | if (c=='#') { 67 | string htmlNotation; 68 | valueStream >> htmlNotation; 69 | if (htmlNotation.size() < 6) return; 70 | r = htmlNotation.substr(0, 2); 71 | g = htmlNotation.substr(2, 2); 72 | b = htmlNotation.substr(4, 2); 73 | } else { 74 | valueStream.putback(c); 75 | valueStream >> r; 76 | valueStream >> g; 77 | valueStream >> b; 78 | } 79 | 80 | StringTools::str2num(rgb.iRed, r, std::hex); 81 | StringTools::str2num(rgb.iGreen, g, std::hex); 82 | StringTools::str2num(rgb.iBlue, b, std::hex); 83 | } 84 | 85 | void StyleColour::setRed(const string & red) 86 | { 87 | StringTools::str2num(rgb.iRed, red, std::hex); 88 | } 89 | 90 | void StyleColour::setGreen(const string & green) 91 | { 92 | StringTools::str2num(rgb.iGreen, green, std::hex); 93 | } 94 | 95 | void StyleColour::setBlue(const string & blue) 96 | { 97 | StringTools::str2num(rgb.iBlue, blue, std::hex); 98 | } 99 | 100 | const string StyleColour::getRed(OutputType type) const 101 | { 102 | switch (type) { 103 | case RTF: 104 | return int2str(rgb.iRed, std::dec); 105 | case LATEX: 106 | return float2str( (float) rgb.iRed / 255); 107 | case TEX: 108 | return float2str( 1 - (float) rgb.iRed / 255); 109 | default: 110 | return int2str(rgb.iRed, std::hex); 111 | } 112 | } 113 | 114 | const string StyleColour::getGreen(OutputType type) const 115 | { 116 | switch (type) { 117 | case RTF: 118 | return int2str(rgb.iGreen, std::dec); 119 | case LATEX: 120 | return float2str( (float) rgb.iGreen / 255); 121 | case TEX: 122 | return float2str( 1 - (float) rgb.iGreen / 255); 123 | default: 124 | return int2str(rgb.iGreen, std::hex); 125 | } 126 | } 127 | 128 | const string StyleColour::getBlue(OutputType type) const 129 | { 130 | switch (type) { 131 | case RTF: 132 | return int2str(rgb.iBlue, std::dec); 133 | case LATEX: 134 | return float2str( (float) rgb.iBlue / 255); 135 | case TEX: 136 | return float2str( 1 - (float) rgb.iBlue / 255); 137 | default: 138 | return int2str(rgb.iBlue, std::hex); 139 | } 140 | } 141 | 142 | 143 | string StyleColour::int2str(const int num, std::ios_base& (*f)(std::ios_base&)) const 144 | { 145 | std::ostringstream outStream; 146 | outStream.width(2); 147 | outStream.fill('0'); 148 | outStream << f << num; 149 | 150 | return outStream.str(); 151 | } 152 | 153 | string StyleColour::float2str(const double num) const 154 | { 155 | std::ostringstream outStream; 156 | outStream << ( floor ( num * 100 + .5 ) / 100); 157 | 158 | return outStream.str(); 159 | } 160 | 161 | } 162 | 163 | -------------------------------------------------------------------------------- /src/stylecolour.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | stylecolour.h - description 3 | ------------------- 4 | begin : Die Nov 5 2002 5 | copyright : (C) 2002 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #ifndef STYLECOLOUR_H 27 | #define STYLECOLOUR_H 28 | 29 | #include "enums.h" 30 | 31 | #include 32 | 33 | using namespace std; 34 | 35 | namespace ansifilter 36 | { 37 | 38 | /**\brief Stores colours and returns red, green and blue values in different formats 39 | * @author Andre Simon 40 | */ 41 | 42 | struct RGBVal { 43 | int iRed, ///< Red value 44 | iGreen, ///< Green value 45 | iBlue; ///< Blue value 46 | }; 47 | 48 | class StyleColour 49 | { 50 | public: 51 | /** Constructor 52 | \param red Red value in hex notation 53 | \param green Blue value in hex notation 54 | \param blue Green value in hex notation 55 | */ 56 | StyleColour(const string & red, const string & green, const string & blue); 57 | 58 | /** Constructor 59 | \param styleColourString String with rgb values 60 | */ 61 | StyleColour(const string & styleColourString); 62 | 63 | StyleColour(); 64 | ~StyleColour() {}; 65 | 66 | /** Sets red, green and blue values 67 | \param styleColourString String containing colour attributes 68 | */ 69 | void setRGB(const string & styleColourString); 70 | 71 | /** Sets red value 72 | \param red New red value */ 73 | void setRed(const string & red); 74 | 75 | /** Sets green value 76 | \param green New green value */ 77 | void setGreen(const string & green); 78 | 79 | /** Sets blue value 80 | \param blue New blue value */ 81 | void setBlue(const string & blue); 82 | 83 | /** @param type Output type 84 | @return Red value in color representation according to output type */ 85 | const string getRed(OutputType type) const; 86 | 87 | /** @param type Output type 88 | @return Green value in color representation according to output type */ 89 | 90 | const string getGreen(OutputType type) const; 91 | /** @param type Output type 92 | @return Blue value in color representation according to output type */ 93 | const string getBlue(OutputType type) const; 94 | 95 | private: 96 | RGBVal rgb; 97 | string int2str(int, std::ios_base& (*f)(std::ios_base&) ) const; 98 | string float2str(double) const; 99 | }; 100 | 101 | } 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /src/tcl/README: -------------------------------------------------------------------------------- 1 | make tcl ;# assumes a Tcl dev environment 2 | 3 | On Thursday, October 8, 2015 at 4:54:25 PM UTC+2, heinrichmartin wrote on comp.lang.tcl: 4 | > Hi, 5 | > 6 | > ansifilter is a nice little tool[1], written by André Simon. It removes or converts ansi escape sequences and has various output formats. I wanted to wrap the C++ code in a Tcl package to provide channel transformers[2]. 7 | > 8 | > I started with "Hello World as a C extension"[3] and successfully compiled and used that code with Tcl8.6 and g++. The current status is not even close to a generic package, but my use case was only "ansifilter -fL" - so further effort seems unlikely at the moment: time to share it :-) 9 | > 10 | > The .src.rpm[4] contains the ansifilter 1.12 source and a patch that adds the Tcl-code and make-target. You can use a rpmbuild environment "rpmbuild -ba SPECS/ansifilter.spec" or just extract, patch and "make tcl". 11 | > 12 | > src/tcl/ansifilter.c is really just a start though. At least, it seems not to leak memory (converted random numbers to LaTeX code for 30min with not change in ps -o rss,vsz). 13 | > 14 | > Comments are welcome! 15 | > Martin 16 | > 17 | > [1] http://andre-simon.de/zip/download.php#ansifilter 18 | > [2] http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/virtchannel_core/transformcore.html 19 | > [3] http://wiki.tcl.tk/11153 20 | > [4] https://app.box.com/s/yxyu45ha19m6bzuyt4yk869675x3nq5v 21 | -------------------------------------------------------------------------------- /src/tcl/makefile: -------------------------------------------------------------------------------- 1 | # Simple Makefile for tclansifilter 2 | # This file will compile the tclansifilter shared object. 3 | 4 | CC=g++ 5 | 6 | CFLAGS= -c -Wall -O2 -fPIC 7 | 8 | LDFLAGS= -shared -fPIC 9 | 10 | SOURCES=stringtools.cpp platform_fs.cpp\ 11 | codegenerator.cpp htmlgenerator.cpp pangogenerator.cpp texgenerator.cpp latexgenerator.cpp rtfgenerator.cpp\ 12 | plaintextgenerator.cpp bbcodegenerator.cpp elementstyle.cpp stylecolour.cpp preformatter.cpp 13 | 14 | OBJECTS=$(SOURCES:.cpp=.o) tclansifilter.o 15 | BINARY=tclansifilter.so 16 | 17 | all: $(OBJECTS) $(BINARY) 18 | 19 | $(BINARY): $(OBJECTS) 20 | $(CC) $(LDFLAGS) $(OBJECTS) -o $@ 21 | 22 | %.o: ../%.cpp 23 | $(CC) $(CFLAGS) $< -o $@ 24 | 25 | clean: 26 | @rm -f *.o 27 | @rm -f $(BINARY) 28 | -------------------------------------------------------------------------------- /src/tcl/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # Tcl package index file, version 1.1 2 | # This file is generated by the "pkg_mkIndex" command 3 | # and sourced either when an application starts up or 4 | # by a "package unknown" script. It invokes the 5 | # "package ifneeded" command to set up package-related 6 | # information so that packages will be loaded automatically 7 | # in response to "package require" commands. When this 8 | # script is sourced, the variable $dir must contain the 9 | # full path name of this file's directory. 10 | 11 | package ifneeded ansifilter 0.2 [list load [file join $dir tclansifilter.so]] 12 | -------------------------------------------------------------------------------- /src/tcl/tclansifilter.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tclansifilter.c -- a minimal Tcl wrapper for ansifilter 3 | */ 4 | #include 5 | #include 6 | #include "../codegenerator.h" 7 | 8 | // Tcl namespace 9 | #define NS "ansifilter" 10 | 11 | // ansifilter requires C++ compiler 12 | extern "C" { 13 | 14 | 15 | static int 16 | Execute_Escape_Cmd(ansifilter::OutputType type, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 17 | { 18 | int i; 19 | // XXX this creates and destroys new instances for every call! 20 | auto_ptr generator(ansifilter::CodeGenerator::getInstance(type)); 21 | generator->setFragmentCode(1); // -f 22 | generator->setPlainOutput(0); 23 | for (i = 1; i < objc; i++) { 24 | Tcl_AppendResult(interp, generator->generateString(Tcl_GetString(objv[i])).c_str(), NULL); 25 | } 26 | return TCL_OK; 27 | } 28 | 29 | static int 30 | LaTeXEscape_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 31 | { 32 | return Execute_Escape_Cmd(ansifilter::LATEX, interp, objc, objv); 33 | } 34 | 35 | static int 36 | TeXEscape_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 37 | { 38 | return Execute_Escape_Cmd(ansifilter::TEX, interp, objc, objv); 39 | } 40 | 41 | static int 42 | HtmlEscape_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 43 | { 44 | return Execute_Escape_Cmd(ansifilter::HTML, interp, objc, objv); 45 | } 46 | 47 | static int 48 | TextEscape_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 49 | { 50 | return Execute_Escape_Cmd(ansifilter::TEXT, interp, objc, objv); 51 | } 52 | 53 | static int 54 | BBCodeEscape_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 55 | { 56 | return Execute_Escape_Cmd(ansifilter::BBCODE, interp, objc, objv); 57 | } 58 | 59 | static int 60 | PangoEscape_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 61 | { 62 | return Execute_Escape_Cmd(ansifilter::PANGO, interp, objc, objv); 63 | } 64 | /* 65 | * Tclansifilter_Init -- Called when Tcl loads your extension. 66 | */ 67 | int DLLEXPORT 68 | Tclansifilter_Init(Tcl_Interp *interp) 69 | { 70 | if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { 71 | return TCL_ERROR; 72 | } 73 | // provide package 74 | if (Tcl_PkgProvide(interp, "ansifilter", "0.2") == TCL_ERROR) { 75 | return TCL_ERROR; 76 | } 77 | // create command 78 | Tcl_CreateObjCommand(interp, NS "::tex", TeXEscape_Cmd, NULL, NULL); 79 | Tcl_CreateObjCommand(interp, NS "::latex", LaTeXEscape_Cmd, NULL, NULL); 80 | Tcl_CreateObjCommand(interp, NS "::html", HtmlEscape_Cmd, NULL, NULL); 81 | Tcl_CreateObjCommand(interp, NS "::text", TextEscape_Cmd, NULL, NULL); 82 | Tcl_CreateObjCommand(interp, NS "::bbcode", BBCodeEscape_Cmd, NULL, NULL); 83 | Tcl_CreateObjCommand(interp, NS "::pango", PangoEscape_Cmd, NULL, NULL); 84 | 85 | return TCL_OK; 86 | } 87 | 88 | } // extern "C" 89 | -------------------------------------------------------------------------------- /src/testansi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-*- coding: utf-8 -*- 3 | 4 | print ( "\033[0mAll attributes off\033[0m\n") 5 | print ( "\033[1;4mBold\nBold\nBold\033[0m\n") 6 | print ( "\033[4mUnderline\033[0m\n") 7 | print ( "\033[3mItalic\033[0m\n") 8 | print ( "\033[5mBlink\033[0m\n") 9 | print ( "\033[8mHide\033[0m\n") 10 | print ( "\033[30mBlack\033[0m\n") 11 | print ( "\033[31mRed\nRed\nRed\nRed\033[0m\n") 12 | print ( "\033[32mGreen\033[0m\n") 13 | print ( "\033[33mYellow\033[0m\n") 14 | print ( "\033[34mBlue\033[0m\n") 15 | print ( "\033[35mMagenta\033[0m\n") 16 | print ( "\033[36mCyan\033[0m\n") 17 | print ( "\033[37mWhite\033[0m\n") 18 | 19 | print ( "\033[90mDarkGray Bright\033[0m\n") 20 | print ( "\033[91mRed Bright\033[0m\n") 21 | print ( "\033[92mGreen Bright\033[0m\n") 22 | print ( "\033[93mYellow Bright\033[0m\n") 23 | print ( "\033[94mBlue Bright\033[0m\n") 24 | print ( "\033[95mMagenta Bright\033[0m\n") 25 | print ( "\033[96mCyan Bright\033[0m\n") 26 | print ( "\033[97mWhite Bright\033[0m\n") 27 | 28 | print ( "\033[38mTEST\033[0m\n") 29 | print ( "\033[39mTEST\033[0m\n") 30 | print ( "\033[40m\033[37mBlack Background\033[0m\n") 31 | print ( "\033[41mRed Background\033[0m\n") 32 | print ( "\033[101mRed Background Bright\033[0m\n") 33 | print ( "\033[42mGreen Background\033[0m\n") 34 | print ( "\033[43mYellow Background\033[0m\n") 35 | print ( "\033[44mBlue Background\033[0m\n") 36 | print ( "\033[45mMagenta Background\033[0m\n") 37 | print ( "\033[46mCyan Background\033[0m\n") 38 | print ( "\033[47mWhite Background\033[0m\n") 39 | print ( "\033[48mTEST\033[0m\n") 40 | print ( "\033[49mTEST\033[0m\n") 41 | 42 | print ( "\033[48;5;1;128mTEST 256 Colours\033[0m\n") 43 | print ( "\033[48;28;129mTEST 256 Colours\033[0m\n") 44 | print ( "\033[48;7;132mTEST 256 Colours\033[0m\n") 45 | print ( "\033[48;131mTEST 256 Colours\033[0m\n") 46 | print ( "\033[48;130mTEST 256 Colours\033[0m\n") 47 | print ( "\033[48;32;47mTEST 256 Colours\033[0m\n") 48 | 49 | #alternative CSI 50 | print ( "CSI\23332mGreen ALT CSI\2330mDefault\n") 51 | print ( "CSI\23333mYellow ALT CSI\2330mDefault\n") 52 | print ( "CSI\xc2\x9b33mYellow UTF8 CSI\xc2\x9b0mDefault\n") 53 | 54 | # xterm sequences) 55 | #^[]0;~^G^M^M) 56 | print ( "Delete:\033]0;~\007\015\015") 57 | print ( "Delete:\033]0;New Window title\007\015") 58 | print ( "Delete:\x900;New Window title\x9c") 59 | 60 | 61 | print ( "tab1\ttab2\t\ttab3\t\t\tend") 62 | 63 | # delete until EOL 64 | print ( "Delete:\033[sTEST s - DELETED\n") 65 | print ( "Delete:\033[uTEST u - DELETED\n") 66 | print ( "Delete:\033[KTEST K - DELETED\033[K\033[K\033[K xxx blablabla\n") 67 | print ( "Delete:\033[1KTEST K1 - DELETED\033[K\033[K\033[2K xxx blablabla\n") 68 | 69 | print ( "Delete:\033[0GTEST G - DELETED\033[0G\033[0G\033[0G xxx blablabla\n") 70 | 71 | # but not with grep --color 72 | print ( "\033[01;31m\033[KGREP COLOR SEQUENCE\033[m\033[K 0;\n") 73 | 74 | print ( "1234567890 12345 67890 1234567890 12345 67890 1234567890123456789012345678901234567890123456789012345678901234567890") 75 | print ( "Ignore:\033[=1hEND\n") 76 | print ( "Ignore:\033[?25lEND\n") 77 | print ( "Ignore:\033[0GEND\n") 78 | -------------------------------------------------------------------------------- /src/texgenerator.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | texgenerator.cpp - description 3 | ------------------- 4 | 5 | copyright : (C) 2008-2015 by Andre Simon 6 | email : andre.simon1@gmx.de 7 | ***************************************************************************/ 8 | 9 | /* 10 | This file is part of ANSIFilter. 11 | 12 | ANSIFilter is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | ANSIFilter is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with ANSIFilter. If not, see . 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "texgenerator.h" 31 | #include "charcodes.h" 32 | #include "version.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | TeXGenerator::TeXGenerator (): 38 | CodeGenerator(TEX), 39 | fileSuffix(".tex") 40 | { 41 | /*This makes TeX to use every par it encounters (the \\leavevmode has 42 | no effect when TeX is in horizontal mode and when TeX is in vertical 43 | mode, it switches it to horizontal mode).*/ 44 | newLineTag="\\leavevmode\\par\n"; 45 | styleCommentOpen="%"; 46 | spacer = "\\ "; 47 | } 48 | 49 | string TeXGenerator::getOpenTag() 50 | { 51 | ostringstream fmtStream; 52 | 53 | if (elementStyle.isBold()) { 54 | fmtStream<< "\\bf"; 55 | } 56 | if (elementStyle.isItalic()) { 57 | fmtStream<< "\\it"; 58 | } 59 | 60 | fmtStream << "\\textColor{" 61 | << elementStyle.getFgColour().getRed(TEX) << " " 62 | << elementStyle.getFgColour().getGreen(TEX) << " " 63 | << elementStyle.getFgColour().getBlue(TEX) 64 | << " 0}"; 65 | 66 | return "{" + fmtStream.str(); 67 | } 68 | 69 | string TeXGenerator::getCloseTag() 70 | { 71 | return "}"; 72 | } 73 | 74 | string TeXGenerator::getGeneratorComment() 75 | { 76 | ostringstream s; 77 | s <<"% TeX generated by ansifilter " 78 | << ANSIFILTER_VERSION << ", " << ANSIFILTER_URL <<"\n"; 79 | 80 | return s.str(); 81 | } 82 | 83 | string TeXGenerator::getHeader() 84 | { 85 | ostringstream os; 86 | os << styleCommentOpen <': 148 | case '=': { 149 | string m( "$\\mathord{" ); 150 | m += c; 151 | m += "}$"; 152 | return m; 153 | } 154 | break; 155 | case AUML_LC: 156 | return "\\\"a"; 157 | break; 158 | case OUML_LC: 159 | return "\\\"o"; 160 | break; 161 | case UUML_LC: 162 | return "\\\"u"; 163 | break; 164 | case AUML_UC: 165 | return "\\\"A"; 166 | break; 167 | case OUML_UC: 168 | return "\\\"O"; 169 | break; 170 | case UUML_UC: 171 | return "\\\"U"; 172 | break; 173 | case AACUTE_LC: 174 | return "\\'a"; 175 | break; 176 | case EACUTE_LC: 177 | return "\\'e"; 178 | break; 179 | case OACUTE_LC: 180 | return "\\'o"; 181 | break; 182 | case UACUTE_LC: 183 | return "\\'u"; 184 | break; 185 | case AGRAVE_LC: 186 | return "\\`a"; 187 | break; 188 | case EGRAVE_LC: 189 | return "\\`e"; 190 | break; 191 | case OGRAVE_LC: 192 | return "\\`o"; 193 | break; 194 | case UGRAVE_LC: 195 | return "\\`u"; 196 | break; 197 | case AACUTE_UC: 198 | return "\\'A"; 199 | break; 200 | case EACUTE_UC: 201 | return "\\'E"; 202 | break; 203 | case OACUTE_UC: 204 | return "\\'O"; 205 | break; 206 | case UACUTE_UC: 207 | return "\\'U"; 208 | break; 209 | case AGRAVE_UC: 210 | return "\\`A"; 211 | break; 212 | case EGRAVE_UC: 213 | return "\\`E"; 214 | break; 215 | case UGRAVE_UC: 216 | return "\\`O"; 217 | break; 218 | case OGRAVE_UC: 219 | return "\\`U"; 220 | break; 221 | case SZLIG: 222 | return "\\ss "; 223 | break; 224 | 225 | case '\t' : // see deletion of nonprintable chars below 226 | return "\t"; 227 | break; 228 | 229 | default : 230 | if (c>0x1f ) { // printable? 231 | return string( 1, c ); 232 | } else { 233 | return ""; 234 | } 235 | } 236 | } 237 | 238 | void TeXGenerator::insertLineNumber () 239 | { 240 | if ( showLineNumbers ) { 241 | 242 | ostringstream lnum; 243 | lnum << setw ( 5 ) << right; 244 | if( numberCurrentLine ) { 245 | if (lineNumber>1) 246 | *out << getCloseTag(); 247 | lnum << lineNumber; 248 | *out <<"{\\textColor{1 1 1 0} "<. 24 | */ 25 | 26 | 27 | #ifndef TEXGENERATOR_H 28 | #define TEXGENERATOR_H 29 | 30 | #include 31 | 32 | #include "codegenerator.h" 33 | 34 | namespace ansifilter 35 | { 36 | 37 | /** 38 | \brief This class generates TeX. 39 | 40 | It contains information about the resulting document structure (document 41 | header and footer), the colour system, white space handling and text 42 | formatting attributes. 43 | 44 | * @author Hans Meine 45 | */ 46 | 47 | class TeXGenerator : public ansifilter::CodeGenerator 48 | { 49 | public: 50 | 51 | TeXGenerator(); 52 | 53 | virtual ~TeXGenerator() {}; 54 | 55 | protected: 56 | 57 | string fileSuffix; ///< filename extension 58 | 59 | /** \return Comment with program information */ 60 | string getGeneratorComment(); 61 | 62 | private: 63 | 64 | string getOpenTag(); 65 | string getCloseTag(); 66 | 67 | /** Print document header 68 | */ 69 | string getHeader(); 70 | 71 | /** Print document body*/ 72 | void printBody(); 73 | 74 | /** Print document footer*/ 75 | string getFooter(); 76 | 77 | /** \return escaped character*/ 78 | virtual string maskCharacter(unsigned char ); 79 | 80 | void insertLineNumber (); 81 | }; 82 | 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | version.h - description 3 | ------------------- 4 | copyright : (C) 2007-2017 by Andre Simon 5 | email : andre.simon1@gmx.de 6 | ***************************************************************************/ 7 | 8 | /* 9 | This file is part of ANSIFilter. 10 | 11 | ANSIFilter is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | ANSIFilter is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with ANSIFilter. If not, see . 23 | */ 24 | 25 | #ifndef VERSION_H 26 | #define VERSION_H 27 | 28 | #define ANSIFILTER_VERSION "2.10" 29 | 30 | #define ANSIFILTER_URL "http://www.andre-simon.de/" 31 | #define ANSIFILTER_EMAIL "andre.simon1@gmx.de" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/w32-projects/ansifilter_cli.pro: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------- 2 | # Project created by QtCreator 2010-02-03T21:56:57 3 | # ------------------------------------------------- 4 | QT -= core \ 5 | gui 6 | TARGET = ansifilter 7 | CONFIG += console 8 | CONFIG -= app_bundle 9 | TEMPLATE = app 10 | 11 | INCLUDEPATH += .. 12 | 13 | win32:DESTDIR = ../../ 14 | win32:QMAKE_CXXFLAGS += -std=c++11 15 | 16 | SOURCES += ../main.cpp ../cmdlineoptions.cpp ../arg_parser.cpp 17 | SOURCES += ../elementstyle.cpp ../plaintextgenerator.cpp ../codegenerator.cpp 18 | SOURCES += ../platform_fs.cpp ../rtfgenerator.cpp ../htmlgenerator.cpp ../texgenerator.cpp ../latexgenerator.cpp ../bbcodegenerator.cpp ../pangogenerator.cpp 19 | SOURCES += ../stringtools.cpp ../stylecolour.cpp ../preformatter.cpp 20 | 21 | win32:QMAKE_POST_LINK = E:\Devel\upx393w\upx.exe --best ../../ansifilter.exe 22 | --------------------------------------------------------------------------------